Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: chore: migrate crc-e2e #39

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/crc-e2e-builder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: crc-e2e-builder

on:
push:
tags: [ 'crc-e2e-v*' ]
pull_request:
branches: [ main ]
paths: ['crc-e2e/**', '.github\/workflows\/crc-e2e*' ]

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:
CRC_E2E: ghcr.io/crc-org/ci-crc-e2e
CRC_E2E_V: pr-${{ github.event.number }}
run: |
make crc-e2e-oci-build
albfan marked this conversation as resolved.
Show resolved Hide resolved
make crc-e2e-oci-save
echo "image=${CRC_E2E}:${CRC_E2E_V}" >> "$GITHUB_ENV"

- name: Create image metadata
run: |
echo ${{ env.image }} > crc-e2e-image
echo ${{ github.event_name }} > crc-e2e-build-event

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous, it applies in general to all build job

- name: Upload crc-e2e
uses: actions/upload-artifact@v4
with:
name: crc-e2e
path: crc-e2e*

tkn-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Template tkn for PR
if: ${{ github.event_name == 'pull_request' }}
env:
CRC_E2E: ghcr.io/crc-org/ci-crc-e2e
CRC_E2E_V: pr-${{ github.event.number }}
run: |
make crc-e2e-tkn-create

- name: Check tkn specs
run: |
if [[ ! -f crc-e2e/tkn/crc-e2e-installer.yaml ]]; then
exit 1
fi
if [[ ! -f crc-e2e/tkn/crc-e2e.yaml ]]; then
exit 1
fi
# Check if version is in sync

- name: Create k8s Kind Cluster
uses: helm/kind-action@v1

# https://docs.openshift.com/pipelines/1.15/about/op-release-notes.html
- name: Deploy min supported tekton version
run: kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.44.5/release.yaml

- name: Deploy tasks
run: |
kubectl apply -f crc-e2e/tkn/crc-e2e-installer.yaml
kubectl apply -f crc-e2e/tkn/crc-e2e.yaml

- name: Upload crc-e2e-tkn
uses: actions/upload-artifact@v4
with:
name: crc-e2e-tkn
path: crc-e2e/tkn/crc-e2e*
71 changes: 71 additions & 0 deletions .github/workflows/crc-e2e-pusher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: crc-e2e-pusher

on:
workflow_run:
workflows: crc-e2e-builder
types:
- completed

jobs:
push:
name: push
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for other gh action flow, all oci related steps should be removed

if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Download crc-e2e assets
uses: actions/download-artifact@v4
with:
name: crc-e2e
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Get crc-e2e build informaiton
run: |
echo "source_event=$(cat crc-e2e-build-event)" >> "$GITHUB_ENV"
echo "image=$(cat crc-e2e-image)" >> "$GITHUB_ENV"
- name: Log in to ghcr.io
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 quay.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 crc-e2e
run: |
podman load -i crc-e2e-linux.tar
podman push ${{ env.image }}-linux
podman load -i crc-e2e-windows.tar
podman push ${{ env.image }}-windows
podman load -i crc-e2e-darwin.tar
podman push ${{ env.image }}-darwin
- name: Download crc-e2e-tkn assets
uses: actions/download-artifact@v4
with:
name: crc-e2e-tkn
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Push crc-e2e-tkn
env:
TKN_VERSION: '0.37.0'
run: |
curl -LO "https://github.com/tektoncd/cli/releases/download/v${TKN_VERSION}/tkn_${TKN_VERSION}_Linux_x86_64.tar.gz"
tar xvzf "tkn_${TKN_VERSION}_Linux_x86_64.tar.gz" tkn
./tkn bundle push ${{ env.image }}-tkn \
-f crc-e2e-installer.yaml \
-f crc-e2e.yaml
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,22 @@ endif
-f crc-builder/tkn/crc-builder-installer.yaml \
-f crc-builder/tkn/crc-builder.yaml \
-f crc-builder/tkn/crc-builder-arm64.yaml


#### crc-e2e ####

.PHONY: crc-e2e-tkn-create crc-e2e-tkn-push

# Registries and versions
CRC_E2E ?= $(shell sed -n 1p crc-e2e/release-info)
CRC_E2E_V ?= v$(shell sed -n 2p crc-e2e/release-info)
CRC_E2E_SAVE ?= crc-e2e

crc-e2e-tkn-create:
$(call tkn_template,$(CRC_E2E),$(CRC_E2E_V),crc-e2e,crc-e2e)

crc-e2e-tkn-push: install-out-of-tree-tools
ifndef IMAGE
IMAGE = $(CRC_E2E):$(CRC_E2E_V)
endif
$(TOOLS_BINDIR)/tkn bundle push $(IMAGE)-tkn \
-f crc-e2e/tkn/crc-e2e.yaml
5 changes: 5 additions & 0 deletions crc-e2e/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0

* Initial version
35 changes: 35 additions & 0 deletions crc-e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# CRC e2e

## Modifications to the image

Changes to `crc-e2e/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-e2e/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-e2e
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-e2e/manifests/buildconfig.yaml` and start the build from the corresponding `BuildConfig` (depending on the platform).

```bash
oc apply -f support/images/crc-e2e/manifests/buildconfig.yaml
oc start-build image-crc-e2e-<platform>
```

Lastly, make sure that `imagePullPolicy` is set to `Always` in all places that use this imageStreamTag (e.g. `crc-e2e: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-e2e-installer/0.3/crc-e2e-installer.yaml
```

Then undo changes to `crc-e2e/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`._

2 changes: 2 additions & 0 deletions crc-e2e/release-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
quay.io/crc-org/ci-crc-e2e
1.0.0-dev
Loading
Loading