diff --git a/.github/workflows/ci_linting.yml b/.github/workflows/ci_linting.yml index f4f63b6c9eb..769e0c6b30a 100644 --- a/.github/workflows/ci_linting.yml +++ b/.github/workflows/ci_linting.yml @@ -128,3 +128,41 @@ 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 1" + - name: retrieve statuses + id: get_statuses + uses: octokit/request-action@v2.x + with: + route: GET /repos/{repo}/commits/{ref}/statuses?per_page=100 + #repo: ${{ github.repository }} + repo: aws/s2n-tls + #ref: ${{ github.sha }} + ref: 561c145c11fc7f13d0b1de72f389997a3bd5210a + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: check start_codebuild.sh against statuses + id: github_builds + run: | + set -e + 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") diff --git a/codebuild/bin/start_codebuild.sh b/codebuild/bin/start_codebuild.sh index 3302b249ee1..af85005cc90 100755 --- a/codebuild/bin/start_codebuild.sh +++ b/codebuild/bin/start_codebuild.sh @@ -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