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

chore(ci): apply fixes to the ngx_wasm_module update workflow #12134

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
46 changes: 35 additions & 11 deletions .github/workflows/update-ngx-wasm-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ jobs:
- name: Detect current version of NGX_WASM_MODULE in .requirements
id: check-kong
run: |
SHA=$(sed -nre 's/^NGX_WASM_MODULE=([^ ]+) .*/\1/p' < .requirements)
SHA=$(sed -nre 's/^NGX_WASM_MODULE=([^ ]+).*/\1/p' < .requirements)
echo "sha=$SHA" | tee -a "$GITHUB_OUTPUT"
if [[ -z ${SHA:-} ]]; then
echo "fatal: failed to parse ngx_wasm_module sha from .requirements file"
exit 1
fi

- name: Check Kong/ngx_wasm_module HEAD
id: check-repo
Expand All @@ -35,6 +39,10 @@ jobs:
run: |
SHA=$(gh api repos/Kong/ngx_wasm_module/commits/main --jq '.sha')
echo "sha=$SHA" | tee -a "$GITHUB_OUTPUT"
if [[ -z ${SHA:-} ]]; then
echo "fatal: failed to fetch sha from Kong/ngx_wasm_module repo"
exit 1
fi

- name: Update .requirements and create a pull request
if: steps.check-kong.outputs.sha != steps.check-repo.outputs.sha
Expand All @@ -44,16 +52,16 @@ jobs:
TO: ${{ steps.check-repo.outputs.sha }}
run: |
set -x

# masquerade as team-gateway-bot for the purposes of this commit/PR
git config --global user.email "[email protected]"
git config --global user.name "team-gateway-bot"

gh auth status
gh auth setup-git

# masquerade as dependabot for the purposes of this commit/PR
git config --global user.email \
"49699333+dependabot[bot]@users.noreply.github.com"
git config --global user.name "dependabot[bot]"

readonly BRANCH=chore/deps-bump-ngx-wasm-module
if gh api repos/Kong/kong/branches/"$BRANCH"; then
if gh api repos/Kong/kong/branches/"$BRANCH" >/dev/null; then
echo "branch ($BRANCH) already exists, exiting"
exit 1
fi
Expand Down Expand Up @@ -123,14 +131,30 @@ jobs:
'"* [`\(.sha)`](\(.url)) - \(.message)"' \
< commits.json

printf '\n\n'
printf '**IMPORTANT: Remember to scan this commit log for updates '
printf 'to Wasmtime/V8/Wasmer and update `.requirements` manually '
printf 'as needed**\n'
cat << 'EOF'

## TODO

- [ ] scan this commit log for updates to Wasmtime/V8/Wasmer and update `.requirements` as needed
- [ ] ensure the full integration test suite has been triggered. This can be accomplished by pushing an empty commit to the branch from an authorized github account:
```shell
cd path/to/kong/repo
git fetch
git switch chore/deps-bump-ngx-wasm-module
git pull -r
git commit --allow-empty -m "chore(*): empty commit, please squash"
git push origin HEAD
```
EOF

} > body.md

gh pr create \
--draft \
--assignee "flrgh" \
--base master \
--head "$BRANCH" \
--title "$HEADER" \
--label "cherry-pick kong-ee" \
--label "core/wasm" \
--body-file body.md
Loading