Skip to content

Commit 6614bc6

Browse files
committed
Create various files to automate the release of notebooks with the github action call: Notebooks Release 858b1b8
author Moryan Tchoumi Noukoua <[email protected]> 1749048832 -0400 committer mtchoum1 <[email protected]> 1749229860 -0400 Created a github action that waits for a pull request than creates a release Change notebook release to create a simulated pull request Change it so SOURCH_BRanch is recongized removed {{ }} as they we not needed Update the pr body and title and add merge portion to th egithub action Fix some inconsistent with namings skips reduncant step Removed the merged section of the job add pull request portion of github action Change order of varibles to hopeful get pull request to activate hard place some varibles Trying to get more infomation in release trying when using new tag Add target parameter for release create change .head.ref to .base.ref trying to use enviroment varibles within two different jobs remove the need requirment Testing what happends if i use echo to create a file add .txt check the last tag need ot add json for command to work Add full command change repo parameters Using artifacts to maintain tag and name Best working up to date version Testing small change echo some varibles Instead of using pull_request on i wait till the pull request is merged add runs-on in create-release add more varibles need add the missing --repo Made all NUMBERS to NUMBER Started adding buildconfigs add Verify downstream BuildConfigs in final steps Imporve varibles names Improved code so it check every second instead of every 10 mins add missing semicolon fix sleep missing operan Test 2 Captilized M add more sleep Checking to make sure everything works with original number of jobs Fix the issue all varible names were now swaped Using sed to change a file adding the right file change file throughout the entire file adding tab to ref when adding the line to the file testing the right amount of tabs to add (1) testing the right amount of tabs to add (2) testing the right amount of tabs to add (3) seeing if varibles work testing trying without using tab Made buildconfigs its on action for testing added name add correct identation removed depencies trying to use echo to create the right idention using the literal tab button testing get the line to output correctly using backslashes to get it in the right place trying \n Using tr command to add tab to sed command using echo and tr to get the tab testing changhe form '' to "" chnage it so it wasn't a testing testing testing add multiple zzz testing took out the import string trying it without s// add i.bak add s/ / testing trying this trying gsed instead of sed testing creating a varibles used {} to use a variable in a string testing trying to get a tab trying trying a new method to change the value need to make it >> to append using wildcrads to get the right line added tab and made it a else statment so it not printed twice finding how many tab are need (1) finding how many tab are need (0) trying to add one automatically add "" for string just line testing trying to add one just need to postion the addition then we done trying to get it to the right place 5 spaces testing add changing cuda-rstudio-buildconfig.yaml add the changes to a pull request fix error fix error configured git Change the name of file and added a clean up after Change it so the action waits to be called change so it can be call and ran on its own create a tmp branhc with a random number notebook release runs all change use to uses add @notebooks-release-branch remove version made it so there not the smae name made vrify have a call use main version remove version Made sure ther env for all inputs removed env properly sent varible added type making buildconfig optional Renamed verify-buildconfig to update-buildconfig Updated the names of the jobs so they make more sense made sure the name change is the same throughout the file Made sure all varibles are the smae Add Comments and improve the pull request created by update-buildconfigs Change the pr body so it was more descriptive Update update-buildconfigs.yaml Allow you to insert version for buildconfig Remove comments FIx yaml format version is now *.* made build config optional Made it so you can pick a version and buildconfig is optional made it so I can do muiltple runs remove th random numbers at the end of test branch add run_id to the end of test testing to see if branch gets sent correctly make branch and version required when called got it so the varibles actually go to the update-build-configs working with the varibles trying a another method for sending varibles change to env. takes it form input instead have to removed the run_id at the end using inputs.version add n/a as default check if the optional version is empty fixed the sending of varibles to update-buildconfigs Completed the automation of notebook releases
1 parent 858b1b8 commit 6614bc6

File tree

3 files changed

+393
-2
lines changed

3 files changed

+393
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,28 @@ on: # yamllint disable-line rule:truthy
88
branch:
99
required: false
1010
description: "Optional: Provide branch name"
11+
type: string
1112
user-hash:
1213
required: false
1314
description: "Optional: Specify a Git hash (it should exists on the branch history)"
15+
type: string
16+
workflow_call:
17+
inputs:
18+
branch:
19+
required: false
20+
description: "Optional: Provide branch name"
21+
type: string
22+
user-hash:
23+
required: false
24+
description: "Optional: Specify a Git hash (it should exists on the branch history)"
25+
type: string
1426

1527
env:
16-
USER_HASH: ${{ github.event.inputs.user-hash }}
28+
USER_HASH: ${{ inputs.user-hash }}
1729
REPO_ORG: ${{ github.repository_owner }}
1830
REPO_NAME: 'notebooks'
1931
TMP_BRANCH: tmp-digest-sync-${{ github.run_id }}
20-
BRANCH_NAME: ${{ github.event.inputs.branch || 'main' }}
32+
BRANCH_NAME: ${{ inputs.branch || 'main' }}
2133

2234
jobs:
2335
update-images:
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
---
2+
name: Notebooks Release
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Release tag for the notebooks release'
8+
required: true
9+
default: 'v1.32.0'
10+
type: string
11+
release_name:
12+
description: 'Name of the release'
13+
required: true
14+
default: '2025a'
15+
type: string
16+
buildconfigs_version:
17+
description: 'Version to update the BuildConfigs to (if applicable)'
18+
required: false
19+
type: string
20+
update_buildconfigs:
21+
description: 'Update BuildConfigs for CUDA RStudio and RStudio'
22+
required: true
23+
default: 'true'
24+
type: boolean
25+
branch:
26+
description: "Optional: Provide branch name"
27+
required: false
28+
type: string
29+
user-hash:
30+
description: "Optional: Specify a Git hash (it should exists on the branch history)"
31+
required: false
32+
type: string
33+
34+
env:
35+
RELEASE_TAG: ${{ github.event.inputs.tag }}
36+
RELEASE_NAME: ${{ github.event.inputs.release_name }}
37+
BRANCH: ${{ github.event.inputs.branch }}
38+
USER_HASH: ${{ github.event.inputs.user-hash }}
39+
REPO_OWNER: opendatahub-io
40+
REPO_NAME: notebooks
41+
VERSION: ${{ github.event.inputs.buildconfigs_version}}
42+
43+
jobs:
44+
#1. Update the params.env and commit.env files with new SHAs
45+
Update-manifests:
46+
uses: opendatahub-io/notebooks/.github/workflows/notebooks-digest-updater.yaml@main
47+
with:
48+
branch: ${{ github.event.inputs.branch }}
49+
user-hash: ${{ github.event.inputs.user_hash }}
50+
51+
# 2. Check if the Manifest PR is merged
52+
Manifests-merged:
53+
needs: Update-manifests
54+
runs-on: ubuntu-latest
55+
outputs:
56+
pr_merged_m: ${{ steps.check_pr.outputs.pr_merged_m }}
57+
steps:
58+
- name: Check out repository
59+
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Check if PR is merged
64+
id: check_pr
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
run: |
68+
# PR to look for
69+
PR_TITLE="[Updater Action] Update Notebook and Runtime Images as well as the Commits With New SHAs"
70+
71+
#Fetch matching PRs
72+
PR_NUMBER=$(gh pr list --repo "$REPO_OWNER/$REPO_NAME" --state all --search "$PR_TITLE" --json number,title | jq -r '.[0].number')
73+
echo "PR Numbers: $PR_NUMBER"
74+
75+
if [ -z "$PR_NUMBER" ]; then
76+
echo "No PR found with title: $PR_TITLE"
77+
exit 1
78+
fi
79+
80+
MAX_ATTEMPTS=30
81+
for (( i=1; i<=MAX_ATTEMPTS; i++ )); do
82+
echo "Checking if PR #$PR_NUMBER is merged (Attempt $i/$MAX_ATTEMPTS)..."
83+
for (( j=1; i<=600; j++ )); do
84+
PR_STATE=$(gh pr view --repo "$REPO_OWNER/$REPO_NAME" $PR_NUMBER --json mergedAt --jq '.mergedAt')
85+
86+
if [ "$PR_STATE" = "null" ] || [ -z "$PR_STATE" ]; then
87+
echo "PR #$PR_NUMBER is not merged yet. Waiting..."
88+
sleep 1
89+
else
90+
echo "PR #$PR_NUMBER is merged!"
91+
echo "pr_merged_m=true" >> $GITHUB_ENV
92+
echo "pr_merged_m=true" >> $GITHUB_OUTPUT
93+
exit 0
94+
fi
95+
done
96+
done
97+
98+
echo "Timed out waiting for PR #$PR_NUMBER to be merged."
99+
echo "pr_merged_m=false" >> $GITHUB_ENV
100+
echo "pr_merged_m=false" >> $GITHUB_OUTPUT
101+
exit 1
102+
103+
# 3. Update the BuildConfigs for CUDA RStudio and RStudio
104+
Update-buildConfigs:
105+
if: github.event.inputs.update_buildconfigs == 'true'
106+
uses: opendatahub-io/notebooks/.github/workflows/update-buildconfigs.yaml@main
107+
with:
108+
branch: ${{ github.event.inputs.branch }}
109+
version: ${{ github.event.inputs.buildconfigs_version }}
110+
111+
# 4. Check if the BuildConfigs PR is merged
112+
BuildConfigs-merged:
113+
if: github.event.inputs.update_buildconfigs == 'true'
114+
needs: Update-buildConfigs
115+
runs-on: ubuntu-latest
116+
outputs:
117+
pr_merged_b: ${{ steps.check_pr.outputs.pr_merged_b }}
118+
steps:
119+
- name: Check out repository
120+
uses: actions/checkout@v4
121+
with:
122+
fetch-depth: 0
123+
124+
- name: Check if PR is merged
125+
id: check_pr
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
run: |
129+
# PR to look for
130+
PR_TITLE="[Updater Action] Update BuildConfigs for CUDA RStudio and RStudio"
131+
132+
#Fetch matching PRs
133+
PR_NUMBER=$(gh pr list --repo "$REPO_OWNER/$REPO_NAME" --state all --search "$PR_TITLE" --json number,title | jq -r '.[0].number')
134+
echo "PR Numbers: $PR_NUMBER"
135+
136+
if [ -z "$PR_NUMBER" ]; then
137+
echo "No PR found with title: $PR_TITLE"
138+
exit 1
139+
fi
140+
141+
MAX_ATTEMPTS=30
142+
for (( i=1; i<=MAX_ATTEMPTS; i++ )); do
143+
echo "Checking if PR #$PR_NUMBER is merged (Attempt $i/$MAX_ATTEMPTS)..."
144+
for (( j=1; i<=600; j++ )); do
145+
PR_STATE=$(gh pr view --repo "$REPO_OWNER/$REPO_NAME" $PR_NUMBER --json mergedAt --jq '.mergedAt')
146+
147+
if [ "$PR_STATE" = "null" ] || [ -z "$PR_STATE" ]; then
148+
echo "PR #$PR_NUMBER is not merged yet. Waiting..."
149+
sleep 1
150+
else
151+
echo "PR #$PR_NUMBER is merged!"
152+
echo "pr_merged_b=true" >> $GITHUB_ENV
153+
echo "pr_merged_b=true" >> $GITHUB_OUTPUT
154+
exit 0
155+
fi
156+
done
157+
done
158+
159+
echo "Timed out waiting for PR #$PR_NUMBER to be merged."
160+
echo "pr_merged_b=false" >> $GITHUB_ENV
161+
echo "pr_merged_b=false" >> $GITHUB_OUTPUT
162+
exit 1
163+
164+
# 5. Generate the release with BuildConfigs if needed
165+
Generate-release_with_buildconfigs:
166+
needs: [Update-manifests, Manifests-merged, Update-buildConfigs, BuildConfigs-merged]
167+
if: needs.Manifests-merged.outputs.pr_merged_m == 'true' && needs.BuildConfigs-merged.outputs.pr_merged_b == 'true' && github.event.inputs.update_buildconfigs == 'true'
168+
runs-on: ubuntu-latest
169+
steps:
170+
- name: Check out repository
171+
uses: actions/checkout@v4
172+
with:
173+
fetch-depth: 0
174+
- name: Invoke Script to handle creating a release
175+
env:
176+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177+
working-directory: ${{env.GITHUB_WORKSPACE}}
178+
run: |
179+
gh release create "$RELEASE_TAG" --title="$RELEASE_NAME-$RELEASE_TAG" --generate-notes --target $BRANCH
180+
181+
# 6. Generate the release without BuildConfigs
182+
Generate-release:
183+
needs: [Update-manifests, Manifests-merged]
184+
if: needs.Manifests-merged.outputs.pr_merged_m == 'true' && github.event.inputs.update_buildconfigs == 'false'
185+
runs-on: ubuntu-latest
186+
steps:
187+
- name: Check out repository
188+
uses: actions/checkout@v4
189+
with:
190+
fetch-depth: 0
191+
- name: Invoke Script to handle creating a release
192+
env:
193+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194+
working-directory: ${{env.GITHUB_WORKSPACE}}
195+
run: |
196+
gh release create "$RELEASE_TAG" --title="$RELEASE_NAME-$RELEASE_TAG" --generate-notes --target $BRANCH

0 commit comments

Comments
 (0)