Skip to content

Conversation

@EyalDelarea
Copy link
Contributor

@EyalDelarea EyalDelarea commented Jun 22, 2025

  • The pull request is targeting the main branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....
  • All static analysis checks passed.
  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • All integration tests have passed locally as they cannot be automated yet.
  • All changes are detailed at the description. if not already covered at JFrog Documentation, new documentation have been added.

PR: Enhance version-create Command for AppTrust CLI

Summary

This PR significantly improves the version-create command in the AppTrust CLI, aligning it with the latest product specification and enhancing usability, flexibility, and correctness.
Also added tests for specfiles


Key Changes

  • Command Arguments & Help Output

    • Updated the command signature to:
      version-create [command options] <app-key> <version>
      
    • Arguments:
      • app-key: The application key of the application for which the version is being created.
      • version: The version number (in SemVer format) for the new application version.
    • The help output now clearly documents all arguments and options, matching the product spec.
  • New and Updated Flags

    • Added support for:
      • --tag: Associate a tag with the version.
      • --builds: List of builds in the format 'name1:number1[:timestamp1];name2:number2[:timestamp2]'.
      • --release-bundles: List of release bundles in the format 'name1:version1;name2:version2'.
      • --source-version: Source versions in the format 'app1:version1;app2:version2'.
    • Existing flags like --spec and --spec-vars
  • API Route Update

    • Changed the backend API endpoint for version creation from:
      POST /v1/applications/version
      
      to:
      POST /v1/applications/{app-key}/versions/
      

Before

Usage:
   version-create [command options] <version-name>
Arguments:
  version-name
    The name of the version.
Options:
  --access-token, --application-key, --package-name, --package-repository, --package-type, --package-version, --server-id, --spec, --spec-vars, --url, --user

After

Usage:
   version-create [command options] <app-key> <version>
Arguments:
  app-key
    The application key of the application for which the version is being created.
  version
    The version number (in SemVer format) for the new application version.
Options:
  --access-token, --application-key, --builds,, --package-name, --package-repository, --package-type, --package-version, --release-bundles, --server-id, --source-version, --spec, --spec-vars, --tag, --url, --user

@github-actions
Copy link
Contributor

github-actions bot commented Jun 22, 2025

Unit Tests Results

121 tests  +36   121 ✅ +36   0s ⏱️ ±0s
 25 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit fafcdff. ± Comparison against base commit 2e307e8.

This pull request removes 2 and adds 38 tests. Note that renamed tests count towards both.
github.com/jfrog/jfrog-cli-application/apptrust/commands/version ‑ TestCreateAppVersionCommand_Run
github.com/jfrog/jfrog-cli-application/apptrust/commands/version ‑ TestCreateAppVersionCommand_Run_ContextError
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseDelimitedSlice
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseDelimitedSlice/empty_string
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseDelimitedSlice/entries_with_extra_parts
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseDelimitedSlice/multiple_entries
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseDelimitedSlice/single_entry
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseDelimitedSlice/trailing_separator
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseNameVersionPairs
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseNameVersionPairs/empty_string
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseNameVersionPairs/invalid_format
github.com/jfrog/jfrog-cli-application/apptrust/commands/utils ‑ TestParseNameVersionPairs/multiple_pairs
…

♻️ This comment has been updated with latest results.

},
{
Name: "version",
Description: "The version number (in SemVer format) for the new application version.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we validate SemVer already in CLI or do we rely on AppTrust to throw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We validate in AppTrust, i didn't see any logic to do so inside the CLI.
I guess we could add it

Version: ctx.Arguments[0],
Packages: packages,
}, nil
if buildsStr := ctx.GetStringFlagValue(commands.BuildsFlag); buildsStr != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd be better to use IsFlagSet instead of GetStringFlagValue, here and in the following ifs below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would still need to call getValue if it exists

@github-actions
Copy link
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


@EyalDelarea EyalDelarea merged commit b15a0a0 into main Jun 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants