-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: initial structure for building / pushing oci images for ci specs
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
- Loading branch information
1 parent
f6be286
commit 005bf5b
Showing
23 changed files
with
1,220 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: crc-builder-oci-builder | ||
|
||
on: | ||
push: | ||
# If release-info is not changed we may override a version | ||
tags: [ '*' ] | ||
paths: | ||
- '.github\/workflows\/crc-builder\/release-info' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'crc-builder/**' | ||
- '.github\/workflows\/crc-builder*' | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Prepare runner | ||
shell: bash | ||
run: | | ||
sudo apt-get install -y qemu-user-static | ||
- name: Build image for PR | ||
if: ${{ github.event_name == 'pull_request' }} | ||
env: | ||
CRC_BUILDER: ghcr.io/crc-org/ci-crc-builder | ||
CRC_BUILDER_V: pr-${{ github.event.number }} | ||
run: | | ||
make crc-builder-oci-build | ||
CRC_BUILDER_SAVE=crc-builder make crc-builder-oci-save | ||
echo "CRC_BUILDER=${SNC_RUNNER}" >> "$GITHUB_ENV" | ||
echo "CRC_BUILDER_V=${SNC_RUNNER_V}" >> "$GITHUB_ENV" | ||
- name: Build image for Release | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
make crc-builder-oci-build | ||
CRC_BUILDER_SAVE=crc-builder make crc-builder-oci-save | ||
# Get values from release-info | ||
CRC_BUILDER ?= $(sed -n 1p crc-builder/release-info) | ||
CRC_BUILDER_V ?= v$(sed -n 2p crc-builder/release-info) | ||
echo "CRC_BUILDER=${CRC_BUILDER}" >> "$GITHUB_ENV" | ||
echo "CRC_BUILDER_V=${CRC_BUILDER_V}" >> "$GITHUB_ENV" | ||
- name: Create image metadata | ||
run: | | ||
echo ${{ env.CRC_BUILDER }}:${{ env.CRC_BUILDER_V }} > crc-builder-info | ||
echo ${{ github.event_name }} > crc-builder-build-event | ||
- name: Upload crc-builder | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: crc-builder | ||
path: crc-builder* | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: crc-builder-oci-pusher | ||
|
||
on: | ||
workflow_run: | ||
workflows: crc-builder-oci-builder | ||
types: | ||
- completed | ||
|
||
jobs: | ||
push: | ||
name: push | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Download crc-builder-oci assets | ||
id: download-gh-context-artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: crc-builder | ||
run-id: ${{ github.event.workflow_run.id }} | ||
github-token: ${{ github.token }} | ||
|
||
- name: Build image for Release | ||
run: | | ||
ls -al | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: snc-runner-oci-builder | ||
|
||
on: | ||
push: | ||
tags: [ '*' ] | ||
paths: | ||
- '.github\/workflows\/snc-runner\/release-info' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'snc-runner/**' | ||
- '.github\/workflows\/snc-runner*' | ||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build image for PR | ||
if: ${{ github.event_name == 'pull_request' }} | ||
env: | ||
# SNC_RUNNER: ghcr.io/crc-org/ci-snc-runner | ||
SNC_RUNNER: ghcr.io/adrianriobo/ci-snc-runner | ||
SNC_RUNNER_V: pr-${{ github.event.number }} | ||
run: | | ||
make snc-runner-oci-build | ||
SNC_RUNNER_SAVE=snc-runner make snc-runner-oci-save | ||
echo "image=${SNC_RUNNER}" >> "$GITHUB_ENV" | ||
echo "tag=${SNC_RUNNER_V}" >> "$GITHUB_ENV" | ||
- name: Build image for Release | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
make snc-runner-oci-build | ||
SNC_RUNNER_SAVE=snc-runner make snc-runner-oci-save | ||
# Get values from release-info | ||
echo "image=$(sed -n 1p snc-runner/release-info)" >> "$GITHUB_ENV" | ||
echo "tag=v$(sed -n 2p snc-runner/release-info)" >> "$GITHUB_ENV" | ||
- name: Create image metadata | ||
run: | | ||
echo ${{ env.image }}:${{ env.tag }} > snc-runner-image | ||
echo ${{ github.event_name }} > snc-runner-build-event | ||
- name: Upload snc-runner | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: snc-runner | ||
path: snc-runner* | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: snc-runner-oci-pusher | ||
|
||
on: | ||
workflow_run: | ||
workflows: snc-runner-oci-builder | ||
types: | ||
- completed | ||
|
||
jobs: | ||
push: | ||
name: push | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Download snc-runner assets | ||
id: download-gh-context-artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: snc-runner | ||
run-id: ${{ github.event.workflow_run.id }} | ||
github-token: ${{ github.token }} | ||
|
||
- name: Get snc-runner build informaiton | ||
run: | | ||
echo "source_event=$(cat snc-runner-build-event)" >> "$GITHUB_ENV" | ||
echo "image=$(cat snc-runner-image)" >> "$GITHUB_ENV" | ||
- name: Log in to ghcr.io for PR | ||
if: ${{ env.source_event == 'pull_request' }} | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Log in to ghcr.io | ||
if: ${{ env.source_event == 'push' }} | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Loginquay.io | ||
if: ${{ env.source_event == 'push' }} | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_IO_USERNAME }} | ||
password: ${{ secrets.QUAY_IO_PASSWORD }} | ||
|
||
- name: Push snc-runner | ||
run: | | ||
podman load -i snc-runner.tar | ||
podman push ${{ env.image }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Changelog | ||
|
||
## 1.0.0 | ||
|
||
* Initial version for managinig 2 types of builders | ||
* linux multi arch container based | ||
* windows and mac build on remote target | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# CRC Builder | ||
|
||
## Modifications to the image | ||
|
||
Changes to `crc-builder/os/macos/builder/build.sh` require re-building and pushing the image to internal registry (ImageStream). Make sure the changes are pushed to some `mybranch` on your fork of the QE platform repo (`github.com/<your-username>/qe-platform`). Since the `crc-builder/manifests/buildconfig.yaml` will be guiding the build of the image, it needs to specify your branch on your fork as the source. | ||
|
||
```diff | ||
source: | ||
contextDir: support/images/crc-builder | ||
git: | ||
# dev | ||
+ ref: 'mybranch' | ||
+ uri: 'https://gitlab.cee.redhat.com/<your-username>/qe-platform.git' | ||
- ref: v2.14.0 | ||
- uri: 'https://gitlab.cee.redhat.com/crc/qe-platform.git' | ||
type: Git | ||
``` | ||
|
||
Log in to `codeready-container` project, apply the changes in `crc-builder/manifests/buildconfig.yaml` and start the build from the corresponding `BuildConfig` (depending on the platform). | ||
|
||
```bash | ||
oc apply -f support/images/crc-builder/manifests/buildconfig.yaml | ||
oc start-build image-crc-builder-<platform> | ||
``` | ||
|
||
Lastly, make sure that `imagePullPolicy` is set to `Always` in all places that use this imageStreamTag (e.g. `crc-builder:v0.0.3-macos`). In our case, we needed to change and re-apply the following YAML. | ||
|
||
```bash | ||
oc apply -f orchestrator/catalog/task/crc-builder-installer/0.3/crc-builder-installer.yaml | ||
``` | ||
|
||
Then undo changes to `crc-builder/manifests/buildconfig.yaml` so it points to the upstream repository. | ||
|
||
_If everything works as expected, send an MR to `gitlab.cee.redhat.com/crc/qe-platform`._ | ||
|
Oops, something went wrong.