Skip to content

Commit 2085df7

Browse files
authored
Updates Notebooks and Runtimes CIs GHA updaters (#959)
* This updates the several CIs where utilized by GHAs for updating the digest SHAs for runtimes and notebook images * Update runtimes-digest-updater-upstream.yaml * Final tweaks * Add exit 1 and apply changes for selecting branches currently only on runtimes updater odl stracture
1 parent f9d5413 commit 2085df7

8 files changed

+493
-463
lines changed

.github/workflows/notebooks-digest-updater-upstream.yaml

Lines changed: 0 additions & 236 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
# The aim of this GitHub workflow is to update the params.env and commit.env files
3+
# This GHA works for both orgs and it checks for the tags generated from the main branch.
4+
name: Update Notebook Images and Commits With New SHAs
5+
on: # yamllint disable-line rule:truthy
6+
workflow_dispatch:
7+
inputs:
8+
branch:
9+
required: false
10+
description: "Optional: Provide branch name"
11+
user-hash:
12+
required: false
13+
description: "Optional: Specify a Git hash (it should exists on the branch history)"
14+
15+
env:
16+
USER_HASH: ${{ github.event.inputs.user-hash }}
17+
REPO_ORG: ${{ github.repository_owner }}
18+
REPO_NAME: 'notebooks'
19+
TMP_BRANCH: tmp-digest-sync-${{ github.run_id }}
20+
BRANCH_NAME: ${{ github.event.inputs.branch || 'main' }}
21+
22+
jobs:
23+
update-images:
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
pull-requests: write
28+
steps:
29+
- name: Install Skopeo CLI
30+
shell: bash
31+
run: |
32+
sudo apt-get -y update
33+
sudo apt-get -y install skopeo
34+
35+
- name: Configure Git
36+
run: |
37+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
38+
git config --global user.name "GitHub Actions"
39+
40+
- name: Checkout branch
41+
uses: actions/checkout@v4
42+
with:
43+
ref: ${{ env.BRANCH_NAME }}
44+
45+
- name: Create a new branch
46+
run: |
47+
echo ${{ env.TMP_BRANCH }}
48+
git checkout -b ${{ env.TMP_BRANCH }}
49+
git push --set-upstream origin ${{ env.TMP_BRANCH }}
50+
51+
- name: Checkout release branch
52+
uses: actions/checkout@v4
53+
with:
54+
ref: ${{ env.TMP_BRANCH }}
55+
fetch-depth: 0
56+
57+
- name: Invoke script to handle the updates
58+
shell: bash
59+
run: |
60+
bash "${GITHUB_WORKSPACE}/ci/notebooks-digest-updater.sh" "${{ env.USER_HASH }}" "${{ env.REPO_ORG }}" "${{ env.BRANCH_NAME }}" "${{ env.REPO_NAME }}"
61+
62+
- name: Commit Changes
63+
run: |
64+
65+
if [[ $(git status --porcelain | wc -l) -gt 0 ]]; then
66+
git fetch origin ${{ env.TMP_BRANCH }} && \
67+
git pull origin ${{ env.TMP_BRANCH }} && \
68+
git add "${GITHUB_WORKSPACE}/manifests/base/params.env" && \
69+
git commit -m "Update images digest hashes via ${{ env.TMP_BRANCH }} GitHub action" && \
70+
git add ""${GITHUB_WORKSPACE}/manifests/base/commit.env"" && \
71+
git commit -m "Update image commits via ${{ env.TMP_BRANCH }} GitHub action" &&\
72+
git push origin ${{ env.TMP_BRANCH }}
73+
else
74+
echo "There were no changes detected in the images for the ${{ env.BRANCH_NAME }}"
75+
fi
76+
77+
- name: pull-request
78+
run: |
79+
gh pr create --repo https://github.com/$REPO_ORG/$REPO_NAME.git \
80+
--title "$pr_title" \
81+
--body "$pr_body" \
82+
--head $REPO_ORG:${{ env.TMP_BRANCH }} \
83+
--base ${{ env.BRANCH_NAME }}
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
pr_title: "[Notebooks Updater Action] Update Notebook Images and commit with new SHAs"
87+
pr_body: |
88+
:rocket: This is an automated Pull Request.
89+
Created by `/.github/workflows/notebooks-digest-updater.yaml`
90+
91+
This PR updates the following files:
92+
- `manifests/base/params.env` file with the latest updated SHA digests of the notebooks.
93+
- `manifests/base/commit.env` file with the latest commit.
94+
95+
:exclamation: **IMPORTANT NOTE**: Remember to delete the `${{ env.TMP_BRANCH }}` branch after merging the changes

0 commit comments

Comments
 (0)