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

The source.copy(dest)-functionality should deploy artifacts with checksums #162

Closed
stmlange opened this issue May 28, 2020 · 7 comments · Fixed by #290
Closed

The source.copy(dest)-functionality should deploy artifacts with checksums #162

stmlange opened this issue May 28, 2020 · 7 comments · Fixed by #290
Assignees
Labels
good first issue Help Wanted We will be glad if somebody proposes a solution via PR

Comments

@stmlange
Copy link

Using

from artifactory import ArtifactoryPath
source = ArtifactoryPath("http://example.com/artifactory/builds/product/product/1.0.0/")
dest = ArtifactoryPath("http://example.com/artifactory/published/production/")
source.copy(dest)

Leads to warnings in Artifactory that the client hasn't published a checksum value (e.g. similar to this https://stackoverflow.com/questions/40009688)

Instead of directly deploying it, one would need to download the file, generate the checksum and the deploy it back. E.g.

with TemporaryDirectory() as temp_dir:
    file_name_to_deploy = os.path.join(temp_dir, source.name)
    with source.open() as fobj, open(file_name_to_deploy, "wb") as out:
        out.write(fobj.read())
    dest.deploy_file(file_name_to_deploy, calc_md5=True, calc_sha1=True, calc_sha256=True)

(untested)

@allburov allburov added good first issue Help Wanted We will be glad if somebody proposes a solution via PR labels Jun 2, 2020
@sousajo-cc
Copy link

hello. can i take this one?

@allburov
Copy link
Member

allburov commented Jan 8, 2021

@sousajf1 we'll appreciate it! :) Feel free to create PR and show a solution!

@sousajo-cc
Copy link

sousajo-cc commented Jan 8, 2021

#208 a try :)

@beliaev-maksim beliaev-maksim self-assigned this Aug 23, 2021
@beliaev-maksim
Copy link
Member

@allburov
I just tested on the instance of Artifactory

if artifact, that should be copied, doesn't have a checksum initially, then user gets warning that was mentioned
if artifact, has checksums, that were added during deploy, then the checksum are preserved during copy

from this test I assume that it is more like a user error. Initial artifact must have checksum calculated, before we copy.
if user wants to make copy with checksum, user needs to get path.stat() and then run deploy_by_checksum https://github.com/devopshq/artifactory/tree/develop#uploading-artifacts

I think we will not implement this, any objections?

@stmlange
Copy link
Author

Hi,
all of our artifacts are deployed / uploaded with gradle and I'm fairly confident that all the artifacts have / had checksum's present.
Perhaps worth mentioning is that when I encountered the issue I was copying artifacts between two different instances. So something along the lines of:

from artifactory import ArtifactoryPath
source = ArtifactoryPath("http://some-instance.com/artifactory/foo/bar/1.0.0/")
dest = ArtifactoryPath("http://another-instance.com/artifactory/foo/bar/1.0.0/")
source.copy(dest)

Unfortunately I can't check anymore if this is actually true, since one of the instance was retired.
Based on the notes I have I had been using dohq-artifactory==0.7.345 so perhaps the issue was already fixed.

Anyhow, feel free to close the issue.
If one really bothers about the checksums the mentioned work-around in my initial comment did the trick :-)

@beliaev-maksim
Copy link
Member

@stmlange
what you just mentioned makes a huge difference to the issue description

if instances are different, then completely different mechanism is utilized under the hood

@beliaev-maksim beliaev-maksim linked a pull request Sep 20, 2021 that will close this issue
@beliaev-maksim
Copy link
Member

@stmlange
available in develop branch
will be pushed to next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Help Wanted We will be glad if somebody proposes a solution via PR
Development

Successfully merging a pull request may close this issue.

4 participants