Skip to content

Commit 76bc292

Browse files
chore(ci-governance): synchronize Go profile (#82)
Governance-Provenance: hmac-sha256:f92607eac193cbee45fb3640b338d9f0645a5ba0107828ddbd224a6d820311c0 Signed-off-by: Enrique Andrés Villar <enriqueavi@inditex.com> Co-authored-by: inditextechci-sync[bot] <312492039+inditextechci-sync[bot]@users.noreply.github.com> Co-authored-by: Enrique Andrés Villar <enriqueavi@inditex.com>
1 parent bf3adef commit 76bc292

7 files changed

Lines changed: 175 additions & 104 deletions

‎.github/inditextech-ci-sync-manifest.json‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"creation_year": 2026,
1313
"integrity": {
1414
"algorithm": "hmac-sha256",
15-
"signature": "b9e6b75852c23cbbed7265826d4808864092fa5f3c232af9e14f617ae71bf96e"
15+
"signature": "35238a1879c3c8acc3d16b5d08af75a17d6814ad0550258924994c155e176b69"
1616
},
1717
"managed_by": "InditexTech CI governance",
1818
"managed_paths": {
@@ -22,11 +22,12 @@
2222
".github/ISSUE_TEMPLATE/config.yml": "10e5dee4d49aa9e7792ceb4c986160c61f95da1ba00a64bf06e5f1f636cd17ec",
2323
".github/PULL_REQUEST_TEMPLATE.md": "23a0b0ac79a9020ccac9c013582a01f86e2df2ae7f914673583b9a3368313041",
2424
".github/inditextech-ci-go.json": "d854041fe302eab86b99a4ee25414027fda743af14f26db7e8883ab90f60c5fd",
25-
".github/workflows/code-gomod_go-PR_verify.yml": "7145f586962f35425afbce4cdd00c61f0447d25f1c22ea48c8131f42343f893e",
26-
".github/workflows/code-gomod_go-sonarcloud-analysis.yml": "65b682f75a2fc0d9e928bc4816d79e1ff6aa68830c47148e23db9943f3a79c10",
27-
".github/workflows/codeql.yml": "a7ff83d8f89a5e02bfd729939a51a0a512a0f2f3fa7ddf9dc688dfdf41937748",
28-
".github/workflows/pr-verify.yml": "f52295fbfe81578c0a6459d8b384be569933ac78d32fff370932a8dec6943e46",
29-
".github/workflows/push-verify.yml": "217097070d0fdef329eae1a7187806a4623d692ce467ca8f1f9a7f56dddb29ed",
25+
".github/workflows/code-gomod_go-PR_verify.yml": "d148e5af0bc577e6deff1c6c57916de83af3e553fbe197d057ac2e7c6d7e22cb",
26+
".github/workflows/code-gomod_go-sonarcloud-analysis.yml": "fcb5c72a4ae59a3b429420b1e15eda5c4c0cb4a0aa89c3f4f99eb2e3198dcaca",
27+
".github/workflows/codeql.yml": "c939b9dea312d987ecc8df2b32c257fb7512b5ca5576c9a73dd0b21fcc770b33",
28+
".github/workflows/pr-verify.yml": "5628d1d93c09cb761602fcfc3857c325e2dc542cadc159a1edad58d1818d0de0",
29+
".github/workflows/push-verify.yml": "643f6905fa30284af4a2eabac752293b2e785a5e82449bb6d97950624386829c",
30+
".github/workflows/scorecard-analysis.yml": "b45c2a0f87801796cefb4363d9f1414891b0734bc07de3f50d4a880e22faea10",
3031
"repolinter.json": "0efb305c47a63f03c488a34906fc2d5471c84145c2ff553f2aacf3a41b92e1a1"
3132
},
3233
"managed_variables": {
@@ -42,7 +43,7 @@
4243
},
4344
"schema_version": 2,
4445
"source_digests": {
45-
"base": "09dc9b8d0dcb29288bdb6adeb49cea193b4b79f8de78e55eed00c1c669b5ab5a",
46-
"go": "963229e52884cccc1de8b2251ce7745a8fa5e36970553eeb513a9d1f914d4410"
46+
"base": "c2c2d14df680360bc841fe7fe76552a3d009a60959d08d527526e78e1bbb2b38",
47+
"go": "553836e941384482b416db2684c551a70a9f285f3734c010cfcd133cba266b39"
4748
}
4849
}

‎.github/workflows/code-gomod_go-PR_verify.yml‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ concurrency:
1616

1717
env:
1818
WORKING_DIRECTORY: ${{ vars.WORKING_DIRECTORY }}
19-
# The project-owned verify command travels in the managed component descriptor,
20-
# never in an Actions variable: the repo owns its build, governance owns only the
21-
# envelope that invokes it.
2219
COMPONENT_DESCRIPTOR: .github/inditextech-ci-go.json
2320
ASDF_BRANCH_VERSION: '0.18.0'
2421

@@ -35,6 +32,27 @@ jobs:
3532
persist-credentials: false
3633
ref: ${{ github.event.pull_request.head.sha }}
3734

35+
- name: Resolve governed working directory
36+
shell: bash
37+
run: |
38+
set -euo pipefail
39+
if [[ ! -f "$COMPONENT_DESCRIPTOR" ]]; then
40+
echo "::error title=Missing descriptor::${COMPONENT_DESCRIPTOR} not found."
41+
exit 1
42+
fi
43+
workdir="${WORKING_DIRECTORY:-$(jq -r '.working_directory // empty' "$COMPONENT_DESCRIPTOR")}"
44+
case "$workdir" in
45+
""|/*|..|../*|*/..|*/../*)
46+
echo "::error title=Invalid working directory::WORKING_DIRECTORY must be a non-empty relative repository path." >&2
47+
exit 1
48+
;;
49+
esac
50+
if [[ ! -d "$workdir" ]]; then
51+
echo "::error title=Missing working directory::'${workdir}' is not a directory in this checkout." >&2
52+
exit 1
53+
fi
54+
echo "WORKING_DIRECTORY=${workdir}" >> "$GITHUB_ENV"
55+
3856
- name: Read governed tool versions
3957
id: tool-versions
4058
working-directory: ${{ env.WORKING_DIRECTORY }}
@@ -43,18 +61,13 @@ jobs:
4361
set -euo pipefail
4462
resolved=""
4563
if [[ -f .tool-versions ]]; then
46-
# Validate only real "<plugin> <version>" lines; asdf allows # comments (SPDX/REUSE) and blank lines.
4764
if grep -vE '^[[:space:]]*(#|$)' .tool-versions | grep -qvE '^[a-zA-Z0-9_-]+ [a-zA-Z0-9._+-]+$'; then
4865
echo "::error title=Invalid tool-versions::${WORKING_DIRECTORY}/.tool-versions is malformed."
4966
exit 1
5067
fi
51-
# Emit only the governed golang pin so asdf ignores project extra pins (e.g. kind).
5268
resolved="$(grep -E '^golang ' .tool-versions || true)"
5369
fi
5470
if [[ -z "$resolved" ]]; then
55-
# No committed golang pin: derive it from the module's own go directive so the
56-
# governed lane follows the product's declared toolchain instead of failing or
57-
# clamping it. A committed pin always wins over the derived one.
5871
if [[ ! -f go.mod ]]; then
5972
echo "::error title=Missing go toolchain::${WORKING_DIRECTORY} has no golang pin in .tool-versions and no go.mod to derive one from."
6073
exit 1
@@ -67,7 +80,6 @@ jobs:
6780
echo "::error title=Missing go toolchain::${WORKING_DIRECTORY}/go.mod declares no usable go version."
6881
exit 1
6982
fi
70-
# asdf installs an exact patch release; a two-part directive (go 1.21) means .0.
7183
if [[ "$version" != *.*.* ]]; then
7284
version="${version}.0"
7385
fi
@@ -95,8 +107,6 @@ jobs:
95107
echo "::error title=Missing descriptor::${COMPONENT_DESCRIPTOR} not found."
96108
exit 1
97109
fi
98-
# The descriptor is governance-owned and schema-validated; verify_command
99-
# always resolves, but fail closed if it is somehow blank.
100110
verify_command="$(jq -er '.verify_command // "make verify"' "$COMPONENT_DESCRIPTOR")"
101111
if [[ -z "$verify_command" ]]; then
102112
echo "::error title=Empty verify command::descriptor verify_command must not be blank."
@@ -115,6 +125,4 @@ jobs:
115125
VERIFY_COMMAND: ${{ steps.descriptor.outputs.verify_command }}
116126
run: |
117127
set -euo pipefail
118-
# The project owns its build; governance only invokes the governed
119-
# verify_command inside the pinned working directory.
120128
bash -c "$VERIFY_COMMAND"

‎.github/workflows/code-gomod_go-sonarcloud-analysis.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ jobs:
5757
shell: bash
5858
run: |
5959
set -euo pipefail
60-
# Advisory + graceful-skip: opt-in via SONARCLOUD_ENABLED, but a repo whose
61-
# SONAR_TOKEN is not provisioned simply skips analysis instead of failing.
6260
if [[ -z "${SONAR_TOKEN:-}" ]]; then
6361
echo "::notice title=SonarCloud skipped::SONAR_TOKEN is not configured; skipping advisory analysis."
6462
echo "enabled=false" >> "$GITHUB_OUTPUT"
@@ -82,18 +80,13 @@ jobs:
8280
set -euo pipefail
8381
resolved=""
8482
if [[ -f .tool-versions ]]; then
85-
# Validate only real "<plugin> <version>" lines; asdf allows # comments (SPDX/REUSE) and blank lines.
8683
if grep -vE '^[[:space:]]*(#|$)' .tool-versions | grep -qvE '^[a-zA-Z0-9_-]+ [a-zA-Z0-9._+-]+$'; then
8784
echo "::error title=Invalid tool-versions::${WORKING_DIRECTORY}/.tool-versions is malformed."
8885
exit 1
8986
fi
90-
# Emit only the governed golang pin so asdf ignores project extra pins (e.g. kind).
9187
resolved="$(grep -E '^golang ' .tool-versions || true)"
9288
fi
9389
if [[ -z "$resolved" ]]; then
94-
# No committed golang pin: derive it from the module's own go directive so the
95-
# governed lane follows the product's declared toolchain instead of failing or
96-
# clamping it. A committed pin always wins over the derived one.
9790
if [[ ! -f go.mod ]]; then
9891
echo "::error title=Missing go toolchain::${WORKING_DIRECTORY} has no golang pin in .tool-versions and no go.mod to derive one from."
9992
exit 1
@@ -106,7 +99,6 @@ jobs:
10699
echo "::error title=Missing go toolchain::${WORKING_DIRECTORY}/go.mod declares no usable go version."
107100
exit 1
108101
fi
109-
# asdf installs an exact patch release; a two-part directive (go 1.21) means .0.
110102
if [[ "$version" != *.*.* ]]; then
111103
version="${version}.0"
112104
fi
@@ -132,8 +124,6 @@ jobs:
132124
shell: bash
133125
run: |
134126
set -euo pipefail
135-
# Advisory coverage: emit a standard Go coverage profile for Sonar. A module
136-
# without tests still gets a static analysis, so coverage generation never blocks.
137127
go test -covermode=atomic -coverprofile=coverage.out ./... \
138128
|| echo "::warning title=Coverage unavailable::go test produced no coverage profile; Sonar will analyze without coverage."
139129

‎.github/workflows/codeql.yml‎

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ concurrency:
2222

2323
env:
2424
WORKING_DIRECTORY: ${{ vars.WORKING_DIRECTORY }}
25+
COMPONENT_DESCRIPTOR: .github/inditextech-ci-go.json
2526
ASDF_BRANCH_VERSION: '0.18.0'
2627

2728
jobs:
28-
# Resolves code-scanning availability at runtime so the analysis skips cleanly (green) where no Advanced Security seat is licensed, and starts automatically once a repository becomes public or gains a seat.
2929
scanning-availability:
3030
name: Resolve code scanning availability
3131
if: >-
@@ -48,29 +48,27 @@ jobs:
4848
)
4949
runs-on: ubuntu-24.04
5050
permissions:
51-
contents: read # Reads repository metadata to resolve availability.
51+
contents: read
5252
outputs:
5353
enabled: ${{ steps.resolve.outputs.enabled }}
5454
steps:
5555
- name: Resolve availability
5656
id: resolve
5757
env:
5858
GH_TOKEN: ${{ github.token }}
59-
# Manual opt-in (CODE_SCANNING_ENABLED='true') for a seated private/internal repository whose seat status the workflow token cannot read.
6059
FORCE_ENABLED: ${{ vars.CODE_SCANNING_ENABLED }}
6160
run: |
6261
set -euo pipefail
63-
# Visibility is always readable; the security-and-analysis block is admin-token-only, so treat a missing value as unknown.
6462
visibility="$(gh api "/repos/${GITHUB_REPOSITORY}" --jq '.visibility' 2>/dev/null || echo unknown)"
6563
seat="$(gh api "/repos/${GITHUB_REPOSITORY}" \
6664
--jq '.security_and_analysis.advanced_security.status // "unknown"' 2>/dev/null || echo unknown)"
6765
enabled=false
6866
if [ "${visibility}" = "public" ]; then
69-
enabled=true # Code scanning is always free and available on public repositories.
67+
enabled=true
7068
elif [ "${seat}" = "enabled" ]; then
71-
enabled=true # A Code Security seat is attached, so analysis is licensed.
69+
enabled=true
7270
elif [ "${FORCE_ENABLED:-}" = "true" ]; then
73-
enabled=true # Operator opted this repository in explicitly.
71+
enabled=true
7472
fi
7573
echo "Code scanning availability: visibility=${visibility} seat=${seat} enabled=${enabled}"
7674
echo "enabled=${enabled}" >> "${GITHUB_OUTPUT}"
@@ -81,20 +79,16 @@ jobs:
8179
if: needs.scanning-availability.outputs.enabled == 'true'
8280
runs-on: ubuntu-24.04
8381
permissions:
84-
actions: read # Lets CodeQL inspect workflow metadata.
82+
actions: read
8583
contents: read
86-
packages: read # Lets CodeQL resolve package metadata during analysis.
87-
security-events: write # Uploads CodeQL results to Code Scanning.
84+
packages: read
85+
security-events: write
8886
strategy:
8987
fail-fast: false
9088
matrix:
9189
include:
9290
- language: actions
9391
build-mode: none
94-
# Go has no buildless extractor: CodeQL supports build-mode 'none' only for
95-
# C/C++, C#, Java, and Rust. Go is analyzed with build-mode 'autobuild', which
96-
# compiles the module during init and therefore needs the governed toolchain on
97-
# PATH (set up conditionally below before Initialize CodeQL).
9892
- language: go
9993
build-mode: autobuild
10094
steps:
@@ -103,6 +97,28 @@ jobs:
10397
with:
10498
persist-credentials: false
10599

100+
- name: Resolve governed working directory
101+
if: matrix.language == 'go'
102+
shell: bash
103+
run: |
104+
set -euo pipefail
105+
if [[ ! -f "$COMPONENT_DESCRIPTOR" ]]; then
106+
echo "::error title=Missing descriptor::${COMPONENT_DESCRIPTOR} not found."
107+
exit 1
108+
fi
109+
workdir="${WORKING_DIRECTORY:-$(jq -r '.working_directory // empty' "$COMPONENT_DESCRIPTOR")}"
110+
case "$workdir" in
111+
""|/*|..|../*|*/..|*/../*)
112+
echo "::error title=Invalid working directory::WORKING_DIRECTORY must be a non-empty relative repository path." >&2
113+
exit 1
114+
;;
115+
esac
116+
if [[ ! -d "$workdir" ]]; then
117+
echo "::error title=Missing working directory::'${workdir}' is not a directory in this checkout." >&2
118+
exit 1
119+
fi
120+
echo "WORKING_DIRECTORY=${workdir}" >> "$GITHUB_ENV"
121+
106122
- name: Read governed tool versions
107123
id: tool-versions
108124
if: matrix.language == 'go'
@@ -112,18 +128,13 @@ jobs:
112128
set -euo pipefail
113129
resolved=""
114130
if [[ -f .tool-versions ]]; then
115-
# Validate only real "<plugin> <version>" lines; asdf allows # comments (SPDX/REUSE) and blank lines.
116131
if grep -vE '^[[:space:]]*(#|$)' .tool-versions | grep -qvE '^[a-zA-Z0-9_-]+ [a-zA-Z0-9._+-]+$'; then
117132
echo "::error title=Invalid tool-versions::${WORKING_DIRECTORY}/.tool-versions is malformed."
118133
exit 1
119134
fi
120-
# Emit only the governed golang pin so asdf ignores project extra pins (e.g. kind).
121135
resolved="$(grep -E '^golang ' .tool-versions || true)"
122136
fi
123137
if [[ -z "$resolved" ]]; then
124-
# No committed golang pin: derive it from the module's own go directive so the
125-
# governed lane follows the product's declared toolchain instead of failing or
126-
# clamping it. A committed pin always wins over the derived one.
127138
if [[ ! -f go.mod ]]; then
128139
echo "::error title=Missing go toolchain::${WORKING_DIRECTORY} has no golang pin in .tool-versions and no go.mod to derive one from."
129140
exit 1
@@ -136,7 +147,6 @@ jobs:
136147
echo "::error title=Missing go toolchain::${WORKING_DIRECTORY}/go.mod declares no usable go version."
137148
exit 1
138149
fi
139-
# asdf installs an exact patch release; a two-part directive (go 1.21) means .0.
140150
if [[ "$version" != *.*.* ]]; then
141151
version="${version}.0"
142152
fi
@@ -150,8 +160,6 @@ jobs:
150160
} >> "$GITHUB_OUTPUT"
151161
152162
- name: Set up asdf-managed Go
153-
# autobuild compiles the module during Initialize CodeQL, so the governed Go
154-
# toolchain must already be on PATH; the actions language needs no toolchain.
155163
if: matrix.language == 'go'
156164
uses: asdf-vm/actions/install@b7bcd026f18772e44fe1026d729e1611cc435d47 # v4.0.1
157165
with:

‎.github/workflows/pr-verify.yml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
timeout-minutes: 10
2020
permissions:
2121
contents: read
22-
checks: write # Lets reviewdog publish actionlint check results.
2322
steps:
2423
- name: Checkout
2524
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -31,7 +30,7 @@ jobs:
3130
- name: Lint GitHub Actions workflows
3231
uses: reviewdog/action-actionlint@2085657ab2c7f48c58edcc767fba576f63bea76b # v1.77.0
3332
with:
34-
reporter: github-pr-check
33+
reporter: github-annotations
3534
fail_level: error
3635

3736
repo-linter:
@@ -66,6 +65,15 @@ jobs:
6665

6766
conventional-commits:
6867
name: Conventional Commits
68+
if: >-
69+
!(
70+
github.event.pull_request.head.repo.full_name == github.repository &&
71+
github.event.pull_request.user.login == 'inditextechbot[bot]' &&
72+
(
73+
github.head_ref == 'automated/sync-from-main-to-develop' ||
74+
startsWith(github.head_ref, 'automated/sync-release-')
75+
)
76+
)
6977
runs-on: ubuntu-24.04
7078
timeout-minutes: 10
7179
steps:

‎.github/workflows/push-verify.yml‎

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
timeout-minutes: 10
2323
permissions:
2424
contents: read
25-
checks: write # Lets reviewdog publish actionlint check results.
2625
steps:
2726
- name: Checkout
2827
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -32,56 +31,9 @@ jobs:
3231
- name: Lint GitHub Actions workflows
3332
uses: reviewdog/action-actionlint@2085657ab2c7f48c58edcc767fba576f63bea76b # v1.77.0
3433
with:
35-
reporter: github-check
34+
reporter: github-annotations
3635
fail_level: error
3736

38-
scorecard-analysis:
39-
if: >-
40-
github.ref_type == 'branch' &&
41-
github.event.repository.visibility == 'public' &&
42-
github.ref_name == github.event.repository.default_branch
43-
name: Scorecard analysis
44-
runs-on: ubuntu-24.04
45-
timeout-minutes: 20
46-
permissions:
47-
contents: read
48-
id-token: write # Lets Scorecard prove the published result's provenance.
49-
security-events: write # Uploads the generated Scorecard SARIF to Code Scanning.
50-
steps:
51-
- name: "Checkout code"
52-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53-
with:
54-
fetch-depth: 0
55-
persist-credentials: false
56-
57-
- name: "Run analysis"
58-
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
59-
with:
60-
results_file: results.sarif
61-
results_format: sarif
62-
# Scorecard team runs a weekly scan of public GitHub repos,
63-
# see https://github.com/ossf/scorecard#public-data.
64-
# Setting `publish_results: true` helps us scale by leveraging your workflow to
65-
# extract the results instead of relying on our own infrastructure to run scans.
66-
# And it's free for you!
67-
publish_results: true
68-
69-
# Upload the results as artifacts (optional). Commenting out will disable
70-
# uploads of run results in SARIF format to the repository Actions tab.
71-
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
72-
- name: "Upload artifact"
73-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
74-
with:
75-
name: SARIF file
76-
path: results.sarif
77-
retention-days: 5
78-
79-
- name: Upload SARIF to Code Scanning
80-
uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
81-
with:
82-
sarif_file: results.sarif
83-
category: scorecard
84-
8537
repo-linter:
8638
if: >-
8739
github.ref_type == 'branch' &&

0 commit comments

Comments
 (0)