Install OperatorSDK before calling it #13
Workflow file for this run
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
name: 'Build and Publish Bundle' | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+' | |
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | |
env: | |
CONTROLLER_IMAGE_NAME: simple-demo-operator | |
BUNDLE_IMAGE_NAME: simple-demo-operator-bundle | |
OPERATOR_SDK_VERSION: 1.32.0 | |
jobs: | |
tag-controller-for-release: | |
runs-on: ubuntu-latest | |
outputs: | |
vprefixed-release-tag: ${{ steps.set-env-tags.outputs.VPREFIXED_RELEASE_TAG }} | |
release-tag: ${{ steps.set-env-tags.outputs.RELEASE_TAG }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set Env Tags | |
id: set-env-tags | |
run: | | |
echo VPREFIXED_RELEASE_TAG=$(echo $GITHUB_REF | cut -d '/' -f 3) >> $GITHUB_ENV | |
echo RELEASE_TAG=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -e 's/^v//g') >> $GITHUB_ENV | |
- name: Log in to Quay.io | |
uses: redhat-actions/podman-login@v1 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
registry: quay.io | |
# The controller should already exists at a tag matching the commit hash. | |
# Apply the release tag to this controller. | |
- name: Apply a release tag to existing controller image. | |
run: | | |
skopeo copy --all docker://quay.io/${{ secrets.IMAGE_REPOSITORY }}/${{ env.CONTROLLER_IMAGE_NAME }}:${{ github.sha }} docker://quay.io/${{ secrets.IMAGE_REPOSITORY }}/${{ env.CONTROLLER_IMAGE_NAME }}:${{ env.RELEASE_TAG }} | |
pin-images-and-bundle: | |
needs: [tag-controller-for-release] | |
runs-on: ubuntu-latest | |
env: | |
VPREFIXED_RELEASE_TAG: ${{ needs.tag-controller-for-release.outputs.vprefixed-release-tag }} | |
RELEASE_TAG: ${{ needs.tag-controller-for-release.outputs.release-tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- name: Log in to Quay.io | |
uses: redhat-actions/podman-login@v1 | |
with: | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
registry: quay.io | |
- name: Install OperatorSDK | |
run: go install github.com/operator-framework/operator-sdk@${{ env.OPERATOR_SDK_VERSION }} | |
- name: Regenerate bundle with pinned images | |
run: USE_IMAGE_DIGESTS=true make bundle | |
- name: Ensure bundle validates after CI modifications | |
run: | | |
operator-sdk bundle validate ./bundle | |
- name: Build bundle image | |
id: build-bundle-images | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.BUNDLE_IMAGE_NAME }} | |
tags: ${{ env.VPREFIXED_RELEASE_TAG }} # Note: "vX.Y.Z" prefixed | |
containerfiles: | | |
./bundle.Dockerfile | |
- name: Push to target push registry. | |
id: push-bundle-img-to-registry | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ env.BUNDLE_IMAGE_NAME }} | |
tags: ${{ env.VPREFIXED_RELEASE_TAG }} # Note: "vX.Y.Z" prefixed! | |
registry: quay.io/${{ secrets.IMAGE_REPOSITORY }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} |