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 --directory to rpm content -t package upload. #1003

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

ggainey
Copy link
Contributor

@ggainey ggainey commented Jun 27, 2024

This finds all *.rpm in the specified directory and arranges for them to be added to the specified --repository, and then publishes the final resulting repository-version.

closes #994.

@ggainey ggainey marked this pull request as draft June 27, 2024 20:31
@ggainey
Copy link
Contributor Author

ggainey commented Jun 27, 2024

This is a modification of the approach in #1000 that does not rely on creating a tmp-repository.

@ggainey
Copy link
Contributor Author

ggainey commented Jun 27, 2024

Sample output:

$ pulp rpm content upload --directory ./signed/fixtures.pulpproject.org/rpm-signed/ --repository rpm:rpm:upload
[About to upload 35 files for upload.
Started background task /pulp/api/v3/tasks/01905b60-998f-7997-b947-d8145e8800ab/
Done.
Uploaded ./signed/fixtures.pulpproject.org/rpm-signed/crow-0.8-1.noarch.rpm...
...
Created new version 35 in upload
Publishing repository upload.
Started background task /pulp/api/v3/tasks/01905b61-58ff-7909-81ef-84cd74d8b42f/
Done.
{
  "pulp_href": "/pulp/api/v3/publications/rpm/rpm/01905b61-5958-7670-9d88-9b486ec25d8b/",
  "pulp_created": "2024-06-27T20:27:04.921566Z",
  "pulp_last_updated": "2024-06-27T20:27:05.132778Z",
  "repository_version": "/pulp/api/v3/repositories/rpm/rpm/01905b60-7c70-75d6-8882-0ec1a29fa71d/versions/35/",
  "repository": "/pulp/api/v3/repositories/rpm/rpm/01905b60-7c70-75d6-8882-0ec1a29fa71d/",
  "checksum_type": "sha256",
  "metadata_checksum_type": "sha256",
  "package_checksum_type": "sha256",
  "gpgcheck": null,
  "repo_gpgcheck": null,
  "sqlite_metadata": false,
  "repo_config": {},
  "compression_type": null
}

@ggainey
Copy link
Contributor Author

ggainey commented Jun 28, 2024

List of REST API calls made in response to using this PR to upload a directory containing one RPM:

@mdellweg
Copy link
Member

Uploads api's are only employed when the file is bigger than the specified chunk size.
Please try another run with chunksize 2/3 the file size.

@ggainey
Copy link
Contributor Author

ggainey commented Jul 11, 2024

Uploads api's are only employed when the file is bigger than the specified chunk size.
Please try another run with chunksize 2/3 the file size.

pulp -vvv rpm content upload --directory ./test_upload --repository rpm:rpm:upload --chunk-size 1KB

adds the following to the above-listed REST calls:

@ggainey
Copy link
Contributor Author

ggainey commented Jul 12, 2024

This now combines the behavior of #1000 and #1003 - you can get a single repo-version by specifying --use-temp-repository, and ask for a publication to the specified --repository with --publish. The defaults are chosen to match the original request - upload directly to the specified repository, and publish when done.

Example output:

$ pulp rpm repository create --name upload2 --no-autopublish
{
  "pulp_href": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/",
  "pulp_created": "2024-07-12T14:22:27.078395Z",
  "pulp_last_updated": "2024-07-12T14:22:27.084739Z",
  "versions_href": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/versions/",
  "pulp_labels": {},
  "latest_version_href": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/versions/0/",
  "name": "upload2",
  "description": null,
  "retain_repo_versions": null,
  "remote": null,
  "autopublish": false,
  "metadata_signing_service": null,
  "package_signing_service": null,
  "package_signing_fingerprint": "",
  "retain_package_versions": 0,
  "checksum_type": null,
  "metadata_checksum_type": null,
  "package_checksum_type": null,
  "gpgcheck": null,
  "repo_gpgcheck": null,
  "sqlite_metadata": false,
  "repo_config": {},
  "compression_type": null
}
$ pulp rpm content upload --directory ./signed/fixtures.pulpproject.org/rpm-signed/ --repository upload2
About to upload 35 files for upload2.
Started background task /pulp/api/v3/tasks/0190a753-0cdd-739d-b60b-9e952120411c/
Done.
Uploaded ./signed/fixtures.pulpproject.org/rpm-signed/crow-0.8-1.noarch.rpm...
...
Started background task /pulp/api/v3/tasks/0190a753-c2e9-7d6f-bc9e-fd736a608c9d/
Done.
Uploaded ./signed/fixtures.pulpproject.org/rpm-signed/camel-0.1-1.noarch.rpm...
Created new version 35 in upload2
Publishing repository upload2.
Started background task /pulp/api/v3/tasks/0190a753-c865-7684-aea7-fb5b64257b30/
Done.
{
  "pulp_href": "/pulp/api/v3/publications/rpm/rpm/0190a753-c8b6-7bae-9c9f-5f0ebc7d0e5a/",
  "pulp_created": "2024-07-12T14:23:24.343140Z",
  "pulp_last_updated": "2024-07-12T14:23:24.527520Z",
  "repository_version": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/versions/35/",
  "repository": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/",
  "checksum_type": "sha256",
  "metadata_checksum_type": "sha256",
  "package_checksum_type": "sha256",
  "gpgcheck": null,
  "repo_gpgcheck": null,
  "sqlite_metadata": false,
  "repo_config": {},
  "compression_type": null
}
$ pulp rpm publication list --repository upload2
[
  {
    "pulp_href": "/pulp/api/v3/publications/rpm/rpm/0190a753-c8b6-7bae-9c9f-5f0ebc7d0e5a/",
    "pulp_created": "2024-07-12T14:23:24.343140Z",
    "pulp_last_updated": "2024-07-12T14:23:24.527520Z",
    "repository_version": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/versions/35/",
    "repository": "/pulp/api/v3/repositories/rpm/rpm/0190a752-e905-7773-bf51-f9041904fdd8/",
    "checksum_type": "sha256",
    "metadata_checksum_type": "sha256",
    "package_checksum_type": "sha256",
    "gpgcheck": null,
    "repo_gpgcheck": null,
    "sqlite_metadata": false,
    "repo_config": {},
    "compression_type": null
  }
]

@ggainey ggainey marked this pull request as ready for review July 12, 2024 14:27
@ggainey ggainey requested a review from mdellweg July 12, 2024 20:00
@ggainey
Copy link
Contributor Author

ggainey commented Jul 12, 2024

NOTE: at some point, we may want to modify to allow multiple --directory --file to be specified. In the moment, decided it was better to answer the immediate known-requirement, and leave that as a Future Enhancement.

CHANGES/994.feature Outdated Show resolved Hide resolved
pulpcore/cli/rpm/content.py Outdated Show resolved Hide resolved
pulpcore/cli/rpm/content.py Outdated Show resolved Hide resolved
This finds all *.rpm in the specified directory and arranges for
them to be added to the specified --repository, and then publishes
the final resulting repository-version.

closes pulp#994.
@ggainey ggainey merged commit 51498c3 into pulp:main Jul 15, 2024
17 checks passed
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.

Provide easier workflow for uploading rpms into a repository
2 participants