-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: main
Are you sure you want to change the base?
Added upload support #113
Conversation
e4df221
to
d7b03bb
Compare
closes: pulp#52
d7b03bb
to
781a281
Compare
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") |
There was a problem hiding this comment.
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"))
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 = [] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like this @mdellweg?
There was a problem hiding this comment.
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.""" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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?
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! |
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! |
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! |
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! |
This pull request is no longer marked for closure. |
1 similar comment
This pull request is no longer marked for closure. |
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! |
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! |
closes: #52