Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance download functionality to support RBV2 #2805

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

oshratZairi
Copy link
Collaborator

@oshratZairi oshratZairi commented Dec 26, 2024

  • 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 ./....

Enhance download functionality to support RBV2

if c.IsSet("bundle") {
isRbv2, err = checkRbExistenceInV2(c)
}
//if the command contains --bundle and the bundle found in rbv2, we will download from rbv2
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens when the bundle is not in V2? the download commands continues as it as?

And also this is a generic download code with too much RBV2 references, maybe we should extract some logic to a one liner function to avoid it.

I would move this logic inside the prepareDownloadCommand.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the logic is:
if we have the same rb-name in both rbv1 and rbv2 - we will take rbv2.
if the cmd dose not contain --bundle , it will remain as it is.
moved the logic.

go.mod Outdated
@@ -168,6 +168,10 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/jfrog/jfrog-cli-core/v2 => ../jfrog-cli-core
Copy link
Contributor

Choose a reason for hiding this comment

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

Notice to change replaces before pushing :)

if c.IsSet("spec") {
downloadSpec, err = cliutils.GetSpec(c, true, true)
} else {
downloadSpec, err = createDefaultDownloadSpec(c)
if c.IsSet("bundle") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove this check from here and insert this logic inside the createDefaultDownloadSpec function. Since the context is already passed to the function, it can be checked inside.

func TestReleaseBundleImportOnPrem(t *testing.T) {
// Cleanup
defer func() {
deleteReceivedReleaseBundle(t, "cli-tests", "2")
deleteReceivedReleaseBundle(t, "artifactory/api/release/bundles/", "cli-tests", "2")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the URLs constants with meaningful names so we understand their purposes? The same applies to the URL on line 247.

assert.NoError(t, err)

// Download RBV2
err = artifactoryCli.Exec([]string{"download", "--bundle=" + tests.LcRbName1 + "/" + buildNumber}...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also verify the download succeeded and not just failed? maybe check the existence of the file ?

@EyalDelarea EyalDelarea added safe to test Approve running integration tests on a pull request improvement Automatically generated release notes labels Jan 12, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jan 12, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jan 13, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Jan 14, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Jan 14, 2025
Copy link
Contributor

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


@EyalDelarea EyalDelarea merged commit 07ca779 into jfrog:dev Jan 14, 2025
63 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.

2 participants