bitflicker64 commented on code in PR #3171:
URL: https://github.com/apache/hugegraph/pull/3171#discussion_r3851688799
##########
.github/workflows/docker-build-ci.yml:
##########
@@ -25,11 +25,71 @@ on:
pull_request:
paths:
- '**/Dockerfile*'
+ - 'docker-bake.hcl'
- '.dockerignore'
- 'hugegraph-server/hugegraph-dist/docker/**'
- 'hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh'
jobs:
+ docker-bake-check:
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Verify shared Maven stages stay identical
+ shell: bash
+ run: |
+ set -euo pipefail
+
+ extract_build_stage() {
+ awk '
+ /^FROM .* AS build$/ {
+ in_build = 1
+ }
+ in_build && seen && /^FROM / {
+ exit
+ }
+ in_build {
+ print
+ seen = 1
+ }
+ ' "$1"
+ }
+
+ reference="hugegraph-pd/Dockerfile"
Review Comment:
If the stage header ever changes casing or name (`as build` is valid
Dockerfile syntax), `extract_build_stage` returns empty for every file and the
diffs pass vacuously, so the guard silently stops guarding. Reproduced this:
rewriting `AS build` to `as build` in all four files makes the check pass even
with divergent `mvn` lines. A partial rename is still caught. Cheap fix: assert
the reference extraction is non-empty first.
```suggestion
reference="hugegraph-pd/Dockerfile"
[ -n "$(extract_build_stage "$reference")" ] || {
echo "ERROR: no 'AS build' stage found in $reference; guard
would pass vacuously"
exit 1
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]