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 Aug 1, 2024
1 parent 06bb460 commit 48bf737
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/oci-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,6 @@ on:
branches: [ main ]

jobs:
build-snc-runner-oci:
name: build-snc-runner-oci
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build image for PR
if: ${{ github.event_name == 'pull_request' }}
shell: bash
env:
SNC_RUNNER: ghcr.io/crc-org/ci-definitions
SNC_RUNNER_V: pr-${{ github.event.number }}
run: |
make build-snc-runner-oci
podman save -o snc-runner.tar ${SNC_RUNNER}:${SNC_RUNNER_V}
- name: Upload image for PR
uses: actions/upload-artifact@v4
with:
name: snc-runner
path: snc-runner.tar

build-crc-builder-oci:
name: build-crc-builder-oci
runs-on: ubuntu-24.04
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/snc-runner-oci-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,45 @@ name: snc-runner-oci-builder

on:
push:
branches: [ main ]
# branches: [ main ]
tags: [ '*' ]
paths: [ 'snc-runner/**', '.github/workflows/snc-runner*' ]
pull_request:
branches: [ main ]
paths: [ 'snc-runner/**', '.github/workflows/snc-runner*' ]
jobs:
build-pr:
if: ${{ github.event_name == 'pull_request' }}
build:
name: build-pr
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build image for PR
if: ${{ github.event_name == 'pull_request' }}
shell: bash
env:
SNC_RUNNER: ghcr.io/crc-org/ci-definitions
SNC_RUNNER_V: pr-${{ github.event.number }}
run: |
make build-snc-runner-oci
podman save -o snc-runner.tar ${SNC_RUNNER}:${SNC_RUNNER_V}
make snc-runner-oci-build
SNC_RUNNER_FILE=snc-runner.tar make snc-runner-oci-save
echo $(SNC_RUNNER):$(SNC_RUNNER_V) > snc-runner-info
- name: Build image for Release
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
make snc-runner-oci-build
SNC_RUNNER_FILE=snc-runner.tar make snc-runner-oci-save
SNC_RUNNER ?= $(sed -n 1p snc-runner/release-info)
SNC_RUNNER_V ?= v$(sed -n 2p snc-runner/release-info)
echo $(SNC_RUNNER):$(SNC_RUNNER_V) > snc-runner-info
- name: Upload image for PR
- name: Upload snc-runner
uses: actions/upload-artifact@v4
with:
name: snc-runner
path: snc-runner.tar

path: snc-runner*

20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ TOOLS_DIR := tools
include tools/tools.mk

# Registries and versions
SNC_RUNNER ?= $(shell sed -n 1p snc-runner/release-info)
SNC_RUNNER_V ?= v$(shell sed -n 2p snc-runner/release-info)
CRC_BUILDER ?= $(shell sed -n 1p crc-builder/release-info)
CRC_BUILDER_V ?= v$(shell sed -n 2p crc-builder/release-info)

Expand All @@ -27,14 +25,22 @@ define tkn_push
$(TOOLS_BINDIR)/tkn bundle push $(1):$(2)-tkn -f $(3)/tkn/task.yaml
endef

.PHONY: build-snc-runner-oci push-snc-runner-oci
.PHONY: snc-runner-oci-build snc-runner-oci-save snc-runner-oci-push

# Variables
SNC_RUNNER ?= $(shell sed -n 1p snc-runner/release-info)
SNC_RUNNER_V ?= v$(shell sed -n 2p snc-runner/release-info)
SNC_RUNNER_FILE ?= snc-runner.tar

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

push-snc-runner-oci:
snc-runner-oci-save:
${CONTAINER_MANAGER} save -o $(SNC_RUNNER_FILE) $(SNC_RUNNER):$(SNC_RUNNER_V)

snc-runner-oci-push:
${CONTAINER_MANAGER} push $(SNC_RUNNER):$(SNC_RUNNER_V)

.PHONY: build-crc-builder-oci push-crc-builder-oci
Expand Down

0 comments on commit 48bf737

Please sign in to comment.