Skip to content

add dependabot checks for go modules #260

add dependabot checks for go modules

add dependabot checks for go modules #260

Workflow file for this run

name: Build operator
on:
release:
types: [published]
push:
branches:
- main
workflow_dispatch:
pull_request:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
OPERATOR_OCP_VERSION: "4.13.0"
OPERATOR_SDK_VERSION: "v1.28.0"
SUPPORTED_OCP_VERSIONS: "v4.12-v4.14"
jobs:
build-operator:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Set release version
if: ${{ github.event_name == 'release' }}
run: |
tag=${{ github.ref_name }}
echo "VERSION=${tag:1}" >> $GITHUB_ENV
echo "CHANNELS=stable" >> $GITHUB_ENV
echo "DEFAULT_CHANNEL=stable" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup registry access
run: echo "$PULL_SECRET" > ~/.docker/config.json
env:
PULL_SECRET: ${{ secrets.PULL_SECRET }}
- name: Log in to Quay.io
uses: docker/login-action@v2
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- name: install yq
run: |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq
chmod +x /usr/local/bin/yq
- name: install operator-sdk
run: |
export OPERATOR_SDK_DL_URL=https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/operator-sdk/${{ env.OPERATOR_OCP_VERSION }}/operator-sdk-${{ env.OPERATOR_SDK_VERSION }}-ocp-linux-x86_64.tar.gz
curl -L ${OPERATOR_SDK_DL_URL} | tar -xz --strip-components=2 -C /usr/local/bin ./x86_64/operator-sdk
- name: Build operator
if: ${{ github.event_name == 'pull_request' }}
run: |
make docker-build
- name: Push operator
if: ${{ github.event_name != 'pull_request' }}
run: |
make docker-buildx PLATFORMS=linux/arm64,linux/amd64
- name: Generate operator bundle
run: |
make bundle USE_IMAGE_DIGESTS=true
echo -e "\n # Annotations for catalog\n com.redhat.openshift.versions: \"${{ env.SUPPORTED_OCP_VERSIONS }}\"" >> bundle/metadata/annotations.yaml
echo -e "\n# Labels for catalog\nLABEL com.redhat.openshift.versions=\"${{ env.SUPPORTED_OCP_VERSIONS }}\"" >> bundle.Dockerfile
export CONTAINER_IMAGE=$(cat bundle/manifests/cluster-relocation-operator.clusterserviceversion.yaml | yq '.spec.relatedImages | map(select(.name == "manager")) | .[0].image')
yq -i e ".metadata.annotations.containerImage = \"${CONTAINER_IMAGE}\"" bundle/manifests/cluster-relocation-operator.clusterserviceversion.yaml
- name: Build operator bundle
run: |
make bundle-build
- name: Validate bundle
run: |
operator-sdk bundle validate ./bundle --select-optional suite=operatorframework
- name: push bundle
if: ${{ github.event_name != 'pull_request' }}
run: |
make bundle-push
- name: build catalog
run: |
make catalog-build
- name: push catalog
if: ${{ github.event_name != 'pull_request' }}
run: |
make catalog-push
- name: Save bundle
uses: actions/upload-artifact@v3
with:
name: bundle
path: bundle/