Update FaaS Images #62
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: Update FaaS Images | |
on: | |
workflow_dispatch: | |
inputs: | |
node_v4: | |
description: 'Update Node v4 (true/false)' | |
required: true | |
default: 'false' | |
node_v5: | |
description: 'Update Node v5 (true/false)' | |
required: true | |
default: 'false' | |
rego_v5: | |
description: 'Update Rego v5 (true/false)' | |
required: true | |
default: 'false' | |
tag: | |
description: 'Image Tag' | |
required: true | |
jobs: | |
update-faas-images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CLOUDENTITY_CI_TOKEN }} | |
- name: Set Environment Variables | |
run: | | |
echo "NODE_V4=${{ github.event.inputs.node_v4 }}" >> $GITHUB_ENV | |
echo "NODE_V5=${{ github.event.inputs.node_v5 }}" >> $GITHUB_ENV | |
echo "REGO_V5=${{ github.event.inputs.rego_v5 }}" >> $GITHUB_ENV | |
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
- name: Docker Registry Login | |
run: echo "${{ secrets.PUBLIC_DOCKER_CLOUDENTITY_REPO_DEV_PASSWORD }}" | docker login docker.cloudentity.io -u "${{ secrets.PUBLIC_DOCKER_CLOUDENTITY_REPO_DEV_USERNAME }}" --password-stdin | |
- name: Update Helm Values File | |
shell: bash | |
run: | | |
environments=("NODE_V4" "NODE_V5" "REGO_V5") | |
for env in "${environments[@]}"; do | |
update=$(eval echo "\$$env") | |
if [ "$update" = "true" ]; then | |
version=${env##*_} | |
component=${env%%_*} | |
image=docker.cloudentity.io/${component,,}-env:${version,,}-$TAG | |
yq ".faas.environments.${component,,}.${version,,}.image = \"${image}\"" charts/acp/values.yaml > values.updated | |
yq "." charts/acp/values.yaml | diff -B - values.updated | patch charts/acp/values.yaml - || true | |
rm -f values.updated charts/acp/values.yaml.orig | |
if [ "$component" = "NODE" ]; then | |
docker run ${image} cat package.json | yq --prettyPrint --output-format yaml '(pick(["engines", "dependencies"]))' > charts/acp/files/${component,,}-${version,,}-package.yaml | |
fi | |
fi | |
done | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.CLOUDENTITY_CI_TOKEN }} | |
branch: "feature/update-faas-images" | |
delete-branch: true | |
title: "Update FaaS images" | |
commit-message: "Update FaaS images" | |
body-path: .github/HELM_VALUE_UPDATE_PULL_REQUEST_TEMPLATE.md | |
labels: "auto-upgrade" | |
team-reviewers: cloudentity/devops |