fix(deps): update dependency org.apache.commons:commons-compress to v… #86
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: 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: | | |
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-patch-version | |
yq --inplace '.kfunction.image="quay.io/orchestrator/serverless-workflow-m2k-kfunc:${{ github.sha }}"' charts/move2kube/values.yaml | |
git add -A | |
# 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 commit -m "(m2k-kfunc) Automated PR for m2k-kfunc" | |
echo "Automated PR from $PR_OR_COMMIT_URL" | git commit --amend --file=- | |
git remote set-url origin https://${{ env.GH_TOKEN }}@github.com/$WF_CONFIG_REPO | |
git push origin HEAD | |
gh pr create -f --title "m2k-kfunc: Automatic m2k-kfunc image tag bump" \ | |
--body " | |
Updating generated image tag for m2k-kfunc application | |
This PR was created automatically as a result of merging $PR_OR_COMMIT_URL | |
" |