Skip to content

Conversation

@agrasth
Copy link
Contributor

@agrasth agrasth commented May 11, 2025

  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

Add --validate-sha flag for Docker push command

Description

This PR adds a new --validate-sha flag to the Docker push command. When enabled, the flag allows the CLI to use the image's SHA digest for validation instead of the tag name during Docker push operations. This is particularly useful when pushing to virtual repositories where the tag might exist with different content in higher priority repositories.

Changes

  • Removed redundant direct flag registration in the Docker command
  • Updated documentation with comprehensive explanation of the flag's purpose and behavior
  • Added flag extraction in the push command

Testing

  • Manually tested the flag with both old (jf rt docker-push) and new (jf docker push) CLI syntax
  • Verified behavior when pushing to repositories with existing tags
  • Confirmed build info collection works correctly with the flag

Related PRs

  • jfrog-cli-artifactory: here
  • jfrog-cli-core: here

@agrasth agrasth force-pushed the feature/docker-validate-sha branch from facc5d9 to 6dcad6b Compare May 12, 2025 05:35
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from 6dcad6b to 107f393 Compare May 14, 2025 05:57
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from c8fc46d to eeaa95c Compare May 16, 2025 20:47
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from eeaa95c to f580e09 Compare May 16, 2025 21:19
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from f580e09 to de14255 Compare May 16, 2025 21:22
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from de14255 to 1409f88 Compare May 19, 2025 06:03
The docker push args to run docker push.`
The docker push args to run docker push.
--validate-sha
Copy link
Contributor

Choose a reason for hiding this comment

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

since it is a flag, do we need to update here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you are right, for flags we don't need to update here.

Usage: "[Default: false] Set to true if you'd like to use the native client configurations. Note: This flag would invoke native client behind the scenes, has performance implications and does not support deployment view and detailed summary` `",

},
validateSha: cli.BoolFlag{
Copy link
Contributor

Choose a reason for hiding this comment

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

what ist he difference between container push command and docker, dockerPush is it like OCI support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I understood was

  • DockerPush Specifically for Docker images, using the Docker CLI under the hood
  • ContainerPush - A more generic command that supports multiple container technologies, not just Docker.

Since both commands perform pushing operations that could benefit from SHA validation, it makes sense to add the flag to both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I understood was

  • DockerPush Specifically for Docker images, using the Docker CLI under the hood
  • ContainerPush - A more generic command that supports multiple container technologies, not just Docker.

Since both commands perform pushing operations that could benefit from SHA validation, it makes sense to add the flag to both.

ContainerPush: {
BuildName, BuildNumber, module, url, user, password, accessToken, sshPassphrase, sshKeyPath,
serverId, skipLogin, threads, Project, detailedSummary,
serverId, skipLogin, threads, Project, detailedSummary, validateSha,
Copy link
Contributor

Choose a reason for hiding this comment

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

is the flag required here as well as in jfrog-cli-artifactory?

@agrasth agrasth force-pushed the feature/docker-validate-sha branch from 56eb6ae to f8364d2 Compare May 23, 2025 21:53
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from a73b7f1 to 2ec4dda Compare May 26, 2025 07:06
@agrasth agrasth added the safe to test Approve running integration tests on a pull request label May 26, 2025
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from 2ec4dda to 542ac45 Compare May 27, 2025 10:37
@agrasth agrasth requested a review from bhanurp May 27, 2025 10:38
@agrasth agrasth added safe to test Approve running integration tests on a pull request and removed safe to test Approve running integration tests on a pull request labels May 27, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label May 27, 2025
@agrasth agrasth force-pushed the feature/docker-validate-sha branch from 542ac45 to 559cdc9 Compare May 29, 2025 19:39
@agrasth agrasth merged commit b27257e into jfrog:dev May 30, 2025
13 of 14 checks passed
@agrasth agrasth deleted the feature/docker-validate-sha branch September 19, 2025 11:10
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