Skip to content

Commit

Permalink
[gh workflow] Separating variables between build workflow and callers
Browse files Browse the repository at this point in the history
* Passing as input variables in caller workflow
* Removing conditionals from build images
  • Loading branch information
didierofrivia committed Mar 28, 2023
1 parent 2291ff7 commit 511decd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
40 changes: 15 additions & 25 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@ on:
branches: ['*']
tags: ['*']
workflow_call:
inputs:
authorinoOperatorBundleVersion:
description: Authorino Operator bundle version
default: latest
limitadorOperatorBundleVersion:
description: Limitador Operator bundle version
default: latest
wasmShimVersion:
description: WASM Shim version
default: latest
workflow_dispatch:
inputs:
authorinoOperatorBundleVersion:
description: Authorino Operator bundle version
required: true
default: latest
limitadorOperatorBundleVersion:
description: Limitador Operator bundle version
required: true
default: latest
wasmShimVersion:
description: WASM Shim version
required: true
default: latest

env:
Expand Down Expand Up @@ -110,34 +117,17 @@ jobs:
else
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Add SHA tags if triggered by scheduled workflow
if: ${{ github.event_name == "workflow_call" }}
id: set-dependencies-sha-tags
run: |
echo "Setting dependencies image versions from stored variables..."
echo "AUTHORINO_OPERATOR_VERSION=${vars.AUTHORINO_OPERATOR_BUNDLE_SHA}" >> $GITHUB_ENV
echo "LIMITADOR_OPERATOR_VERSION=${vars.LIMITADOR_OPERATOR_BUNDLE_SHA} >> $GITHUB_ENV
echo "WASM_SHIM_VERSION=${vars.WASM_SHIM_SHA} >> $GITHUB_ENV
- name: Add specific tags if triggered by workflow dispatch
if: ${{ github.event_name == "workflow_dispatch" }}
id: set-dependencies-specific-tags
run: |
echo "Setting dependencies image versions from user input..."
echo "AUTHORINO_OPERATOR_VERSION=${github.event.inputs.authorinoOperatorBundleVersion}" >> $GITHUB_ENV
echo "LIMITADOR_OPERATOR_VERSION=${github.event.inputs.limitadorOperatorBundleVersion} >> $GITHUB_ENV
echo "WASM_SHIM_VERSION=${github.event.inputs.wasmShimVersion} >> $GITHUB_ENV
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Run make bundle
run: |
if [[ ${github.event_name} == "workflow_call" || ${github.event_name} == "workflow_dispatch" ]]; then
echo "Building bundle via workflow call"
make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} VERSION=${TAG_NAME/v/} AUTHORINO_OPERATOR_VERSION=${env.AUTHORINO_OPERATOR_VERSION} LIMITADOR_OPERATOR_VERSION=${env.LIMITADOR_OPERATOR_VERSION} WASM_SHIM_VERSION=${env.WASM_SHIM_VERSION}
else
make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} IMAGE_TAG=${{ github.ref_name }}
fi
make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \
VERSION=${TAG_NAME/v/} IMAGE_TAG=${{ github.sha }} \
AUTHORINO_OPERATOR_VERSION=${github.event.inputs.authorinoOperatorBundleVersion} \
LIMITADOR_OPERATOR_VERSION=${github.event.inputs.limitadorOperatorBundleVersion} \
WASM_SHIM_VERSION=${github.event.inputs.wasmShimVersion}
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/scheduled-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ jobs:
workflow-build:
name: Calls build-images workflow
uses: ./.github/workflows/build-images.yaml
with:
authorinoOperatorBundleVersion: ${vars.AUTHORINO_OPERATOR_BUNDLE_SHA}
limitadorOperatorBundleVersion: ${vars.LIMITADOR_OPERATOR_BUNDLE_SHA}
wasmShimVersion: ${vars.WASM_SHIM_SHA}

0 comments on commit 511decd

Please sign in to comment.