Manual Operator Build Dispatch #1405
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: Manual Operator Build Dispatch | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Branch to Build From" | |
required: true | |
tag: | |
description: "Additional tag for the build (such as alpha, beta, etc.) - Optional" | |
default: "" | |
jobs: | |
publish-image: | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
- name: Get Current Date | |
id: date | |
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Prepare Suffix | |
id: suffix | |
if: ${{ github.event.inputs.tag != '' }} | |
run: echo suffix="-${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
- name: Prepare Tags | |
id: prep | |
run: | | |
DOCKER_OPERATOR_IMAGE=noobaa/noobaa-operator | |
DOCKER_OPERATOR_BUNDLE_IMAGE=noobaa/noobaa-operator-bundle | |
VERSION="${{ steps.date.outputs.date }}" | |
echo "::warning ${VERSION}" | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
OPERATOR_TAGS="${DOCKER_OPERATOR_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}" | |
OPERATOR_BUNDLE_TAGS="${DOCKER_OPERATOR_BUNDLE_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}" | |
OPERATOR_OCS_DEV_TAG="ocs-dev/noobaa-operator:${{ github.event.inputs.branch }}-latest" | |
echo "::warning ${CORE_TAGS}" | |
echo "operatortags=${OPERATOR_TAGS}" >> $GITHUB_OUTPUT | |
echo "operatorbundletags=${OPERATOR_BUNDLE_TAGS}" >> $GITHUB_OUTPUT | |
echo "ocsdevlatest=${OPERATOR_OCS_DEV_TAG}" >> $GITHUB_OUTPUT | |
- name: Update Core Release | |
id: update-release | |
run: | | |
sudo docker manifest inspect noobaa/noobaa-core:${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} > /dev/null || exit 1 | |
echo "::found version ${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}, updating image version" | |
- name: Login to DockerHub Registry | |
run: echo ${{ secrets.GHACTIONSDOCKERHUB }} | docker login -u ${{ secrets.GHACTIONSDOCKERHUBNAME }} --password-stdin | |
- name: Update Core Release Image | |
id: update-release-image | |
run: | | |
# docker pull "noobaa/noobaa-core:${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}" | |
echo "::found version ${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}, updating image version in options.go" | |
# Update local files | |
sed -i 's:ContainerImageTag =.*:ContainerImageTag = "${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}":' pkg/options/options.go | |
# Commit Changes | |
# git config --local user.email "[email protected]" | |
# git config --local user.name "GitHub Action" | |
# git commit -m "Auto update core image" -a | |
- name: Build & Push Docker Image to DockerHub | |
env: | |
DOCKERHUB_OWNER: ${{ secrets.GHACTIONSDOCKERHUBNAME }} | |
run: | | |
make image VERSION=latest | |
docker tag noobaa/noobaa-operator ${{ steps.prep.outputs.operatortags }} | |
docker push ${{ steps.prep.outputs.operatortags }} | |
- name: Build Bundle | |
run: | | |
make bundle-image \ | |
csv-name=noobaa-operator.clusterserviceversion.yaml \ | |
core-image=quay.io/${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} \ | |
operator-image=quay.io/${{ steps.prep.outputs.operatortags }} \ | |
db-image=centos/postgresql-15-centos7 \ | |
psql-12-image=centos/postgresql-12-centos7 \ | |
obc-crd="owned" \ | |
BUNDLE_IMAGE=quay.io/${{ steps.prep.outputs.operatorbundletags }} | |
- name: Login to Quay.io Registry | |
run: echo ${{ secrets.GHACTIONQUAYTOKEN }} | docker login quay.io -u ${{ secrets.GHACTIONQUAYNAME }} --password-stdin | |
- name: Push Docker Images to Quay | |
env: | |
DOCKERHUB_OWNER: ${{ secrets.GHACTIONQUAYNAME }} | |
run: | | |
docker tag ${{ steps.prep.outputs.operatortags }} quay.io/${{ steps.prep.outputs.operatortags }} | |
docker push quay.io/${{ steps.prep.outputs.operatortags }} | |
docker push quay.io/${{ steps.prep.outputs.operatorbundletags }} | |
- name: Push to ocs-dev as latest | |
env: | |
DOCKERHUB_OWNER: ${{ secrets.GHACTIONQUAYNAME }} | |
run: | | |
docker login -u="${{ secrets.OCSDEVCIUSER }}" -p="${{ secrets.OCSDEVCITOKEN }}" quay.io | |
docker tag ${{ steps.prep.outputs.operatortags }} quay.io/${{ steps.prep.outputs.ocsdevlatest }} | |
docker push quay.io/${{ steps.prep.outputs.ocsdevlatest }} | |
- name: Push CLI Binary | |
run: | | |
make cli | |
make release-cli VERSION=-${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} | |
#noobaa-operator-cli | |
s3AccessKey="${{ secrets.AWSACCESSKEY }}" | |
s3SecretKey="${{ secrets.AWSSECRETKEY }}" | |
s3Bucket="noobaa-operator-cli" | |
region="us-east-2" | |
fileName="noobaa-linux-${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }}" | |
cp build-releases/noobaa-linux-v-${{ github.event.inputs.branch }}-${{ steps.prep.outputs.version }}${{ steps.suffix.outputs.suffix }} ${fileName} | |
.travis/upload-s3-object-using-curl.sh ${s3AccessKey} ${s3SecretKey} ${s3Bucket}@${region} ${fileName} ${fileName} |