Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
  • Loading branch information
adrianriobo committed Jul 31, 2024
1 parent f3b0a87 commit a35d977
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build-oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
branches: [ main ]

jobs:
build-oci:
name: build-oci
snc-runner-oci:
name: snc-runner-oci
runs-on: ubuntu-24.04
steps:
- name: Checkout code
Expand All @@ -20,10 +20,10 @@ jobs:
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
SNC_RUNNER=ghcr.io/crc-org/ci-definitions SNC_RUNNER_V=pr-${{ github.event.number }} make oci-build
SNC_RUNNER=ghcr.io/crc-org/ci-definitions SNC_RUNNER_V=pr-${{ github.event.number }} make build-snc-runner-oci
build-multiarch-oci:
name: build-multiarch-oci
build-crc-builder-oci:
name: build-crc-builder-oci
runs-on: ubuntu-24.04
steps:
- name: Checkout code
Expand Down
50 changes: 27 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,47 @@ include tools/tools.mk
# Registries and versions
SNC_RUNNER ?= $(shell sed -n 1p snc-runner/release-info)
SNC_RUNNER_V ?= $(shell sed -n 2p snc-runner/release-info)
# CRC_BUILDER ?= $(shell sed -n 1p crc-builder/release-info)
# CRC_BUILDER_V ?= $(shell sed -n 2p crc-builder/release-info)
CRC_BUILDER ?= $(shell sed -n 1p crc-builder/release-info)
CRC_BUILDER_V ?= $(shell sed -n 2p crc-builder/release-info)

.PHONY: oci-build build-crc-builder-oci oci-push tkn-create tkn-push
.PHONY: build-snc-runner-oci build-crc-builder-oci

## Functions
define oci_builder
${CONTAINER_MANAGER} build -t $(1):$(2) -f $(3)/oci/$(4) $(3)/oci
endef
oci_pusher = ${CONTAINER_MANAGER} push $(1):$(2)
# define oci_builder
# ${CONTAINER_MANAGER} build -t $(1):$(2) -f $(3)/oci/$(4) $(3)/oci
# endef
# oci_pusher = ${CONTAINER_MANAGER} push $(1):$(2)
tkn_creator = sed -e 's%cimage%$(1)%g' -e 's%cversion%$(2)%g' $(3)/tkn/tpl/task.tpl.yaml > $(3)/tkn/task.yaml
tkn_pusher = $(TOOLS_BINDIR)/tkn bundle push $(1):$(2)-tkn -f $(3)/tkn/task.yaml

oci-build:
# snc-runner
$(call oci_builder,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner,Containerfile)
build-snc-runner-oci:
CONTEXT=snc-runner/oci
MANIFEST=$(SNC_RUNNER):$(SNC_RUNNER_V)
build-snc-runner-oci:
${CONTAINER_MANAGER} build -t $(MANIFEST) -f $(CONTEXT)/Containerfile $(CONTEXT)

build-crc-builder-oci:
# ifndef CRC_BUILDER
# CRC_BUILDER=$(shell sed -n 1p crc-builder/release-info)
# endif
# ifndef CRC_BUILDER_V
# CRC_BUILDER_V=v$(shell sed -n 2p crc-builder/release-info)
# endif
CONTEXT=crc-builder/oci
MANIFEST=$(CRC_BUILDER):$(CRC_BUILDER_V)
ifndef CRC_BUILDER
CRC_BUILDER=$(shell sed -n 1p crc-builder/release-info)
endif
ifndef CRC_BUILDER_V
CRC_BUILDER_V=v$(shell sed -n 2p crc-builder/release-info)
endif
build-crc-builder-oci:
${CONTAINER_MANAGER} manifest create $(MANIFEST)-linux
${CONTAINER_MANAGER} build --platform linux/arm64 --build-arg=TARGETARCH=arm64 --manifest $(MANIFEST)-linux -f $(CONTEXT)/Containerfile.linux $(CONTEXT)
${CONTAINER_MANAGER} build --platform linux/amd64 --build-arg=TARGETARCH=amd64 --manifest $(MANIFEST)-linux -f $(CONTEXT)/Containerfile.linux $(CONTEXT)
${CONTAINER_MANAGER} build -t $(MANIFEST)-windows -f $(CONTEXT)/Containerfile.non-linux --build-arg=OS=windows $(CONTEXT)
${CONTAINER_MANAGER} build -t $(MANIFEST)-darwin -f $(CONTEXT)/Containerfile.non-linux --build-arg=OS=darwin $(CONTEXT)

oci-push:
$(call oci_pusher,$(SNC_RUNNER),$(SNC_RUNNER_V))
$(call oci_pusher,$(CRC_BUILDER),$(CRC_BUILDER_V)-linux)
# oci-push:
# $(call oci_pusher,$(SNC_RUNNER),$(SNC_RUNNER_V))
# $(call oci_pusher,$(CRC_BUILDER),$(CRC_BUILDER_V)-linux)

tkn-create:
$(call tkn_creator,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner)
# tkn-create:
# $(call tkn_creator,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner)

tkn-push: install-out-of-tree-tools
$(call tkn_pusher,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner)
# tkn-push: install-out-of-tree-tools
# $(call tkn_pusher,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner)

0 comments on commit a35d977

Please sign in to comment.