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

Added upload support #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dkliban
Copy link
Member

@dkliban dkliban commented Feb 27, 2023

closes: #52

@dkliban dkliban force-pushed the add-upload-support branch 2 times, most recently from e4df221 to d7b03bb Compare February 27, 2023 20:43
Comment on lines +56 to +62
fields = (
SingleArtifactContentUploadSerializer.Meta.fields
+ ContentChecksumSerializer.Meta.fields
+ ("group_id", "artifact_id", "version", "filename")
)
# Remove relative_path
fields = tuple(field for field in fields if field != "relative_path")
Copy link
Member

Choose a reason for hiding this comment

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

Can this be a single expression?
like fields = (Base.Meta.fields + ("group_id", ...) - ("relative_path"))?

Copy link
Member

Choose a reason for hiding this comment

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

TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'
Or maybe there's another way to remove it from the tuple.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I knew i've seen it before: https://github.com/pulp/pulp_container/blob/main/pulp_container/app/serializers.py#L214

Using a set and then casting it into a tuple was clever. 🚀

model = models.MavenArtifact
# Validation occurs in the task.
validators = []
Copy link
Member

Choose a reason for hiding this comment

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

What was the validation about that we kill here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unique Togeth Validation .. I am still not sure how it is getting injected here. I followed the example from pulp_file for FileContentSerializer which doesn't have any validators, however, I kept having the UniqueTogetherValidator getting injected. This was the only way I found to fix that problem. However, I am open to other solutions.

Copy link
Member

Choose a reason for hiding this comment

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

I don't know of a better way.

git grep UniqueTogetherValidator is silent on both pulpcore and pulp_maven.

Copy link
Member

Choose a reason for hiding this comment

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

@quba42 see, i knew i saw it before somewhere...
How did you solve it again?

Comment on lines +56 to +62
fields = (
SingleArtifactContentUploadSerializer.Meta.fields
+ ContentChecksumSerializer.Meta.fields
+ ("group_id", "artifact_id", "version", "filename")
)
# Remove relative_path
fields = tuple(field for field in fields if field != "relative_path")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fields = (
SingleArtifactContentUploadSerializer.Meta.fields
+ ContentChecksumSerializer.Meta.fields
+ ("group_id", "artifact_id", "version", "filename")
)
# Remove relative_path
fields = tuple(field for field in fields if field != "relative_path")
fields = tuple(
set(SingleArtifactContentUploadSerializer.Meta.fields
+ ContentChecksumSerializer.Meta.fields
+ ("group_id", "artifact_id", "version", "filename")) - set("relative_path")
)

Copy link
Member

Choose a reason for hiding this comment

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

something like this @mdellweg?

Copy link
Member

Choose a reason for hiding this comment

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

yes, exactly.



def generate_jar(full_path, size=1024, relative_path=None):
"""Generate a random file."""
Copy link
Member

Choose a reason for hiding this comment

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

I guess, you will keep the possibility for switching to an actual "jar" file eventually?

Upload a Jar to a Maven Repository
==================================

Create a maven Repository for the
Copy link
Member

Choose a reason for hiding this comment

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

leftovers

<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
Copy link
Member

Choose a reason for hiding this comment

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

is it worth adding one last step which shows that the uploaded jar is consumable by the maven client?

@stale
Copy link

stale bot commented May 31, 2023

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

@stale stale bot added the stale label May 31, 2023
@mdellweg mdellweg removed the stale label Jun 1, 2023
@stale
Copy link

stale bot commented Sep 3, 2023

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

@stale stale bot added the stale label Sep 3, 2023
@mdellweg mdellweg removed the stale label Sep 4, 2023
Copy link

stale bot commented Dec 7, 2023

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

@stale stale bot added the stale label Dec 7, 2023
@mdellweg mdellweg removed the stale label Dec 7, 2023
Copy link

stale bot commented Mar 7, 2024

This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!

@stale stale bot added the stale label Mar 7, 2024
Copy link

stale bot commented Mar 7, 2024

This pull request is no longer marked for closure.

1 similar comment
Copy link

stale bot commented Mar 7, 2024

This pull request is no longer marked for closure.

@stale stale bot removed stale labels Mar 7, 2024
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.

As a user, I can upload a Maven Artifact into Pulp
4 participants