Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/6854.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the workflow documentation for upload.html. Fixed the workflow commands and added more details to the instructions.
14 changes: 14 additions & 0 deletions docs/_scripts/add_content_repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Add created PythonPackage content to repository
echo "Add created Python Package to repository"
export TASK_URL=$(http POST $BASE_ADDR$REPO_HREF'modify/' \
add_content_units:="[\"$PACKAGE_HREF\"]" | jq -r '.task')

# Poll the task (here we use a function defined in docs/_scripts/base.sh)
wait_until_task_finished $BASE_ADDR$TASK_URL

# After the task is complete, it gives us a new repository version
echo "Set REPOVERSION_HREF from finished task."
export REPOVERSION_HREF_WITH_PKG=$(http $BASE_ADDR$TASK_URL| jq -r '.created_resources | first')

echo "Inspecting RepositoryVersion."
http $BASE_ADDR$REPOVERSION_HREF_WITH_PKG
12 changes: 12 additions & 0 deletions docs/_scripts/artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Get a Python package or choose your own
curl -O https://repos.fedorapeople.org/pulp/pulp/fixtures/python-pypi/packages/shelf-reader-0.1.tar.gz
export PKG="shelf-reader-0.1.tar.gz"

# Upload it as an Artifact
echo "Upload a Python Package"
export ARTIFACT_HREF=$(http --form POST $BASE_ADDR/pulp/api/v3/artifacts/ \
file@./$PKG | jq -r '.pulp_href')

echo "Inspecting artifact."
http $BASE_ADDR$ARTIFACT_HREF

15 changes: 15 additions & 0 deletions docs/_scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Create a Python package from an artifact
echo "Create Python content from artifact."
export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/content/python/packages/ \
artifact=$ARTIFACT_HREF relative_path=$PKG filename=$PKG | jq -r '.task')

# Poll the task(here we use a function defined in docs/_scripts/base.sh)
wait_until_task_finished $BASE_ADDR$TASK_URL

# After the task is complete, it gives us a new package (PythonPackage Content)
echo "Set PACKAGE_HREF from finished task."
export PACKAGE_HREF=$(http $BASE_ADDR$TASK_URL| jq -r '.created_resources | first')

echo "Inspecting Package."
http $BASE_ADDR$PACKAGE_HREF

2 changes: 1 addition & 1 deletion docs/_static/api.json

Large diffs are not rendered by default.

104 changes: 85 additions & 19 deletions docs/workflows/upload.rst
Original file line number Diff line number Diff line change
@@ -1,55 +1,121 @@
Upload and Manage Content
=========================
Content can be added to a repository not only by synchronizing from a remote source but also by uploading the files directly into Pulp.

Create a repository
-------------------

If you don't already have a repository, create one::
If you don't already have a repository, create one.

$ http POST $BASE_ADDR/pulp/api/v3/repositories/python/python/ name=foo
.. literalinclude:: ../_scripts/repo.sh
:language: bash

Response::
Repository GET response::

{
"pulp_href": "http://localhost:24817/pulp/api/v3/repositories/python/python/9b19ceb7-11e1-4309-9f97-bcbab2ae38b6/",
...
"description": null,
"latest_version_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/0/",
"name": "foo",
"pulp_created": "2020-05-28T20:15:08.644358Z",
"pulp_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/",
"versions_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/"
}



Upload a file to Pulp
---------------------

Each artifact in Pulp represents a file. They can be created during sync or created manually by uploading a file::
Each artifact in Pulp represents a file. They can be created during sync or created manually by uploading a file.

$ http --form POST $BASE_ADDR/pulp/api/v3/artifacts/ file@./my_content
.. literalinclude:: ../_scripts/artifact.sh
:language: bash

Response::
Artifact GET response::

{
"pulp_href": "http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/",
...
"file": "artifact/04/cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c",
"md5": "2dac570a33d88ca224be86759be59376",
"pulp_created": "2020-05-28T20:21:23.441981Z",
"pulp_href": "/pulp/api/v3/artifacts/f87a20b0-d5b9-4a07-9282-bf7f9e5eb37f/",
"sha1": "bf039b185ef1f308e7d0bc5322be10061ca4f695",
"sha224": "01c8a673b13875cb12deb0e9fb2fddf3579583d7837b4458a78dd83c",
"sha256": "04cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c",
"sha384": "4c22ded8001904b4fedb3fa974c883479fb32d630ceb48d7455bfd390166afd73cfda5b4c9c0c8d3a19bb67966ae13d0",
"sha512": "4d11d6a67ec6aa3eb25df2416b6d48f1c6c04d5e745b12d7dbc89aacfc8bcb439c5ccff56324ce8493099e4e2f79a414d2513758782efcaef84b3d8cf00ea45f",
"size": 19097
}


Create content from an artifact
-------------------------------

Now that Pulp has the content, its time to make it into a unit of content.
Now that Pulp has the package, its time to make it into a unit of content.

$ http POST $BASE_ADDR/pulp/api/v3/content/python/ artifact=http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/ filename=my_content
.. literalinclude:: ../_scripts/package.sh
:language: bash

Response::
Content GET response::

{
"pulp_href": "http://localhost:24817/pulp/api/v3/content/python/python/ae016be0-0499-4547-881f-c56a1d0186a6/",
"_artifact": "http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/",
"digest": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c",
"filename": "my-content",
"artifact": "/pulp/api/v3/artifacts/f87a20b0-d5b9-4a07-9282-bf7f9e5eb37f/",
"author": "Austin Macdonald",
"author_email": "asmacdo@gmail.com",
"classifiers": [],
"description": "too long to read",
"download_url": "",
"filename": "shelf-reader-0.1.tar.gz",
"home_page": "https://github.com/asmacdo/shelf-reader",
"keywords": "",
"license": "GNU GENERAL PUBLIC LICENSE Version 2, June 1991",
"maintainer": "",
"maintainer_email": "",
"metadata_version": "1.1",
"name": "shelf-reader",
"obsoletes_dist": "[]",
"packagetype": "sdist",
"platform": "",
"project_url": "",
"provides_dist": "[]",
"pulp_created": "2020-05-28T20:49:12.156807Z",
"pulp_href": "/pulp/api/v3/content/python/packages/2ac13c48-0f45-4811-80d2-5dcbb7821ce1/",
"requires_dist": "[]",
"requires_external": "[]",
"requires_python": "",
"summary": "Make sure your collections are in call number order.",
"supported_platform": "",
"version": "0.1"
}


Add content to a repository
---------------------------

Once there is a content unit, it can be added and removed and from to repositories::
Once there is a content unit, it can be added and removed from repositories using add_content_units or remove_content_units respectively.

.. literalinclude:: ../_scripts/add_content_repo.sh
:language: bash

$ http POST $REPO_HREF/pulp/api/v3/repositories/python/python/9b19ceb7-11e1-4309-9f97-bcbab2ae38b6/modify/ add_content_units:="[\"http://localhost:24817/pulp/api/v3/content/python/python/ae016be0-0499-4547-881f-c56a1d0186a6/\"]"
Repository Version GET response (after task complete)::

{
"base_version": null,
"content_summary": {
"added": {
"python.python": {
"count": 1,
"href": "/pulp/api/v3/content/python/packages/?repository_version_added=/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/"
}
},
"present": {
"python.python": {
"count": 1,
"href": "/pulp/api/v3/content/python/packages/?repository_version=/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/"
}
},
"removed": {}
},
"number": 1,
"pulp_created": "2020-05-28T21:04:54.403979Z",
"pulp_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/"
}