Skip to content

add new github action which tags and builds a new operator #110

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

Merged
Merged
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
7 changes: 0 additions & 7 deletions .github/workflows/operator-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ jobs:
password: ${{ secrets.QUAY_TOKEN }}
registry: quay.io

- name: Login to Red Hat Registry
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.RH_REG_ID }}
password: ${{ secrets.RH_REG_TOKEN }}
registry: registry.redhat.io

- name: Image Build
run: |
make build
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/tag-and-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow will build the CodeFlare Operator image and push it to the project-codeflare image registry

name: Tag and Release
on:
workflow_dispatch:
inputs:
version:
description: 'Tag to be used for operator image'
required: true
default: '0.0.0-dev'
replaces:
description: 'The previous semantic version that this tag replaces.'
required: true
default: '0.0.0-dev'

jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Activate cache
uses: actions/cache@v2
with:
path: /cache
key: ${{ runner.os }}-cache-${{ hashFiles('**/go.sum', '.pre-commit-config.yaml') }}

- name: Create tag
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.version }}',
sha: context.sha
})

- name: Install operator-sdk
run: make install-operator-sdk

- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ secrets.QUAY_ID }}
password: ${{ secrets.QUAY_TOKEN }}
registry: quay.io

- name: Image Build
run: |
make build
make bundle
make image-build -e IMG=quay.io/project-codeflare/codeflare-operator:${SOURCE_TAG}
podman tag quay.io/project-codeflare/codeflare-operator:${SOURCE_TAG} quay.io/project-codeflare/codeflare-operator:latest
env:
SOURCE_TAG: ${{ github.event.inputs.version }}

- name: Image Push
run: |
make image-push -e IMG=quay.io/project-codeflare/codeflare-operator:${SOURCE_TAG}
make image-push -e IMG=quay.io/project-codeflare/codeflare-operator:latest
env:
SOURCE_TAG: ${{ github.event.inputs.version }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM registry.redhat.io/ubi8/go-toolset:1.18.9-8 as builder
FROM registry.access.redhat.com/ubi8/go-toolset:1.18.9-8 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.0.2
# best if we could detect this. If we cannot, we need to document it somewhere.
# then we can add a patch in the `PHONY: bundle`

PREVIOUS_VERSION ?= 0.0.3
VERSION ?= 0.0.3-dev

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -193,6 +197,7 @@ bundle: manifests kustomize install-operator-sdk ## Generate bundle manifests an
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/metadata/annotations/containerImage", "value": "$(IMG)" }]' --kind ClusterServiceVersion
cd config/manifests && $(KUSTOMIZE) edit add patch --patch '[{"op":"add", "path":"/spec/replaces", "value": "codeflare-operator.v$(PREVIOUS_VERSION)" }]' --kind ClusterServiceVersion
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
$(MAKE) validate-bundle

Expand Down