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

Make the artifact create endpoint idempotent #5780

Open
daviddavis opened this issue Sep 9, 2024 · 6 comments
Open

Make the artifact create endpoint idempotent #5780

daviddavis opened this issue Sep 9, 2024 · 6 comments
Labels

Comments

@daviddavis
Copy link
Contributor

The package creation endpoints are idempotent so I wonder if the artifact create endpoint should be as well. Currently, you get a 400 error if you attempt to upload an artifact that already exists:

$ https --form :/pulp/api/v3/artifacts/ file@~/frigg_1.0_ppc64.deb
{
    "non_field_errors": [
        "Artifact with sha256 checksum of 'a20723d4d174abecc0001bbbe183d04fc26b2ca30d77d87b5c4c9f3be35b67ee' already exists."
    ]
}
@mdellweg
Copy link
Member

Not opposed to it, but IMHO the artifacts api should completely be deprecated for removal in pulp 4.
Having the user care about bare artifacts adds an unnecessary layer of confusion to the usage patterns of pulp.

@dkliban
Copy link
Member

dkliban commented Sep 10, 2024

I discussed this issue with @daviddavis on chat. He's using this API for uploading artifacts that are needed to create multi-artifact source packages in pulp_deb. A change in pulp_deb API for source packages would be appreciated. @quba42 , what do you think about that?

@quba42
Copy link
Contributor

quba42 commented Sep 10, 2024

Have other plugins already solved this? In other words is there already an API endpoint somewhere for creating a multi-artifact content without having to separately create the artifacts first? That is how I understood the request.

@dkliban
Copy link
Member

dkliban commented Sep 10, 2024

I don't think we have an example of this anywhere else. @dralley @ggainey does RPM have anything like this?

@quba42
Copy link
Contributor

quba42 commented Sep 10, 2024

So I just had a look at the pulp_deb Source Package API endpoint, and it expects you to provide the .dsc file as an artifact, and then it will just loop over the files referenced in that .dsc file, expecting those to already exist as artifacts in Pulp.

Does anyone have any ideas how one might provide a content API endpoint with multiple uploads to create a content and multiple artifacts from?

I did not think about this before, and if it does not already exist elsewhere, I am not at all confident I know a good approach. 😄

@mdellweg
Copy link
Member

I think the multipart body can accept multiple files in one request just fine. Not sure if DRF covers for that.
Also I would kind of expect that for each file you can either upload a file, specify an upload or (for the time being) an artifact.

Somehow we are derailing from the original ask: "Should the Artifact upload be idempotent?" And we can do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants