Skip to content

Manual Build Dispatch #1500

Manual Build Dispatch

Manual Build Dispatch #1500

name: Manual 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:
manual-build-and-publish-image:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- 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_BASE_IMAGE=noobaa/noobaa-base
DOCKER_BUILDER_IMAGE=noobaa/noobaa-builder
DOCKER_CORE_IMAGE=noobaa/noobaa-core
VERSION="${{ steps.date.outputs.date }}"
echo "::warning ${VERSION}"
BASE_TAGS="${DOCKER_BASE_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}"
BUILDER_TAGS="${DOCKER_BUILDER_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}"
CORE_TAGS="${DOCKER_CORE_IMAGE}:${{ github.event.inputs.branch }}-${VERSION}${{ steps.suffix.outputs.suffix }}"
CORE_OCS_DEV_TAG="ocs-dev/noobaa-core:${{ github.event.inputs.branch }}-latest"
echo "::warning ${CORE_TAGS}"
echo "basetags=${BASE_TAGS}" >> $GITHUB_OUTPUT
echo "buildertags=${BUILDER_TAGS}" >> $GITHUB_OUTPUT
echo "coretags=${CORE_TAGS}" >> $GITHUB_OUTPUT
echo "ocsdevlatest=${CORE_OCS_DEV_TAG}" >> $GITHUB_OUTPUT
- name: Login to DockerHub Registry
run: echo ${{ secrets.GHACTIONSDOCKERHUB }} | docker login -u ${{ secrets.GHACTIONSDOCKERHUBNAME }} --password-stdin
- name: Build & Push Docker Images to DockerHub
env:
DOCKERHUB_OWNER: ${{ secrets.GHACTIONSDOCKERHUBNAME }}
run: |
make noobaa
docker tag noobaa-base ${{ steps.prep.outputs.basetags }}
docker push ${{ steps.prep.outputs.basetags }}
docker tag noobaa-builder ${{ steps.prep.outputs.buildertags }}
docker push ${{ steps.prep.outputs.buildertags }}
docker tag noobaa ${{ steps.prep.outputs.coretags }}
docker push ${{ steps.prep.outputs.coretags }}
- name: Login to Quay 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.coretags }} quay.io/${{ steps.prep.outputs.coretags }}
docker push quay.io/${{ steps.prep.outputs.coretags }}
- 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.coretags }} quay.io/${{ steps.prep.outputs.ocsdevlatest }}
docker push quay.io/${{ steps.prep.outputs.ocsdevlatest }}
- name: Sleep for 180 seconds
run: sleep 180s
shell: bash
- name: Invoke Build on Operator Repo
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Manual Operator Build Dispatch
repo: noobaa/noobaa-operator
token: ${{ secrets.GHACCESSTOKEN }}
inputs: '{ "branch": "${{ github.event.inputs.branch }}", "tag": "${{ github.event.inputs.tag }}" }'