Skip to content

Commit b3a672c

Browse files
behzad-mirCopilot
andcommitted
fix: address review — patch comparison, renderkit parsing, labels, PR bodies
- build/images.mk: add NEW_TAG guard to prevent empty tag writes - Patch availability: compare against GOMOD_VERSION not GO_MINOR (prevents weekly no-op PRs when go.mod already matches latest patch) - Patch tag matching: use dot separator to prevent false prefix matches - renderkit version: use `go mod edit -json` instead of fragile grep - Labels: use existing 'go' label instead of non-existent 'needs-review' - Assignee: remove 'copilot' (not a valid GitHub user for assignment) - PR bodies: fix inaccurate claims (patch doesn't update GO_IMG; digest refresh may update go.mod) - Remove duplicate git config in auto-bump job - copilot-instructions.md: make GOEXPERIMENT guidance version-dependent - SKILL.md: clarify CGO Map is version-dependent with Go 1.27 note Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5537cbe commit b3a672c

4 files changed

Lines changed: 36 additions & 21 deletions

File tree

.github/copilot-instructions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ For task-specific guidance, use the appropriate skill:
2424
- Build system uses `make dockerfiles` with template rendering via `renderkit`
2525
- Tools module lives at `tools-go/go.mod` (separate from root `go.mod`)
2626
- CI uses both GitHub Actions and Azure Pipelines (`.pipelines/`)
27-
- `cilium-log-collector` is the only component using `CGO_ENABLED=1` (with `GOEXPERIMENT=systemcrypto`)
28-
- All other components use `CGO_ENABLED=0` with `GOEXPERIMENT=ms_nocgo_opensslcrypto` (Go 1.26)
27+
- `cilium-log-collector` is the only component using `CGO_ENABLED=1`
28+
- All other components use `CGO_ENABLED=0`
29+
- **GOEXPERIMENT requirements are version-dependent** — consult the `acn-go-version-bump` skill for current rules. As of Go 1.26: CGO=1 needs `systemcrypto`, CGO=0 needs `ms_nocgo_opensslcrypto`. Go 1.27+ changes these rules.
2930

3031
## AI Documentation
3132

.github/skills/acn-go-version-bump/SKILL.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,15 @@ After making all changes:
245245
- Uses `renderkit` and `skopeo` to resolve image tags to SHA digests
246246
- Pipeline uses `.pipelines/build/scripts/install-go.sh`
247247

248-
### Component CGO Map (current as of Go 1.26)
249-
| Component | CGO_ENABLED | GOEXPERIMENT | Build Mode | Notes |
250-
|-----------|:-----------:|:------------:|:----------:|-------|
251-
| cni, cns, npm, dropgz, azure-ipam, azure-ip-masq-merger, azure-iptables-monitor, ipv6-hp-bpf | 0 | ms_nocgo_opensslcrypto | static binary | Nocgo OpenSSL backend (systemcrypto requires CGO) |
248+
### Component CGO Map
249+
250+
> **GOEXPERIMENT values are version-dependent.** Always consult MS Go docs for the target version.
251+
> The table below shows the CGO settings (which are version-independent) and the GOEXPERIMENT
252+
> rules as of Go 1.26. For Go 1.27+, `systemcrypto` works without CGO (nocgo backend is default).
253+
254+
| Component | CGO_ENABLED | GOEXPERIMENT (Go 1.26) | Build Mode | Notes |
255+
|-----------|:-----------:|:----------------------:|:----------:|-------|
256+
| cni, cns, npm, dropgz, azure-ipam, azure-ip-masq-merger, azure-iptables-monitor, ipv6-hp-bpf | 0 | ms_nocgo_opensslcrypto | static binary | Nocgo OpenSSL backend (systemcrypto requires CGO in 1.26) |
252257
| cilium-log-collector | 1 | systemcrypto | c-shared (.so) | Fluent Bit plugin, requires CGO |
253258

254259
### Important Notes

.github/workflows/go-version-check.yaml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
LATEST_MINOR_TAG=""
162162
if [ -n "$ALL_TAGS" ]; then
163163
while IFS=$'\t' read -r ver tag; do
164-
if [[ "$ver" == ${GO_MINOR}* ]]; then
164+
if [[ "$ver" == ${GO_MINOR}.* ]] || [[ "$ver" == "${GO_MINOR}" ]]; then
165165
LATEST_PATCH="$ver"
166166
LATEST_PATCH_TAG="$tag"
167167
break
@@ -183,7 +183,7 @@ jobs:
183183
echo "latest_minor_tag=$LATEST_MINOR_TAG" >> "$GITHUB_OUTPUT"
184184
185185
PATCH_AVAILABLE="false"
186-
if [ -n "$LATEST_PATCH" ] && [ "$LATEST_PATCH" != "$GO_MINOR" ]; then
186+
if [ -n "$LATEST_PATCH" ] && [ "$LATEST_PATCH" != "$GOMOD_VERSION" ]; then
187187
LATEST_PATCH_DIGEST=$(skopeo inspect "docker://$MCR_REPO:${LATEST_PATCH}-${BASE_OS}" --format "{{.Digest}}" 2>/dev/null || echo "FAILED")
188188
if [ "$LATEST_PATCH_DIGEST" != "FAILED" ] && [ "$LATEST_PATCH_DIGEST" != "$CURRENT_DIGEST" ]; then
189189
PATCH_AVAILABLE="true"
@@ -294,7 +294,12 @@ jobs:
294294
fi
295295
# Install renderkit from repo's pinned tools-go/go.mod
296296
GOPATH=$(go env GOPATH 2>/dev/null || echo "$HOME/go")
297-
RENDERKIT_VER=$(grep 'orellazri/renderkit' tools-go/go.mod | awk '{print $2}')
297+
RENDERKIT_VER=$(go mod edit -json tools-go/go.mod | python3 -c "
298+
import sys, json
299+
for req in json.load(sys.stdin).get('Require', []):
300+
if 'orellazri/renderkit' in req['Path']:
301+
print(req['Version']); break
302+
")
298303
go install "github.com/orellazri/renderkit@${RENDERKIT_VER}"
299304
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
300305
@@ -360,8 +365,6 @@ jobs:
360365
fi
361366
362367
# Commit
363-
git config user.name "github-actions[bot]"
364-
git config user.email "github-actions[bot]@users.noreply.github.com"
365368
git add -A
366369
if git diff --cached --quiet; then
367370
echo "::notice::No changes to commit"
@@ -426,8 +429,6 @@ jobs:
426429
make dockerfiles
427430
428431
# Commit
429-
git config user.name "github-actions[bot]"
430-
git config user.email "github-actions[bot]@users.noreply.github.com"
431432
git add -A
432433
if git diff --cached --quiet; then
433434
echo "::notice::No changes to commit"
@@ -470,8 +471,7 @@ jobs:
470471
**Digest:** \`${PR_LATEST_PATCH_DIGEST}\`
471472
472473
### Changes Made
473-
- \`build/images.mk\` GO_IMG tag updated
474-
- \`go.mod\` version bumped
474+
- \`go.mod\` and \`tools-go/go.mod\` version bumped
475475
- \`go mod tidy\` executed
476476
- \`install-go.sh\` DEFAULT_IMAGE SHA updated
477477
- \`bpf-prog/ipv6-hp-bpf/linux.Dockerfile\` SHA updated
@@ -496,12 +496,13 @@ jobs:
496496
**Go version in image:** \`${PR_LATEST_GO_VERSION}\`
497497
498498
This is a same-tag image rebuild (security patches, base OS updates).
499-
No Go language version change expected.
499+
If the Go version label in the image changed, \`go.mod\` is also updated.
500500
501501
### Changes Made
502502
- \`install-go.sh\` DEFAULT_IMAGE SHA updated
503503
- \`bpf-prog/ipv6-hp-bpf/linux.Dockerfile\` SHA updated
504504
- Template Dockerfiles regenerated via \`make dockerfiles\`
505+
- \`go.mod\`/\`tools-go/go.mod\` bumped (if Go version in image changed)
505506
506507
---
507508
<!-- go-digest-update:${PR_GO_TAG} -->
@@ -566,7 +567,12 @@ jobs:
566567
fi
567568
# Install renderkit from repo's pinned tools-go/go.mod
568569
GOPATH=$(go env GOPATH 2>/dev/null || echo "$HOME/go")
569-
RENDERKIT_VER=$(grep 'orellazri/renderkit' tools-go/go.mod | awk '{print $2}')
570+
RENDERKIT_VER=$(go mod edit -json tools-go/go.mod | python3 -c "
571+
import sys, json
572+
for req in json.load(sys.stdin).get('Require', []):
573+
if 'orellazri/renderkit' in req['Path']:
574+
print(req['Version']); break
575+
")
570576
go install "github.com/orellazri/renderkit@${RENDERKIT_VER}"
571577
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
572578
@@ -738,8 +744,8 @@ jobs:
738744
gh issue create \
739745
--repo "$REPO" \
740746
--title "chore: FIPS prerequisites needed on ${MATRIX_BRANCH} before Go backport" \
741-
--label "needs-review" \
742-
--assignee "copilot" \
747+
--label "go" \
748+
--assignee "" \
743749
--body "## Prerequisites Needed on \`${MATRIX_BRANCH}\`
744750
745751
The Go version automation detected a digest/patch update on master, but
@@ -1160,6 +1166,6 @@ jobs:
11601166
gh issue create \
11611167
--repo "$REPO" \
11621168
--title "chore: upgrade Go ${GO_MINOR} → ${LATEST_MINOR}" \
1163-
--label "needs-review" \
1164-
--assignee "copilot" \
1169+
--label "go" \
1170+
--assignee "" \
11651171
--body "$BODY"

build/images.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ print-%:
3131

3232
# Set GO_IMG tag: make -f build/images.mk set-GO_IMG NEW_TAG=1.27-azurelinux3.0
3333
set-GO_IMG:
34+
ifndef NEW_TAG
35+
$(error NEW_TAG is required — usage: make -f build/images.mk set-GO_IMG NEW_TAG=1.27-azurelinux3.0)
36+
endif
3437
sed -i -E 's|(GO_IMG[[:space:]]*\?=[[:space:]]*.*golang:)[^ ]*|\1$(NEW_TAG)|' $(CURDIR)/build/images.mk
3538

3639
render:

0 commit comments

Comments
 (0)