Skip to content

Build and push move2kube Knative function container image #106

Build and push move2kube Knative function container image

Build and push move2kube Knative function container image #106

Workflow file for this run

name: Build and push move2kube Knative function container image
on:
workflow_call:
inputs:
it_mode:
required: false
type: boolean
default: false
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- 'move2kube/m2k-func/**'
- 'pipeline/**'
- .github/workflows/m2k-func.yaml
env:
WORKDIR: move2kube/m2k-func
MVN_OPTS: ""
WF_CONFIG_REPO: parodos-dev/serverless-workflows-config
REGISTRY_REPO: orchestrator
GH_TOKEN: ${{ secrets.HELM_REPO_TOKEN }}
jobs:
build-and-push-m2k-func:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
context: ${{ env.WORKDIR }}
image: serverless-workflow-m2k-kfunc
tags: latest ${{ github.sha }}
extra-args: --ulimit nofile=4096:4096
containerfiles: |
${{ env.WORKDIR }}/src/main/docker/Dockerfile.jvm
- name: Buildah push to OCI Arcive
if: ${{ inputs.it_mode }}
run: |
buildah push serverless-workflow-m2k-kfunc:${{ github.sha }} \
oci-archive:serverless-workflow-m2k-kfunc-${{ github.sha }}.tar:kind.local/orchestrator/serverless-workflow-m2k-kfunc:${{ github.sha }}
- name: Save OCI archive
if: ${{ inputs.it_mode }}
uses: actions/upload-artifact@v4
with:
name: serverless-workflow-m2k-kfunc-${{ github.sha }}.tar
path: serverless-workflow-m2k-kfunc-${{ github.sha }}.tar
- name: Push To quay.io
if: ${{ ! inputs.it_mode }}
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/orchestrator
username: ${{ secrets.NEW_QUAY_USERNAME }}
password: ${{ secrets.NEW_QUAY_PASSWORD }}
- name: Print image url
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
- uses: actions/github-script@v7
id: get_pr_data
with:
script: |
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0];
- name: Send PRs to config repo
if: ${{ ! inputs.it_mode }}
run: |
# determine pr or commit url
if [ ${{ fromJSON(steps.get_pr_data.outputs.result)}} != "" ]; then
PR_OR_COMMIT_URL="${{ fromJSON(steps.get_pr_data.outputs.result).html_url }}"
else
PR_OR_COMMIT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
fi
git config --global user.email "${{ github.event.head_commit.author.email || '[email protected]' }}"
git config --global user.name ${{ github.event.head_commit.author.name || github.triggering_actor }}
gh repo clone $WF_CONFIG_REPO config-repo
cd config-repo
git switch -c m2k-kfunc-autopr-$RANDOM
./hack/bump_chart_version.sh move2kube --bump-tag-version
yq --inplace '.kfunction.image="quay.io/orchestrator/serverless-workflow-m2k-kfunc:${{ github.sha }}"' charts/move2kube/values.yaml
cd ..
sh scripts/create_or_update_automated_pr.sh $WF_CONFIG_REPO \
${{ inputs.workflow_id }} \
${PR_OR_COMMIT_URL} \
config-repo/charts/move2kube/values.yaml \
scripts/create_automated_m2k_kfunc_pr.sh \
${{ github.event.head_commit.author.email || '[email protected]' }} \
${{ github.event.head_commit.author.name || github.triggering_actor }} \
$WORKDIR \
${{ env.GH_TOKEN }} \
$WF_CONFIG_REPO