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

test #13

Closed
wants to merge 4 commits into from
Closed

test #13

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
40 changes: 40 additions & 0 deletions .github/workflows/crc-builder-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,46 @@ jobs:
name: crc-builder
path: crc-builder*

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_BUILDER: ghcr.io/crc-org/ci-crc-builder
CRC_BUILDER: ghcr.io/adrianriobo/ci-crc-builder
CRC_BUILDER_V: pr-${{ github.event.number }}
run: |
make crc-builder-tkn-create

- name: Check tkn for release
if: ${{ github.event_name == 'push' }}
run: |
[ ! -f crc-builder/tkn/crc-builder-installer.yaml ] && exit 1
[ ! -f crc-builder/tkn/crc-builder.yaml ] && exit 1
# 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-builder/tkn/crc-builder-installer.yaml
kubectl apply -f crc-builder/tkn/crc-builder.yaml

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




Expand Down
30 changes: 26 additions & 4 deletions .github/workflows/crc-builder-pusher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
packages: write
steps:
- name: Download crc-builder assets
id: download-gh-context-artifact
uses: actions/download-artifact@v4
with:
name: crc-builder
Expand All @@ -36,7 +35,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to ghcr.io
if: ${{ env.source_event == 'push' }}
if: ${{ env.source_event == 'pull_request' }}
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io
Expand All @@ -53,5 +52,28 @@ jobs:

- name: Push crc-builder
run: |
make snc-runner-oci-load
IMAGE=${{ env.image }} make snc-runner-oci-push
podman load -i crc-builder-linux.tar
podman manifest push ${{ env.image }}-linux
podman load -i crc-builder-windows.tar
podman push ${{ env.image }}-windows
podman load -i crc-builder-darwin.tar
podman push ${{ env.image }}-darwin

- name: Download crc-builder-tkn assets
uses: actions/download-artifact@v4
with:
name: crc-builder-tkn
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Push crc-builder-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-builder-installer.yaml \
-f crc-builder.yaml


38 changes: 37 additions & 1 deletion .github/workflows/snc-runner-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,43 @@ jobs:
name: snc-runner
path: snc-runner*


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_BUILDER: ghcr.io/crc-org/ci-crc-builder
CRC_BUILDER: ghcr.io/adrianriobo/ci-snc-runner
CRC_BUILDER_V: pr-${{ github.event.number }}
run: |
make snc-runner-tkn-create

- name: Check tkn for release
if: ${{ github.event_name == 'push' }}
run: |
[ ! -f snc-runner/tkn/task.yaml ] && exit 1
# 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 snc-runner/tkn/task.yaml

- name: Upload crc-builder-tkn
uses: actions/upload-artifact@v4
with:
name: snc-runner-tkn
path: snc-runner/tkn/task.yaml



20 changes: 18 additions & 2 deletions .github/workflows/snc-runner-pusher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,21 @@ jobs:

- name: Push snc-runner
run: |
make snc-runner-oci-load
IMAGE=${{ env.image }} make snc-runner-oci-push
podman load -i snc-runner.tar
podman push ${{ env.image }}

- name: Download snc-runner-tkn assets
uses: actions/download-artifact@v4
with:
name: snc-runner-tkn
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Push snc-runner-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 task.yaml
39 changes: 24 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,12 @@ include tools/tools.mk
# 2 version
# 3 context
define tkn_template
sed -e 's%cimage%$(1)%g' -e 's%cversion%$(2)%g' $(3)/tkn/tpl/task.tpl.yaml > $(3)/tkn/task.yaml
endef

# Push task as bundle
# 1 image
# 2 version
# 3 context
define tkn_push
$(TOOLS_BINDIR)/tkn bundle push $(1):$(2)-tkn -f $(3)/tkn/task.yaml
sed -e 's%cimage%$(1)%g' -e 's%cversion%$(2)%g' $(3)/tkn/tpl/$(4).tpl.yaml > $(3)/tkn/$(4).yaml
endef

#### snc-runner ####

.PHONY: snc-runner-oci-build snc-runner-oci-save snc-runner-oci-load snc-runner-oci-push
.PHONY: snc-runner-oci-build snc-runner-oci-save snc-runner-oci-load snc-runner-oci-push snc-runner-tkn-create snc-runner-tkn-push

# Variables
SNC_RUNNER ?= $(shell sed -n 1p snc-runner/release-info)
Expand All @@ -47,9 +39,19 @@ ifndef IMAGE
endif
${CONTAINER_MANAGER} push $(IMAGE)

snc-runner-tkn-create:
$(call tkn_template,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner,task)

snc-runner-tkn-push: install-out-of-tree-tools
ifndef IMAGE
IMAGE = $(SNC_RUNNER):$(SNC_RUNNER_V)
endif
$(TOOLS_BINDIR)/tkn bundle push $(IMAGE)-tkn \
-f snc-runner/tkn/task.yaml

#### crc-builder ####

.PHONY: crc-builder-oci-build crc-builder-oci-save crc-builder-oci-load crc-builder-oci-push
.PHONY: crc-builder-oci-build crc-builder-oci-save crc-builder-oci-load crc-builder-oci-push crc-builder-tkn-create crc-builder-tkn-push

# Registries and versions
CRC_BUILDER ?= $(shell sed -n 1p crc-builder/release-info)
Expand Down Expand Up @@ -84,8 +86,15 @@ endif
${CONTAINER_MANAGER} push $(IMAGE)-windows
${CONTAINER_MANAGER} push $(IMAGE)-darwin

# tkn-create:
# $(call tkn_creator,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner)
crc-builder-tkn-create:
$(call tkn_template,$(CRC_BUILDER),$(CRC_BUILDER_V),crc-builder,crc-builder-installer)
$(call tkn_template,$(CRC_BUILDER),$(CRC_BUILDER_V),crc-builder,crc-builder)

# tkn-push: install-out-of-tree-tools
# $(call tkn_pusher,$(SNC_RUNNER),$(SNC_RUNNER_V),snc-runner)
crc-builder-tkn-push: install-out-of-tree-tools
ifndef IMAGE
IMAGE = $(CRC_BUILDER):$(CRC_BUILDER_V)
endif
$(TOOLS_BINDIR)/tkn bundle push $(IMAGE)-tkn \
-f crc-builder/tkn/crc-builder-installer.yaml
-f crc-builder/tkn/crc-builder.yaml

2 changes: 0 additions & 2 deletions crc-builder/oci/lib/linux/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ source ./common.sh

# Execution is controlled based on ENVS:

# CUSTOM_BUNDLE_VERSION_VARIABLE When build based on a custom bundle need to set type: PODMAN_VERSION or OPENSHIFT_VERSION
# CUSTOM_BUNDLE_VERSION When build based on a custom bundle need to set version
# CRC_SCM: Source code repository for crc
# CRC_SCM_PR: Optional parameter to build an specific PR for crc
# CRC_SCM_REF: Optional parameter to build an specific PR for crc
Expand Down
7 changes: 4 additions & 3 deletions crc-builder/tkn/tpl/crc-builder-installer.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ kind: Task
metadata:
name: crc-builder-installer
labels:
app.kubernetes.io/version: "0.0.7"
app.kubernetes.io/version: "cversion"
redhat.com/product: openshift-local
dev.lifecycle.io/phase: build
openshift-local.redhat.com/component: installer
annotations:
tekton.dev/pipelines.minVersion: "0.24.x"
tekton.dev/pipelines.minVersion: "0.44.x"
tekton.dev/categories: installer
tekton.dev/tags: openshift-local, installer
tekton.dev/displayName: "openshift local installer"
Expand Down Expand Up @@ -60,7 +60,8 @@ spec:

steps:
- name: crc-executable-builder
image: quay.io/rhqp/crc-builder:v0.0.7-$(params.os)
# cimage and cversion values should be passed to the template
image: cimage:cversion-$(params.os)
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/host/
Expand Down
25 changes: 5 additions & 20 deletions crc-builder/tkn/tpl/crc-builder.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ kind: Task
metadata:
name: crc-builder
labels:
app.kubernetes.io/version: "0.0.6"
app.kubernetes.io/version: "cversion"
redhat.com/product: openshift-local
dev.lifecycle.io/phase: build
openshift-local.redhat.com/component: binary
annotations:
tekton.dev/pipelines.minVersion: "0.24.x"
tekton.dev/pipelines.minVersion: "0.44.x"
tekton.dev/categories: binary
tekton.dev/tags: openshift-local, binary, linux
tekton.dev/displayName: "openshift local linux binary"
tekton.dev/platforms: "linux/amd64"
tekton.dev/platforms: "linux/amd64, linux/arm64"
spec:
description: >-
This task will build openshift local binary for linux distributions
Expand All @@ -25,16 +25,6 @@ spec:
default: "''"
- name: crc-scm-ref
default: main
- name: custom-bundle-version-variable
description: |
When building an installer based on a custom bundle it is required
to manipulate the Makefile to match the custom version.
Current variables holding bundle version based on bundle type are
* OPENSHIFT_VERSION
* PODMAN_VERSION
default: "''"
- name: custom-bundle-version
default: "''"
- name: s3-url
- name: s3-access-key
- name: s3-secret-key
Expand All @@ -51,7 +41,8 @@ spec:

steps:
- name: build
image: quay.io/rhqp/crc-builder:v0.0.7-linux
# cimage and cversion values should be passed to the template
image: cimage:cversion-linux
imagePullPolicy: Always
script: |
#!/bin/sh
Expand All @@ -69,12 +60,6 @@ spec:
if [[ $(params.crc-scm-ref) != "" ]]; then
CRC_SCM_REF=$(params.crc-scm-ref)
fi
if [[ $(params.custom-bundle-version-variable) != "" ]]; then
CUSTOM_BUNDLE_VERSION_VARIABLE=$(params.custom-bundle-version-variable)
fi
if [[ $(params.custom-bundle-version) != "" ]]; then
CUSTOM_BUNDLE_VERSION=$(params.custom-bundle-version)
fi
if [[ $(params.s3-folder-path) != "" ]]; then
UPLOAD_PATH=$(params.s3-folder-path)
fi
Expand Down