Skip to content

Commit 069ec09

Browse files
BUILD-10591 Leverage JFrog CLI summary in build-npm, build-yarn, build-poetry and promote
Generate the JFrog CLI job summary explicitly rather than relying on the setup-jfrog-cli post-step, which fails and conflicts with the CLI. **JFrog CLI configuration fixes (build-npm, build-yarn, build-poetry, config-npm, promote)**: - Add --url flag to 'jf config add repox' with the JFrog Platform URL (base URL without '/artifactory') - Add 'jf config use repox' (or 'deploy' for maven) after 'jf config add' to explicitly activate the server configuration - In promote.sh and build scripts, suppress 'jf config remove repox' output (redirect to /dev/null) - Make ARTIFACTORY_URL required (via :?) in promote.sh **JFrog CLI command summary (all build actions + promote)**: - Set JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR in build step env so JFrog CLI writes command summary data during execution - build-maven/deploy-artifacts.sh: also set JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR in the Artifacts upload step **Generate workflow summary (all build actions)**: - Merge JFrog CLI summary generation into 'Generate workflow summary' step (remove the separate 'Generate JFrog CLI summary' step) - Add JFrog summary support to build-maven (when mixed-privacy=true, using 'jf config use deploy') and build-gradle - Rework summary format: extract Published Modules from JFrog markdown.md (bold module names and multi-line <pre> file tree blocks) into a collapsible <details> block - Change build URL link text from 'Browse artifacts in Artifactory' to 'Browse build `name:number` in Artifactory' **promote/action.yml**: - Add repox-url and repox-artifactory-url inputs (forwarded from callers) - Add ARTIFACTORY_URL env var to the Promote artifacts step **Other**: - Upgrade renovatebot/pre-commit-hooks to 43.76.3 in .pre-commit-config.yaml - Fix trailing spaces in deprecation warning messages (cache/action.yml, config-npm/action.yml, build-npm/action.yml, build-yarn/action.yml) - Minor doc fix in build-maven/build.sh and promote/promote.sh - Update spec tests to match new command signatures and line counts (100% coverage) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9014b55 commit 069ec09

29 files changed

Lines changed: 215 additions & 91 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
hooks:
3131
- id: markdownlint
3232
- repo: https://github.com/renovatebot/pre-commit-hooks
33-
rev: 731b86757c909f5eb4753ce1e743c64bd18f5ea8 # 37.418.1
33+
rev: 99eaa5b893df4f917fe21b5705cc42f28cb3d842 # 43.76.3
3434
hooks:
3535
- id: renovate-config-validator
3636
- repo: https://github.com/rhysd/actionlint

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,13 +1227,15 @@ promote:
12271227

12281228
### Inputs
12291229

1230-
| Input | Description | Default |
1231-
|---------------------------|---------------------------------------------------------------------------------------------------------------------------|---------------------|
1232-
| `promote-pull-request` | Whether to promote pull request artifacts. Requires `deploy-pull-request` input to be set to `true` in the build action | `false` |
1233-
| `multi-repo` | If true, promotes to public and private repositories. For projects with both public and private artifacts | (optional) |
1234-
| `artifactory-deploy-repo` | Repository to deploy to. If not set, it will be retrieved from the build info | (optional) |
1235-
| `artifactory-target-repo` | Target repository for the promotion. If not set, it will be determined based on the branch type and the deploy repository | (optional) |
1236-
| `build-name` | Name of the JFrog build to promote. | `<Repository name>` |
1230+
| Input | Description | Default |
1231+
|---------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------------------|
1232+
| `repox-url` | URL for Repox | `https://repox.jfrog.io` |
1233+
| `repox-artifactory-url` | URL for Repox Artifactory API (overrides repox-url/artifactory if provided) | (optional) |
1234+
| `promote-pull-request` | Whether to promote pull request artifacts. Requires `deploy-pull-request` input to be set to `true` in the build action | `false` |
1235+
| `multi-repo` | If true, promotes to public and private repositories. For projects with both public and private artifacts | (optional) |
1236+
| `artifactory-deploy-repo` | Repository to deploy to. If not set, it will be retrieved from the build info | (optional) |
1237+
| `artifactory-target-repo` | Target repository for the promotion. If not set, it will be determined based on the branch type and the deploy repository | (optional) |
1238+
| `build-name` | Name of the JFrog build to promote. | `<Repository name>` |
12371239

12381240
### Outputs
12391241

build-gradle/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ runs:
121121
(github.event.repository.visibility == 'public' && 'public-deployer' || 'qa-deployer') }}
122122
run: |
123123
echo "ARTIFACTORY_DEPLOYER_ROLE=${ARTIFACTORY_DEPLOYER_ROLE}" >> "$GITHUB_ENV"
124+
124125
- uses: SonarSource/vault-action-wrapper@3d5c87cb535e4a2c7a09adcbcfdefa751854dee3 # 3.3.0
125126
id: secrets
126127
with:
@@ -199,7 +200,7 @@ runs:
199200
shell: bash
200201
run: |
201202
build_name="${GITHUB_REPOSITORY#*/}"
202-
echo "## 🏗 Gradle Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
203+
echo "## 🏗 Gradle Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
203204
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
204205
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
205206
else
@@ -215,5 +216,5 @@ runs:
215216
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
216217
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
217218
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
218-
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY
219+
echo "🐸 [Browse build \`${build_name}:${BUILD_NUMBER}\` in Artifactory](${ARTIFACTORY_BROWSE_URL})" >> $GITHUB_STEP_SUMMARY
219220
fi

build-maven/action.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ runs:
212212
ARTIFACTORY_PRIVATE_DEPLOY_REPO: ${{ steps.params.outputs.ARTIFACTORY_PRIVATE_DEPLOY_REPO }}
213213
ARTIFACTORY_PRIVATE_DEPLOY_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ARTIFACTORY_PRIVATE_DEPLOY_ACCESS_TOKEN }}
214214
INSTALLED_ARTIFACTS: ${{ steps.build.outputs.installed-artifacts }}
215+
JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR: ${{ runner.temp }}/jfrog-summary
215216
run: $ACTION_PATH_BUILD_MAVEN/deploy-artifacts.sh
216217

217218
- name: Cleanup Maven repository before caching
@@ -235,9 +236,13 @@ runs:
235236
- name: Generate workflow summary
236237
if: always() && inputs.generate-summary != 'false'
237238
shell: bash
239+
env:
240+
ARTIFACTORY_URL: ${{ inputs.repox-artifactory-url != '' && inputs.repox-artifactory-url ||
241+
format('{0}/artifactory', inputs.repox-url) }}
242+
JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR: ${{ runner.temp }}/jfrog-summary
238243
run: |
239244
build_name="${GITHUB_REPOSITORY#*/}"
240-
echo "## 🏗 Maven Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
245+
echo "## 🏗 Maven Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
241246
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
242247
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
243248
else
@@ -253,5 +258,22 @@ runs:
253258
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
254259
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
255260
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
256-
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY
261+
echo "🐸 [Browse build \`${build_name}:${BUILD_NUMBER}\` in Artifactory](${ARTIFACTORY_BROWSE_URL})" >> $GITHUB_STEP_SUMMARY
262+
jf_summary_dir="${JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR}/jfrog-command-summary"
263+
if [[ -d "$jf_summary_dir" ]]; then
264+
jf config use deploy
265+
jf generate-summary-markdown
266+
if [[ -f "${jf_summary_dir}/markdown.md" ]]; then
267+
{
268+
echo ""
269+
echo "<details>"
270+
echo "<summary>Published Modules</summary>"
271+
echo ""
272+
grep -E '^\*\*[^*]+\*\*$' "${jf_summary_dir}/markdown.md" | sed 's/^\*\*\(.*\)\*\*$/- `\1`/'
273+
echo ""
274+
awk 'index($0,"<pre>") && !index($0,"</pre>"){p=1} p{print} index($0,"</pre>"){p=0}' "${jf_summary_dir}/markdown.md"
275+
echo "</details>"
276+
} >> "$GITHUB_STEP_SUMMARY"
277+
fi
278+
fi
257279
fi

build-maven/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# - SQC_EU_URL: URL of SonarQube server for sqc-eu platform
1313
# - SQC_EU_TOKEN: Access token to send analysis reports to SonarQube for sqc-eu platform
1414
# - RUN_SHADOW_SCANS: If true, run sonar scanner on all 3 platforms. If false, run on the platform provided by SONAR_PLATFORM.
15-
# - ARTIFACTORY_URL: Artifactory repository URL
15+
# - ARTIFACTORY_URL: URL to Artifactory repository
1616
# - ARTIFACTORY_ACCESS_TOKEN: Access token to read Repox repositories
1717
# - ARTIFACTORY_DEPLOY_REPO: Deployment repository name. Required by maven-enforcer-plugin in SonarSource parent POM.
1818
# - ARTIFACTORY_DEPLOY_USERNAME: Username used by artifactory-maven-plugin

build-maven/deploy-artifacts.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ build_name="${GITHUB_REPOSITORY#*/}"
3232
pushd "$MAVEN_CONFIG/repository"
3333

3434
echo "::group::Configure JFrog deployment"
35-
jfrog config add deploy --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_DEPLOY_ACCESS_TOKEN"
36-
jfrog config use deploy
35+
jf config add deploy --url "${ARTIFACTORY_URL%artifactory/}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_DEPLOY_ACCESS_TOKEN"
36+
jf config use deploy
3737
echo "::endgroup::"
3838

3939
echo "::group::Deploy public artifacts"
4040
echo "Deploying public artifacts..."
4141
for artifact in "${public_artifacts[@]}"; do
42-
jfrog rt u --build-name "$build_name" --build-number "$BUILD_NUMBER" "$artifact" "${ARTIFACTORY_DEPLOY_REPO}"
42+
jf rt u --build-name "$build_name" --build-number "$BUILD_NUMBER" "$artifact" "${ARTIFACTORY_DEPLOY_REPO}"
4343
done
4444
echo "::endgroup::"
4545

4646
echo "::group::Deploy private artifacts"
4747
echo "Deploying private artifacts..."
48-
jfrog config edit deploy --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_PRIVATE_DEPLOY_ACCESS_TOKEN"
48+
jf config edit deploy --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_PRIVATE_DEPLOY_ACCESS_TOKEN"
4949
for artifact in "${private_artifacts[@]}"; do
50-
jfrog rt u --build-name "$build_name" --build-number "$BUILD_NUMBER" "$artifact" "${ARTIFACTORY_PRIVATE_DEPLOY_REPO}"
50+
jf rt u --build-name "$build_name" --build-number "$BUILD_NUMBER" "$artifact" "${ARTIFACTORY_PRIVATE_DEPLOY_REPO}"
5151
done
5252
echo "::endgroup::"
5353

build-npm/action.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ runs:
110110
echo "ARTIFACTORY_DEPLOYER_ROLE=${ARTIFACTORY_DEPLOYER_ROLE}" >> "$GITHUB_ENV"
111111
cp "$ACTION_PATH_BUILD_NPM/mise.local.toml" mise.local.toml
112112
if [[ "$CACHE_NPM" != "true" ]]; then
113-
echo "::warning::The \`cache-npm\` input is deprecated and will be removed in future releases. " \
113+
echo "::warning::The \`cache-npm\` input is deprecated and will be removed in future releases." \
114114
"Use \`disable-caching\` instead." >&2
115115
fi
116116
@@ -168,6 +168,8 @@ runs:
168168
SQC_EU_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SQC_EU_TOKEN }}
169169
SQC_US_URL: ${{ fromJSON(steps.secrets.outputs.vault).SQC_US_URL }}
170170
SQC_US_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SQC_US_TOKEN }}
171+
JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR: ${{ runner.temp }}/jfrog-summary
172+
# JFROG_CLI_GITHUB_TOKEN:
171173
working-directory: ${{ inputs.working-directory }}
172174
run: $ACTION_PATH_BUILD_NPM/build.sh
173175

@@ -197,9 +199,10 @@ runs:
197199
env:
198200
ARTIFACTORY_URL: ${{ inputs.repox-artifactory-url != '' && inputs.repox-artifactory-url ||
199201
format('{0}/artifactory', inputs.repox-url) }}
202+
JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR: ${{ runner.temp }}/jfrog-summary
200203
run: |
201204
build_name="${GITHUB_REPOSITORY#*/}"
202-
echo "## 📦 NPM Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
205+
echo "## 🏗 NPM Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
203206
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
204207
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
205208
else
@@ -215,5 +218,22 @@ runs:
215218
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
216219
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
217220
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
218-
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY
221+
echo "🐸 [Browse build \`${build_name}:${BUILD_NUMBER}\` in Artifactory](${ARTIFACTORY_BROWSE_URL})" >> $GITHUB_STEP_SUMMARY
222+
jf_summary_dir="${JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR}/jfrog-command-summary"
223+
if [[ -d "$jf_summary_dir" ]]; then
224+
jf config use repox
225+
jf generate-summary-markdown
226+
if [[ -f "${jf_summary_dir}/markdown.md" ]]; then
227+
{
228+
echo ""
229+
echo "<details>"
230+
echo "<summary>Published Modules</summary>"
231+
echo ""
232+
grep -E '^\*\*[^*]+\*\*$' "${jf_summary_dir}/markdown.md" | sed 's/^\*\*\(.*\)\*\*$/- `\1`/'
233+
echo ""
234+
awk 'index($0,"<pre>") && !index($0,"</pre>"){p=1} p{print} index($0,"</pre>"){p=0}' "${jf_summary_dir}/markdown.md"
235+
echo "</details>"
236+
} >> "$GITHUB_STEP_SUMMARY"
237+
fi
238+
fi
219239
fi

build-npm/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ sonar_scanner_implementation() {
100100
jfrog_npm_publish() {
101101
echo "Configuring JFrog and NPM repositories..."
102102
jf config remove repox > /dev/null 2>&1 || true # Ignore inexistent configuration
103-
jf config add repox --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_DEPLOY_ACCESS_TOKEN"
103+
jf config add repox --url "${ARTIFACTORY_URL%artifactory/}" --artifactory-url "$ARTIFACTORY_URL" --access-token "$ARTIFACTORY_DEPLOY_ACCESS_TOKEN"
104+
jf config use repox
104105
jf npm-config --repo-resolve "npm" --repo-deploy "$ARTIFACTORY_DEPLOY_REPO"
105106

106107
export PROJECT="${GITHUB_REPOSITORY#*/}"

build-npm/mise.local.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[tools]
2-
jfrog-cli = "2.77.0"
2+
jfrog-cli = "2.96.0"
33
jq = "1.8.1"
4+
5+
[env]
6+
JFROG_CLI_AVOID_NEW_VERSION_WARNING = "true"
7+
JFROG_CLI_ENV_EXCLUDE = "*password*;*secret*;*key*;*token*;*auth*;*credential*"

build-poetry/action.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ runs:
105105
echo "ARTIFACTORY_READER_ROLE=${ARTIFACTORY_READER_ROLE}" >> "$GITHUB_ENV"
106106
echo "ARTIFACTORY_DEPLOYER_ROLE=${ARTIFACTORY_DEPLOYER_ROLE}" >> "$GITHUB_ENV"
107107
cp "$ACTION_PATH_BUILD_POETRY/mise.local.toml" mise.local.toml
108+
108109
- uses: ./.actions/get-build-number
109110
id: get_build_number
110111
with:
@@ -164,6 +165,7 @@ runs:
164165
SQC_US_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SQC_US_TOKEN }}
165166
SONAR_PLATFORM: ${{ inputs.sonar-platform }}
166167
RUN_SHADOW_SCANS: ${{ inputs.run-shadow-scans }}
168+
JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR: ${{ runner.temp }}/jfrog-summary
167169
run: |
168170
cd "${{ inputs.working-directory }}"
169171
"$ACTION_PATH_BUILD_POETRY/build.sh"
@@ -186,9 +188,10 @@ runs:
186188
env:
187189
ARTIFACTORY_URL: ${{ inputs.repox-artifactory-url != '' && inputs.repox-artifactory-url ||
188190
format('{0}/artifactory', inputs.repox-url) }}
191+
JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR: ${{ runner.temp }}/jfrog-summary
189192
run: |
190193
build_name="${GITHUB_REPOSITORY#*/}"
191-
echo "## 📦 Poetry Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
194+
echo "## 🏗 Poetry Build Summary (\`${GITHUB_JOB}\`)" >> $GITHUB_STEP_SUMMARY
192195
if [[ "${{ steps.build.conclusion }}" == "success" ]]; then
193196
echo "✅ **Build SUCCESS**" >> $GITHUB_STEP_SUMMARY
194197
else
@@ -204,5 +207,22 @@ runs:
204207
if [[ "${{ steps.build.outputs.deployed }}" == true ]]; then
205208
echo "### 🚀 Deployment" >> $GITHUB_STEP_SUMMARY
206209
ARTIFACTORY_BROWSE_URL="${ARTIFACTORY_URL%/*}/ui/builds/$build_name/$BUILD_NUMBER"
207-
echo "🔗 **[Browse artifacts in Artifactory](${ARTIFACTORY_BROWSE_URL})**" >> $GITHUB_STEP_SUMMARY
210+
echo "🐸 [Browse build \`${build_name}:${BUILD_NUMBER}\` in Artifactory](${ARTIFACTORY_BROWSE_URL})" >> $GITHUB_STEP_SUMMARY
211+
jf_summary_dir="${JFROG_CLI_COMMAND_SUMMARY_OUTPUT_DIR}/jfrog-command-summary"
212+
if [[ -d "$jf_summary_dir" ]]; then
213+
jf config use repox
214+
jf generate-summary-markdown
215+
if [[ -f "${jf_summary_dir}/markdown.md" ]]; then
216+
{
217+
echo ""
218+
echo "<details>"
219+
echo "<summary>Published Modules</summary>"
220+
echo ""
221+
grep -E '^\*\*[^*]+\*\*$' "${jf_summary_dir}/markdown.md" | sed 's/^\*\*\(.*\)\*\*$/- `\1`/'
222+
echo ""
223+
awk 'index($0,"<pre>") && !index($0,"</pre>"){p=1} p{print} index($0,"</pre>"){p=0}' "${jf_summary_dir}/markdown.md"
224+
echo "</details>"
225+
} >> "$GITHUB_STEP_SUMMARY"
226+
fi
227+
fi
208228
fi

0 commit comments

Comments
 (0)