Skip to content

.github/workflows/prep-release.yml #3

.github/workflows/prep-release.yml

.github/workflows/prep-release.yml #3

Workflow file for this run

on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag'
required: true
default: '1.0.1-dev'
prep_internal_release:
# Need to distinguish between internal and external releases
# Internal release: Will use default internal location for created images (ghcr.io) and will tag and push operator candidate there
# External release: Assumes tagged image operator already pushed to docker.io/solace.
# The purpose of running this script is to update final release tags and getting ready for PR to Operator Hub
type: boolean
description: 'Internal release (Check to prep an internal release including image push. Uncheck to prep an external release)'
required: true
default: true
jobs:
build_web:
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup tools
run: |
# Operator SDK
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.27.0
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
chmod +x operator-sdk_${OS}_${ARCH} && sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
- name: Update code
run: |
make generate manifests
make fmt
- name: Get params ref generator and update params ref doc
run: |
# crdoc
pushd /tmp
curl -s https://api.github.com/repos/fybrik/crdoc/releases/latest | grep -wo "https://.*crdoc.*Linux_x86.*gz" | wget -i -
tar -xvf crdoc*.gz
popd
/tmp/crdoc --resources config/crd/bases/pubsubplus.solace.com_pubsubpluseventbrokers.yaml --output docs/EventBrokerOperatorParametersReference.md --template config/crdoc/markdown.tmpl
- name: Generate Third Party License
run: |
make generate-license
- name: Build bundle - will use the generated license file
run: |
export VERSION='${{ github.event.inputs.release_tag }}'
if [ "${{ github.event.inputs.prep_internal_release }}" == "true" ] ; then
echo Internal release
echo "CONTROLLER_CONTAINER_REPO=ghcr.io/solacedev" >> $GITHUB_ENV
make docker-build docker-push
else
echo External release
export CONTROLLER_CONTAINER_REPO=docker.io/solace
echo "CONTROLLER_CONTAINER_REPO=$CONTROLLER_CONTAINER_REPO" >> $GITHUB_ENV
make docker-build
# skip docker-push
fi
make create-deploy-yaml
make bundle
- name: Prep for testing - create K8s Kind Cluster
uses: helm/[email protected]
- name: Test operator image using preflight tool
run: |
pushd /tmp
curl -s https://api.github.com/repos/redhat-openshift-ecosystem/openshift-preflight/releases/latest | grep -wo "https://.*preflight-linux-amd64" | wget -i -
chmod +x preflight-linux-amd64
popd
export CONTAINER_TO_TEST="$CONTROLLER_CONTAINER_REPO/pubsubplus-eventbroker-operator:v${{ github.event.inputs.release_tag }}"
/tmp/preflight-linux-amd64 check container $CONTAINER_TO_TEST --docker-config ~/.docker/config.json | grep "Preflight result: PASSED" || echo
- name: Test operator bundle - validate and scorecard
run: |
operator-sdk bundle validate ./bundle --select-optional suite=operatorframework
operator-sdk bundle validate ./bundle --select-optional name=operatorhub
operator-sdk bundle validate ./bundle --select-optional name=good-practices
operator-sdk scorecard ./bundle --kubeconfig ~/.kube/config
- name: Build and publish Operator bundle and catalog
run: |
export VERSION='${{ github.event.inputs.release_tag }}'
make bundle-build bundle-push
make catalog-build catalog-push
# tag each as latest
PUSHED_IMAGES=`docker images | grep $VERSION`
BUNDLE=`echo "$PUSHED_IMAGES" | grep bundle` ; echo "$BUNDLE" # Format: Imagepath Tag Sha
docker tag `echo $BUNDLE | awk '{print $3}'` `echo $BUNDLE | awk '{print $1}'`:latest
docker push `echo $BUNDLE | awk '{print $1}'`:latest
CATALOG=`echo "$PUSHED_IMAGES" | grep catalog` ; echo "$CATALOG" # Format: Imagepath Tag Sha
docker tag `echo $CATALOG | awk '{print $3}'` `echo $CATALOG | awk '{print $1}'`:latest
docker push `echo $CATALOG | awk '{print $1}'`:latest
- name: Run Whitesource Action
uses: mercari/[email protected]
with:
wssURL: https://saas.whitesourcesoftware.com/agent
apiKey: ${{ secrets.WSS_API_KEY }}
productName: 'pubsubplus-kubernetes-operator'
projectName: 'pubsubplus-kubernetes-operator'
configFile: 'ci/whitesource/whitesource-agent.config'
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
committer_name: GitHub Actions
committer_email: [email protected]
message: 'Prepared deploy yaml, bundle with latest relase info and updated params doc and licenses [skip ci]'
add: 'deploy/*.yaml bundle/manifests/*.yaml docs/EventBrokerOperatorParametersReference.md THIRD-PARTY-LICENSES.md'
new_branch: 'ReleaseCandidate-${{ github.event.inputs.release_tag }}'
- name: Create pull request
run: |
CURRENT_BRANCH=${GITHUB_REF##*/}
gh pr create -B ${CURRENT_BRANCH} -H 'ReleaseCandidate-${{ github.event.inputs.release_tag }}' --title "Merge release prep updates into ${CURRENT_BRANCH}" --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}