Skip to content

Commit f0e0396

Browse files
spboltonclaude
andcommitted
fix(ci): fix manual deploy invalid inputs and improve CI/CD tag architecture (#34689)
- Fix cicd_8-manual-deploy: use change-detection='disabled' instead of invalid validation-level='none'; make ref input optional (defaults to dispatch branch, preserving legacy behavior) - Redesign Docker tag architecture: add semantic identifier-tag/custom-tag inputs to deploy-docker action, replacing raw type=raw,value=...,enable= format strings passed from callers - Centralize tag computation in Compute Docker Tags step (replaces Compute Docker Base Tag + raw extra-tags); identifier alias logic is now clear bash if/else instead of enable= expressions in format strings - extra-tags retained as escape hatch for advanced cases - Fix tag ordering: identifier before suffix (nightly_20250218_java25, not nightly_java25_20250218), consistent with release pattern - Remove dead code: reuse-previous-build from deployment phase calls (only meaningful in initialize phase) - Add run-name to all CI/CD workflows (cicd_1 through cicd_8) for better identification in GitHub Actions UI; uses format() now confirmed available - Fix cicd_8 concurrency group to use fallback when ref input is empty Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8889252 commit f0e0396

9 files changed

Lines changed: 418 additions & 125 deletions

File tree

.github/actions/core-cicd/deployment/deploy-docker/action.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ inputs:
2222
description: 'The commit id that triggered the build'
2323
required: true
2424
ref:
25-
description: 'The branch or type of build to tag the image with'
26-
required: true
25+
description: 'The branch or type of build to tag the image with. Only used when docker-use-ref is true; when docker-use-ref is false the version input drives all tags and this is ignored.'
26+
required: false
27+
default: ''
2728
docker-use-ref:
2829
description: 'The branch or type of build to tag the image with'
2930
required: false
@@ -65,6 +66,18 @@ inputs:
6566
description: 'Pull image before building'
6667
required: false
6768
default: 'false'
69+
identifier-tag:
70+
description: 'Optional mutable alias tag managed by the deployment phase (e.g., nightly_20250218_java25, manual_issue-123_java25). Applied when non-empty.'
71+
required: false
72+
default: ''
73+
custom-tag:
74+
description: 'Optional custom alias tag chosen by the developer (e.g., modernization, java25-testing). Applied when non-empty.'
75+
required: false
76+
default: ''
77+
extra-tags:
78+
description: 'Escape hatch: additional tags in docker/metadata-action format (type=raw,value=...), one per line. Use for cases not covered by identifier-tag or custom-tag.'
79+
required: false
80+
default: ''
6881
outputs:
6982
tags:
7083
description: "The tags that were used to build the image"
@@ -104,6 +117,9 @@ runs:
104117
REF: ${{ inputs.ref }}
105118
USE_REF: ${{ inputs.docker-use-ref }}
106119
VERSION: ${{ inputs.version }}
120+
IDENTIFIER_TAG: ${{ inputs.identifier-tag }}
121+
CUSTOM_TAG: ${{ inputs.custom-tag }}
122+
EXTRA_TAGS: ${{ inputs.extra-tags }}
107123
run: |
108124
109125
# Set defaults for flags
@@ -137,6 +153,13 @@ runs:
137153
echo "type=raw,value=${RESULT}_{{sha}},enable=true" >> $GITHUB_ENV
138154
echo "type=raw,value=${RESULT},enable=true" >> $GITHUB_ENV
139155
echo "type=raw,value=latest,enable=${enable_latest}" >> $GITHUB_ENV
156+
[[ -n "${IDENTIFIER_TAG}" ]] && echo "type=raw,value=${IDENTIFIER_TAG},enable=true" >> $GITHUB_ENV
157+
[[ -n "${CUSTOM_TAG}" ]] && echo "type=raw,value=${CUSTOM_TAG},enable=true" >> $GITHUB_ENV
158+
if [[ -n "${EXTRA_TAGS}" ]]; then
159+
while IFS= read -r tag_line; do
160+
[[ -n "${tag_line}" ]] && echo "${tag_line}" >> $GITHUB_ENV
161+
done <<< "${EXTRA_TAGS}"
162+
fi
140163
echo "EOF" >> $GITHUB_ENV
141164
- name: Docker.io login
142165
uses: docker/login-action@v3.0.0

.github/workflows/cicd_1-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121

2222
name: '-1 PR Check'
23+
run-name: 'PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }} (@${{ github.event.pull_request.user.login }})'
2324

2425
on:
2526
pull_request:

.github/workflows/cicd_2-merge-queue.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: '-2 Merge Group Check'
2+
run-name: 'MQ: ${{ github.event.merge_group.head_commit.message }}'
23
on:
34
merge_group:
45
types: [ checks_requested ]

.github/workflows/cicd_3-trunk.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# - Final reporting of the workflow status
1212

1313
name: '-3 Trunk Workflow'
14+
run-name: 'Trunk${{ inputs.java-version && format(" [{0}]", inputs.java-version) || "" }}'
1415

1516
on:
1617
push:
@@ -131,6 +132,7 @@ jobs:
131132
artifact-run-id: ${{ needs.initialize.outputs.artifact-run-id }}
132133
publish-npm-sdk-libs: ${{ fromJSON(needs.initialize.outputs.filters).sdk_libs == 'true' && github.event_name != 'workflow_dispatch' }}
133134
environment: trunk
135+
# tag-identifier intentionally omitted: trunk uses only the environment name as its tag
134136
java-version: ${{ github.event.inputs.java-version || '' }}
135137
artifact-suffix: ${{ github.event.inputs.artifact-suffix || '' }}
136138
secrets:

.github/workflows/cicd_4-nightly.yml

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@
1010
# - Optional NPM package publishing
1111
# - Deployment to the nightly environment
1212
# - Final reporting of the workflow status
13+
#
14+
# Commit pinning:
15+
# - Default (both scheduled and manual dispatch): builds from the last commit on main
16+
# at or before midnight UTC. This ensures repeatability — manually re-running the
17+
# nightly later in the day to investigate a failure produces the same build.
18+
# The date tag (nightly_YYYYMMDD) correctly labels the day covered, not the run day.
19+
# - Manual dispatch with use-latest-commit=true: builds from current HEAD of main,
20+
# useful when you want to pick up commits made after midnight.
1321

1422
name: '-4 Nightly Workflow'
23+
run-name: 'Nightly${{ inputs.use-latest-commit && " (HEAD)" || "" }}${{ inputs.java-version && format(" [{0}]", inputs.java-version) || "" }}'
1524

1625
on:
1726
schedule:
@@ -49,8 +58,57 @@ on:
4958
type: string
5059
required: false
5160
default: ''
61+
use-latest-commit:
62+
description: 'Use current HEAD of main instead of the midnight UTC commit. Set to true when you want to pick up commits made after midnight rather than reproduce the scheduled run.'
63+
type: boolean
64+
default: false
5265

5366
jobs:
67+
# Setup job - determines the commit to build from.
68+
# Default (scheduled and manual): last commit on main at or before midnight UTC for repeatability.
69+
# Manual with use-latest-commit=true: current HEAD of main.
70+
setup:
71+
name: Setup
72+
runs-on: ubuntu-${{ vars.UBUNTU_RUNNER_VERSION || '24.04' }}
73+
outputs:
74+
build-ref: ${{ steps.find-commit.outputs.build-ref }}
75+
tag-date: ${{ steps.find-commit.outputs.tag-date }}
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
fetch-depth: 0
80+
ref: main
81+
82+
- name: Find Build Commit
83+
id: find-commit
84+
run: |
85+
if [[ "${{ inputs.use-latest-commit }}" == "true" ]]; then
86+
# Explicit override: use current HEAD of main.
87+
# Useful when you want to pick up commits made after midnight.
88+
BUILD_REF=$(git rev-parse HEAD)
89+
TAG_DATE=$(date -u +%Y%m%d)
90+
echo "use-latest-commit=true: building from current HEAD of main: ${BUILD_REF}"
91+
else
92+
# Default for both scheduled and manual dispatch: use the last commit
93+
# at or before midnight UTC. This ensures repeatability — manually
94+
# re-running later in the day to investigate a failure gives the same build.
95+
MIDNIGHT=$(date -u +"%Y-%m-%dT00:00:00")
96+
BUILD_REF=$(git log --before="${MIDNIGHT}" --format="%H" -1)
97+
if [[ -z "${BUILD_REF}" ]]; then
98+
# No commits before today's midnight — use the absolute last commit.
99+
# This handles edge cases (e.g., very new repos) without falling back to
100+
# current HEAD which might include post-midnight commits.
101+
BUILD_REF=$(git log --format="%H" -1)
102+
echo "⚠️ No commit found before ${MIDNIGHT}, using last available commit: ${BUILD_REF}"
103+
else
104+
echo "Building from commit at midnight UTC (${MIDNIGHT}): ${BUILD_REF}"
105+
fi
106+
# Tag with yesterday's date: the nightly covers the previous calendar day
107+
TAG_DATE=$(date -u -d "yesterday" +%Y%m%d)
108+
fi
109+
echo "build-ref=${BUILD_REF}" >> "$GITHUB_OUTPUT"
110+
echo "tag-date=${TAG_DATE}" >> "$GITHUB_OUTPUT"
111+
54112
# Initialize the nightly build process
55113
initialize:
56114
name: Initialize
@@ -64,10 +122,11 @@ jobs:
64122
# Build job - only runs if no artifacts were found during initialization
65123
build:
66124
name: Nightly Build
67-
needs: [ initialize ]
125+
needs: [ setup, initialize ]
68126
if: needs.initialize.outputs.found_artifacts == 'false'
69127
uses: ./.github/workflows/cicd_comp_build-phase.yml
70128
with:
129+
ref: ${{ needs.setup.outputs.build-ref }}
71130
java-version: ${{ github.event.inputs.java-version || '' }}
72131
maven-compiler-release: ${{ github.event.inputs.maven-compiler-release || '' }}
73132
artifact-suffix: ${{ github.event.inputs.artifact-suffix || '' }}
@@ -108,15 +167,15 @@ jobs:
108167

109168
# Deployment job - deploys to the nightly environment
110169
deployment:
111-
needs: [ initialize,build-cli,test ]
170+
needs: [ setup, initialize,build-cli,test ]
112171
if: always() && !failure() && !cancelled()
113172
uses: ./.github/workflows/cicd_comp_deployment-phase.yml
114173
with:
115174
artifact-run-id: ${{ needs.initialize.outputs.artifact-run-id }}
116175
environment: nightly
176+
tag-identifier: ${{ needs.setup.outputs.tag-date }}
117177
deploy-dev-image: true
118178
publish-npm-cli: ${{ ( github.event_name == 'workflow_dispatch' && inputs.publish-npm-cli == true ) || github.event_name == 'schedule' }}
119-
reuse-previous-build: ${{ inputs.reuse-previous-build || false }}
120179
java-version: ${{ github.event.inputs.java-version || '' }}
121180
artifact-suffix: ${{ github.event.inputs.artifact-suffix || '' }}
122181
secrets:
@@ -132,7 +191,7 @@ jobs:
132191
finalize:
133192
name: Finalize
134193
if: always()
135-
needs: [ initialize, build, build-cli, test, deployment ]
194+
needs: [ setup, initialize, build, build-cli, test, deployment ]
136195
uses: ./.github/workflows/cicd_comp_finalize-phase.yml
137196
with:
138197
artifact-run-id: ${{ needs.initialize.outputs.artifact-run-id }}

.github/workflows/cicd_6-release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#
1919

2020
name: '-6 Release Process'
21+
run-name: 'Release ${{ inputs.release_version }}${{ inputs.java-version && format(" [{0}]", inputs.java-version) || "" }}'
2122

2223
on:
2324
workflow_dispatch:
@@ -116,11 +117,12 @@ jobs:
116117
if: always() && !failure() && !cancelled()
117118
uses: ./.github/workflows/cicd_comp_deployment-phase.yml
118119
with:
119-
environment: ${{ needs.release-prepare.outputs.release_version }}
120+
environment: 'release'
121+
tag-identifier: ${{ needs.release-prepare.outputs.release_version }}
122+
omit-environment-prefix: true
120123
artifact-run-id: ${{ github.run_id }}
121124
latest: ${{ needs.release-prepare.outputs.is_latest == 'true' }}
122125
deploy-dev-image: true
123-
reuse-previous-build: false
124126
publish-npm-cli: false
125127
publish-npm-sdk-libs: false
126128
java-version: ${{ github.event.inputs.java-version }}

.github/workflows/cicd_7-release-java-variant.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#
2929

3030
name: '-7 Release Java Variant'
31+
run-name: 'Release Java Variant - ${{ github.event_name == ''workflow_dispatch'' && inputs.release_branch || github.ref_name }}${{ inputs.java_version && format(" [{0}]", inputs.java_version) || "" }}'
3132

3233
on:
3334
push:
@@ -100,7 +101,7 @@ jobs:
100101
needs: [ extract-version ]
101102
uses: ./.github/workflows/cicd_comp_initialize-phase.yml
102103
with:
103-
validation-level: 'none'
104+
change-detection: 'disabled' # Release builds everything - no change detection needed
104105

105106
# Build - standard build phase with Java version override
106107
build:
@@ -127,7 +128,9 @@ jobs:
127128
if: always() && !failure() && !cancelled()
128129
uses: ./.github/workflows/cicd_comp_deployment-phase.yml
129130
with:
130-
environment: ${{ needs.extract-version.outputs.version }}
131+
environment: 'release'
132+
tag-identifier: ${{ needs.extract-version.outputs.version }}
133+
omit-environment-prefix: true
131134
artifact-run-id: ${{ github.run_id }}
132135
deploy-dev-image: true
133136
java-version: ${{ github.event_name == 'workflow_dispatch' && inputs.java_version || vars.RELEASE_JAVA_VARIANT_VERSION }}

0 commit comments

Comments
 (0)