Skip to content

Update runtime ImageStreams SHA digests #32

Update runtime ImageStreams SHA digests

Update runtime ImageStreams SHA digests #32

---
# The aim of this GitHub workflow is to update the runtimes ImageStreams
name: Update runtime ImageStreams SHA digests
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
branch:
required: true
description: "Provide branch name: "
tag:
required: true
description: "Provide tag: main or YYYYx: "
user-hash:
required: false
description: "Provide git-hash: "
env:
DIGEST_UPDATER_BRANCH: runtimes-updater-${{ github.run_id }}
BRANCH_NAME: ${{ github.event.inputs.branch || 'main' }}
TAG: ${{ github.event.inputs.tag || 'main' }}
RELEASE_VERSION_N: 2024b
jobs:
initialize:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Install Skopeo CLI
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install skopeo yq jq
# Checkout the branch
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
# Create a new branch
- name: Create a new branch
run: |
echo ${{ env.DIGEST_UPDATER_BRANCH }}
git checkout -b ${{ env.DIGEST_UPDATER_BRANCH }}
git push --set-upstream origin ${{ env.DIGEST_UPDATER_BRANCH }}
update-runtimes:
needs: [initialize]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ env.DIGEST_UPDATER_BRANCH }}
fetch-depth: 0
- name: Invoke script to handle the runtimes update
shell: bash
run: |
chmod +x "${GITHUB_WORKSPACE}/ci/runtimes-updater.sh"
bash ${GITHUB_WORKSPACE}/ci/runtimes-updater.sh ${{ env.TAG }} ${{ inputs.user_hash }}
- name: Commit the changes
run: |
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
git fetch origin "${{ env.DIGEST_UPDATER_BRANCH }}" && \
git pull origin "${{ env.DIGEST_UPDATER_BRANCH }}" && \
git add . && \
git commit -m "Update file via ${{ env.DIGEST_UPDATER_BRANCH }} GitHub action" && \
git push origin "${{ env.DIGEST_UPDATER_BRANCH }}"
else
echo "There were no changes detected in the images for the ${{ env.BRANCH_NAME }}"
fi
open-pull-request:
needs: [update-runtimes]
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: pull-request
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.DIGEST_UPDATER_BRANCH }}
destination_branch: ${{ env.BRANCH_NAME }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_label: "automated pr"
pr_title: "[Digest Updater Action] Update Runtimes Images"
pr_body: |
:rocket: This is an automated Pull Request.
Created by `/.github/workflows/runtimes-digest-updater-upstream.yaml`
This PR updates all the runtime ImageStream files.
:exclamation: **IMPORTANT NOTE**: Remember to delete the ` ${{ env.DIGEST_UPDATER_BRANCH }}` branch after merging the changes