Skip to content
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

ci: keep start_codebuild.sh up-to-date #5023

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci_linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,38 @@ jobs:
exit 1
- name: Success
run: echo "All nix files passed format check"

validate_start_codebuild_script:
name: validate start_codebuild.sh
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: pause
run: "sleep 120"
- name: retrieve statuses
id: get_statuses
uses: octokit/[email protected]
with:
route: GET /repos/{repo}/commits/{ref}/statuses?per_page=100
repo: ${{ github.repository }}
ref: ${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: check start_codebuild.sh against statuses
id: github_builds
run: |
from_github=$(
jq '.[] | .description' <<< '${{ steps.get_statuses.outputs.data }}' \
| grep "for project" \
| sed -r "s/^.*?for project (.*?)\"$/\1/" \
| sort -u
)
echo builds from github statuses:
echo "$from_github"
from_file=$(
source codebuild/bin/start_codebuild.sh > /dev/null \
|| printf "%s\n" "${BUILDS[@]}" | cut -d" " -f1 | sort -u
)
echo builds from start_codebuild.sh:
echo "$from_file"
diff <(echo "$from_github") <(echo "$from_file")
4 changes: 3 additions & 1 deletion codebuild/bin/start_codebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ usage() {
echo " example: start_codebuild.sh pr/1111"
echo " example: start_codebuild.sh test_branch"
echo " example: start_codebuild.sh 1234abcd"
exit 1
}

if [ "$#" -ne "1" ]; then
usage
# Return instead of exit so we can `source` this script
# in order to get access to BUILDS.
return 1
fi
SOURCE_VERSION=$1

Expand Down
Loading