Skip to content

APP-4658 - Add path-mapping flags to version-promote and version-release#88

Merged
asafgabai merged 6 commits into
jfrog:mainfrom
danielreJfrog:feature/APP-4658-path-mapping-promote
Jun 21, 2026
Merged

APP-4658 - Add path-mapping flags to version-promote and version-release#88
asafgabai merged 6 commits into
jfrog:mainfrom
danielreJfrog:feature/APP-4658-path-mapping-promote

Conversation

@danielreJfrog

Copy link
Copy Markdown
Contributor

Summary

  • Add --map-in, --map-out, and --map-type flags to version-promote and version-release commands
  • Enable regex-based artifact path transformations during promotion/release operations
  • Mappings are forwarded as modifications.mappings in the request body to the Bundle Handler Service

Usage

# Single mapping
jf at version-promote my-app 1.0.0 PROD \
  --map-type=".*" --map-in="(.*)" --map-out="stable-release/$1"

# Multiple mappings (semicolon-separated)
jf at version-promote my-app 1.0.0 PROD \
  --map-in="(.*);(.*\.jar)" \
  --map-out="release/$1;jars/$1" \
  --map-type=".*;maven"

Changes

File Change
model/promote_app_version_request.go Add PromotionPathMapping, PromotionModifications types and Modifications field to CommonPromoteAppVersion
commands/flags.go Add --map-in, --map-out, --map-type flag definitions
commands/version/version_utils.go Add ParsePathMappings() function
commands/version/promote_app_version_cmd.go Wire path mappings into promote payload
commands/version/release_app_version_cmd.go Wire path mappings into release payload
model/release_app_version_request.go Accept modifications parameter in constructor
*_test.go Unit tests for ParsePathMappings and updated existing tests

Test plan

  • Unit tests for ParsePathMappings covering: single/multiple mappings, partial package types, error cases (mismatched counts, missing flags)
  • Existing tests updated to compile with new constructor signature
  • E2E: jf at version-promote with --map-in and --map-out sends correct request body

Jira

APP-4658

Made with Cursor

Add --map-in, --map-out, and --map-type flags to the promote and release
commands for regex-based artifact path transformations during promotion.

Usage:
  jf at version-promote my-app 1.0.0 PROD \
    --map-type=".*" --map-in="(.*)" --map-out="stable-release/$1"

Multiple mappings via semicolon separation:
  --map-in="(.*);(.*\.jar)" --map-out="release/$1;jars/$1" --map-type=".*;maven"

The mappings are forwarded as modifications.mappings in the promotion
request body to be applied by the Bundle Handler Service.

Co-authored-by: Cursor <cursoragent@cursor.com>
- TestPromoteVersion_WithPathMappings: promotes with --map-in, --map-out,
  --map-type and verifies stage advances to DEV
- TestPromoteVersion_WithPathMappings_InvalidRegex: verifies invalid
  regex in --map-in returns an error

Co-authored-by: Cursor <cursoragent@cursor.com>
@danielreJfrog danielreJfrog force-pushed the feature/APP-4658-path-mapping-promote branch from c00d934 to b916905 Compare June 17, 2026 07:33
- Reject --map-type when --map-in/--map-out are missing
- Reject empty entries from trailing semicolons in all mapping flags
- Remove unused BuildPathMappingsDescription function

Co-authored-by: Cursor <cursoragent@cursor.com>
@asafgabai asafgabai added the safe to test Approve running end-to-end tests on a pull request label Jun 18, 2026
@github-actions github-actions Bot removed the safe to test Approve running end-to-end tests on a pull request label Jun 18, 2026
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Test Results

54 tests  +2   51 ✅ ±0   4m 49s ⏱️ -53s
 2 suites ±0    3 💤 +2 
 1 files   ±0    0 ❌ ±0 

Results for commit 56ba666. ± Comparison against base commit 2ce9356.

♻️ This comment has been updated with latest results.

}
}

if len(inputs) != len(outputs) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The practice of requiring both list flags with the same length is very uncommon and makes the command much more complex to read and write.
Taking into account the fact that the length of --map-type can be smaller than the others making it even more confusing and unclear.
The existing --source-type-* flags show a cleaner approach:

--source-type-packages="type=npm, name=@gpizza/pizza-frontend, version=1.0.0, repo-key=tests-npm-local; type=npm, name=@gpizza/green-pizza, version=2.0.1"

Another option is to limit the path mappings to 1 in the CLI (AFAIK that's the situation in Distribution's path mappings).
Consider discussing this with the product.

Replace --map-in, --map-out, --map-type with a single structured flag
following the same pattern as --source-type-packages:

  --path-mapping="input=(.*), output=stable-release/$1, package-type=.*"

Multiple mappings via semicolons:

  --path-mapping="input=(.*), output=release/$1; input=(.*\.jar), output=jars/$1, package-type=maven"

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@asafgabai asafgabai added the safe to test Approve running end-to-end tests on a pull request label Jun 21, 2026
@github-actions github-actions Bot removed the safe to test Approve running end-to-end tests on a pull request label Jun 21, 2026
@asafgabai asafgabai merged commit cadb787 into jfrog:main Jun 21, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants