-
Notifications
You must be signed in to change notification settings - Fork 86
Clone specific software-layer-commit and implement CI to check merged status #1353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bedroge
merged 39 commits into
EESSI:main
from
casparvl:improve_software_layer_scripts_workflow
Aug 21, 2026
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
7a52620
Add dummy EasyConfig
12c2bc7
Update bot/build.sh file to checkout commit_sha from software-layer-s…
dd37ed9
Fix indent
219bef9
Fix indent again
218e75f
Get rid of two unnecessary, and wrong commands
b8355bb
Check that changing the commit_sha to an _unmerged_ commit creates a …
f9d1b7d
Checkout the required github
2cd6082
Add comment
6d954c4
Replace commit_sha by an actual signed merge commit to prove that the…
36f7541
Test that the bot/build.sh script is unchanged
f1fdcca
Try to see if CI now fails, as intended
c4b1f9a
Correct missing space in bash logic - see if the workflow now fails (…
20d8bd2
Merge branch 'main' into improve_software_layer_scripts_workflow
casparvl 0494884
Undo dummy change to see if CI passes again
72fbb29
Merge branch 'improve_software_layer_scripts_workflow' of github.com:…
1530fca
Rename the CI
cc18733
Merge into a single workflow file
77167ac
See if the bot/build.sh checksum test runs this way...
bce9bbc
See if the bot/build.sh checksum test still runs after uncommenting
bee1d29
Change sha checksum to see if this causes CI to fail (as expected)
2c752d2
Change SHA to an actual merge commit and change bot/build.sh to see i…
6d2714e
Change bot/build.sh back to the intended content so that all CI shoul…
47c4771
Change commit_sha filename, and correspondingly change the checksum f…
482a907
Process review comments from Kenneth
ca5e9a2
Use the current tip of main
46df2ef
Fix filename that contians the software layer scripts commit sha
94ae63e
Add github action to check the bot/software_layer_scripts_commit sha …
6f2f432
Change to an older merge commit to test if CI then fails
690e444
Try an unmerged commit
d1f62e7
Add CI check that checks if all tarballs are available, i.e. for all …
3b7008f
Remove functionality to check 'bot:build last_status' output, we'll i…
981cb97
Run CI only if hte bot/software_layer_scripts_commit has been changed…
1041e42
Made the description of this CI more extensive, so we know why we did…
a0a6a06
Undo adding cowsay - that was only there to be able to test this PR
88611d1
Apply suggestions from code review
casparvl 0ef5d06
Update software_layer_scripts_commit
2438109
Merge branch 'main' into improve_software_layer_scripts_workflow
d38aa1e
Apply suggestion from @casparvl
casparvl 19de61c
Update expected checksum after comment was changed
bedroge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions | ||
| # | ||
| # Our goal is to ensure that the bot/software_layer_scripts_commit in software-layer/main always | ||
| # points to the latest software-layer-scripts/main. | ||
| # | ||
| # This workflow checks if the commit SHA in bot/software_layer_scripts_commit | ||
| # matches the latest commit on the main branch of EESSI/software-layer-scripts. | ||
| # It only runs when the 'bot:deploy' label is present on the PR AND if the bot/software_layer_scripts_commit | ||
| # has been changed. This ensures that: | ||
| # - Contributors that don't know about bot/software_layer_scripts_commit (i.e.: haven't updated it) don't get | ||
| # a CI that complains about the version not being the latest. That's fine, we will update that file in other PRs | ||
| # and if users don't change the file in their PR, there's no risk of overwriting with an older version | ||
| # - Contributors that have changed bot/software_layer_scripts_commit can build with a fixed version (commit) | ||
| # of EESSI/software-layer-scripts, ensuring that builds for all targets are done in a coherent manner. | ||
| # After all builds are deployed, the CI is run, checking that this is the latest commit. If not, contributors | ||
| # will have to update that before merging. This ensures that merging their PR does not cause software-layer/main's | ||
| # bot/software_layer_scripts_commit to start pointing to an _older_ commit. | ||
| name: Check software-layer-scripts commit is up to date | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, labeled] | ||
| paths: | ||
| - 'bot/software_layer_scripts_commit' | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| jobs: | ||
| check_latest_commit: | ||
| if: > | ||
| ( | ||
| contains(github.event.pull_request.labels.*.name, 'bot:deploy') | ||
| || contains(github.event.pull_request.labels.*.name, 'force-sw-layer-commit-ci') | ||
| ) | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Check out software-layer repository (shallow) | ||
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Read commit SHA from bot/software_layer_scripts_commit | ||
| id: read_sha | ||
| run: | | ||
| if [[ ! -f bot/software_layer_scripts_commit ]]; then | ||
| echo "ERROR: bot/software_layer_scripts_commit not found!" | ||
| exit 1 | ||
| fi | ||
| SHA=$(cat bot/software_layer_scripts_commit | tr -d '[:space:]') | ||
| echo "sha=$SHA" >> $GITHUB_OUTPUT | ||
| echo "Found SHA: $SHA" | ||
|
|
||
| - name: Get latest commit on main of EESSI/software-layer-scripts | ||
| id: latest_sha | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| SHA=$(gh api repos/EESSI/software-layer-scripts/commits/main --jq .sha) | ||
| echo "sha=$SHA" >> $GITHUB_OUTPUT | ||
| echo "Latest commit on main: $SHA" | ||
|
|
||
| - name: Compare SHAs | ||
| run: | | ||
| if [[ "${{ steps.read_sha.outputs.sha }}" == "${{ steps.latest_sha.outputs.sha }}" ]]; then | ||
| echo "OK: bot/software_layer_scripts_commit matches the latest commit on main." | ||
| else | ||
| echo "ERROR: bot/software_layer_scripts_commit does not match the latest commit on main of EESSI/software-layer-scripts." | ||
| echo "Stored commit: ${{ steps.read_sha.outputs.sha }}" | ||
| echo "Latest commit: ${{ steps.latest_sha.outputs.sha }}" | ||
| echo "Please update bot/software_layer_scripts_commit to ${{ steps.latest_sha.outputs.sha }} and push the change." | ||
| exit 1 | ||
| fi | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions | ||
| # | ||
| # This workflow verifies that the correct version of software-layer-scripts is used. | ||
| # | ||
| # First, check_bot_build_checksums checks if the bot/build.sh code that clones software-layer-scripts is untouched, | ||
| # as this normally shouldn't change, so let's be really cautious here. Having this CI means that a change in bot/build.sh should at least be accompanied by | ||
| # a change in this CI, making it stand out to reviewers and increasing the likelihood of this being caught. | ||
| # | ||
| # Second, check-software_layer_scripts_commit checks if the commit used in bot/software_layer_scripts_commit is a merge-commit for a | ||
| # merge into the default branch of software-layer-scripts. This guarantees that everything that is associated with | ||
| # that commit was approved by a reviewer (and deployed, if needed) | ||
| name: Verify software-layer-scripts | ||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| jobs: | ||
| check_bot_build_checksum: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Check out software-layer repository (shallow) | ||
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
| with: | ||
| fetch-depth: 1 # We only need the current revision to read bot/software_layer_scripts_commit | ||
|
|
||
| - name: Compute bot/build.sh checksum and verify it | ||
| run: | | ||
| # Print clear error if file doesn't exist at all | ||
| if [[ ! -f bot/build.sh ]]; then | ||
| echo "ERROR: File bot/build.sh not found!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Reference checksum | ||
| # UPDATE THIS CHECKSUM IF AND ONLY IF WE ACTUALLY WANT TO CHANGE bot/build.sh | ||
| EXPECTED_CHECKSUM="622e0b4d39543aaf70ee912edd0660c3746d7a1ecb176e0d41df598155e50e21" | ||
|
|
||
| # Compute checksum | ||
| COMPUTED_CHECKSUM=$(sha256sum bot/build.sh | awk '{print $1}') | ||
| echo "Computed checksum: $COMPUTED_CHECKSUM" | ||
| echo "Reference checksum: $EXPECTED_CHECKSUM" | ||
|
|
||
| # Compare checksums | ||
| if [[ "$COMPUTED_CHECKSUM" != "$EXPECTED_CHECKSUM" ]]; then | ||
| echo "ERROR: Checksum mismatch! The file bot/build.sh has been modified." | ||
| exit 1 | ||
| else | ||
| echo "Checksum for bot/build.sh matches the reference value" | ||
| fi | ||
| check_software_layer_scripts_commit: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Check out software-layer repository (shallow) | ||
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
| with: | ||
| fetch-depth: 1 # We only need the current revision to read bot/software_layer_scripts_commit | ||
| - name: Checkout software-layer-scripts (full history) | ||
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
| with: | ||
| repository: EESSI/software-layer-scripts | ||
| path: EESSI-software-layer-scripts | ||
| fetch-depth: 0 # full history → required for ancestry checks | ||
|
|
||
| - name: Read commit SHA | ||
| id: read_sha | ||
| run: | | ||
| SHA=$(cat bot/software_layer_scripts_commit | tr -d '[:space:]') | ||
| echo "sha=$SHA" >> $GITHUB_OUTPUT | ||
| echo "Found SHA: $SHA" | ||
|
|
||
| - name: Verify SHA exists in software‑layer‑scripts | ||
| working-directory: EESSI-software-layer-scripts | ||
| run: | | ||
| SHA="${{ steps.read_sha.outputs.sha }}" | ||
|
|
||
| echo "Checking out commit ${SHA} from software-layer-scripts" | ||
| git fetch --depth=1 origin ${SHA} | ||
| git checkout --detach ${SHA} | ||
|
|
||
| # Validate that this object is _actually_ a commit | ||
| if ! git cat-file -e "${SHA}^{commit}" 2>/dev/null; then | ||
| echo "Commit $SHA not found in software‑layer‑scripts." | ||
| exit 1 | ||
| fi | ||
| echo "Commit $SHA exists in software‑layer‑scripts." | ||
|
|
||
| - name: Check that SHA is merged into the default branch | ||
| working-directory: EESSI-software-layer-scripts | ||
| run: | | ||
| SHA="${{ steps.read_sha.outputs.sha }}" | ||
|
|
||
| # git merge‑base --is‑ancestor returns 0 if $SHA is an ancestor of origin/main | ||
| if git merge-base --is-ancestor "$SHA" origin/main; then | ||
| echo "Commit $SHA is merged into origin/main." | ||
| else | ||
| echo "Commit $SHA is NOT merged into origin/main." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify commit is signed by GitHub’s web‑flow key | ||
| working-directory: EESSI-software-layer-scripts | ||
| env: | ||
| GIT_TRACE: 1 # extra debug output if something goes wrong | ||
| run: | | ||
| SHA="${{ steps.read_sha.outputs.sha }}" | ||
|
|
||
| # Import the public key that GitHub uses for UI‑generated merges | ||
| echo "Importing GitHub web‑flow GPG key…" | ||
| curl -sSfL https://github.com/web-flow.gpg | gpg --dearmor > web-flow.gpg | ||
| gpg --import web-flow.gpg | ||
| # (optional) show the fingerprint for debugging | ||
| echo "Fingerprint of the web-flow GPG key:" | ||
| gpg --list-keys --fingerprint | grep -i "web-flow" -A1 | ||
|
|
||
| # Verify the commit’s GPG signature | ||
| echo "Verifying the signature of commit $SHA…" | ||
| if git verify-commit "$SHA"; then | ||
| echo "Commit $SHA is signed and the signature validates with the web‑flow key." | ||
| echo "All verification steps succeeded." | ||
| else | ||
| echo "Commit $SHA is either unsigned or not signed by the web‑flow key." | ||
| exit 1 | ||
| fi |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.