Skip to content

Commit cb92ae5

Browse files
authored
Merge pull request #277 from gerrod3/6854
Updated Upload and Manage Content Workflow Documentation
2 parents 3279ea5 + 5f79aaa commit cb92ae5

6 files changed

Lines changed: 128 additions & 20 deletions

File tree

CHANGES/6854.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Updated the workflow documentation for upload.html. Fixed the workflow commands and added more details to the instructions.

docs/_scripts/add_content_repo.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Add created PythonPackage content to repository
2+
echo "Add created Python Package to repository"
3+
export TASK_URL=$(http POST $BASE_ADDR$REPO_HREF'modify/' \
4+
add_content_units:="[\"$PACKAGE_HREF\"]" | jq -r '.task')
5+
6+
# Poll the task (here we use a function defined in docs/_scripts/base.sh)
7+
wait_until_task_finished $BASE_ADDR$TASK_URL
8+
9+
# After the task is complete, it gives us a new repository version
10+
echo "Set REPOVERSION_HREF from finished task."
11+
export REPOVERSION_HREF_WITH_PKG=$(http $BASE_ADDR$TASK_URL| jq -r '.created_resources | first')
12+
13+
echo "Inspecting RepositoryVersion."
14+
http $BASE_ADDR$REPOVERSION_HREF_WITH_PKG

docs/_scripts/artifact.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Get a Python package or choose your own
2+
curl -O https://repos.fedorapeople.org/pulp/pulp/fixtures/python-pypi/packages/shelf-reader-0.1.tar.gz
3+
export PKG="shelf-reader-0.1.tar.gz"
4+
5+
# Upload it as an Artifact
6+
echo "Upload a Python Package"
7+
export ARTIFACT_HREF=$(http --form POST $BASE_ADDR/pulp/api/v3/artifacts/ \
8+
file@./$PKG | jq -r '.pulp_href')
9+
10+
echo "Inspecting artifact."
11+
http $BASE_ADDR$ARTIFACT_HREF
12+

docs/_scripts/package.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Create a Python package from an artifact
2+
echo "Create Python content from artifact."
3+
export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/content/python/packages/ \
4+
artifact=$ARTIFACT_HREF relative_path=$PKG filename=$PKG | jq -r '.task')
5+
6+
# Poll the task(here we use a function defined in docs/_scripts/base.sh)
7+
wait_until_task_finished $BASE_ADDR$TASK_URL
8+
9+
# After the task is complete, it gives us a new package (PythonPackage Content)
10+
echo "Set PACKAGE_HREF from finished task."
11+
export PACKAGE_HREF=$(http $BASE_ADDR$TASK_URL| jq -r '.created_resources | first')
12+
13+
echo "Inspecting Package."
14+
http $BASE_ADDR$PACKAGE_HREF
15+

docs/_static/api.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/workflows/upload.rst

Lines changed: 85 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,121 @@
11
Upload and Manage Content
22
=========================
3+
Content can be added to a repository not only by synchronizing from a remote source but also by uploading the files directly into Pulp.
34

45
Create a repository
56
-------------------
67

7-
If you don't already have a repository, create one::
8+
If you don't already have a repository, create one.
89

9-
$ http POST $BASE_ADDR/pulp/api/v3/repositories/python/python/ name=foo
10+
.. literalinclude:: ../_scripts/repo.sh
11+
:language: bash
1012

11-
Response::
13+
Repository GET response::
1214

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

1824

25+
1926
Upload a file to Pulp
2027
---------------------
2128

22-
Each artifact in Pulp represents a file. They can be created during sync or created manually by uploading a file::
29+
Each artifact in Pulp represents a file. They can be created during sync or created manually by uploading a file.
2330

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

26-
Response::
34+
Artifact GET response::
2735

2836
{
29-
"pulp_href": "http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/",
30-
...
37+
"file": "artifact/04/cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c",
38+
"md5": "2dac570a33d88ca224be86759be59376",
39+
"pulp_created": "2020-05-28T20:21:23.441981Z",
40+
"pulp_href": "/pulp/api/v3/artifacts/f87a20b0-d5b9-4a07-9282-bf7f9e5eb37f/",
41+
"sha1": "bf039b185ef1f308e7d0bc5322be10061ca4f695",
42+
"sha224": "01c8a673b13875cb12deb0e9fb2fddf3579583d7837b4458a78dd83c",
43+
"sha256": "04cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c",
44+
"sha384": "4c22ded8001904b4fedb3fa974c883479fb32d630ceb48d7455bfd390166afd73cfda5b4c9c0c8d3a19bb67966ae13d0",
45+
"sha512": "4d11d6a67ec6aa3eb25df2416b6d48f1c6c04d5e745b12d7dbc89aacfc8bcb439c5ccff56324ce8493099e4e2f79a414d2513758782efcaef84b3d8cf00ea45f",
46+
"size": 19097
3147
}
3248

3349

3450
Create content from an artifact
3551
-------------------------------
3652

37-
Now that Pulp has the content, its time to make it into a unit of content.
53+
Now that Pulp has the package, its time to make it into a unit of content.
3854

39-
$ 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
55+
.. literalinclude:: ../_scripts/package.sh
56+
:language: bash
4057

41-
Response::
58+
Content GET response::
4259

4360
{
44-
"pulp_href": "http://localhost:24817/pulp/api/v3/content/python/python/ae016be0-0499-4547-881f-c56a1d0186a6/",
45-
"_artifact": "http://localhost:24817/pulp/api/v3/artifacts/6f847a21-a177-4a49-ad47-86f415b3830d/",
46-
"digest": "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c",
47-
"filename": "my-content",
61+
"artifact": "/pulp/api/v3/artifacts/f87a20b0-d5b9-4a07-9282-bf7f9e5eb37f/",
62+
"author": "Austin Macdonald",
63+
"author_email": "asmacdo@gmail.com",
64+
"classifiers": [],
65+
"description": "too long to read",
66+
"download_url": "",
67+
"filename": "shelf-reader-0.1.tar.gz",
68+
"home_page": "https://github.com/asmacdo/shelf-reader",
69+
"keywords": "",
70+
"license": "GNU GENERAL PUBLIC LICENSE Version 2, June 1991",
71+
"maintainer": "",
72+
"maintainer_email": "",
73+
"metadata_version": "1.1",
74+
"name": "shelf-reader",
75+
"obsoletes_dist": "[]",
76+
"packagetype": "sdist",
77+
"platform": "",
78+
"project_url": "",
79+
"provides_dist": "[]",
80+
"pulp_created": "2020-05-28T20:49:12.156807Z",
81+
"pulp_href": "/pulp/api/v3/content/python/packages/2ac13c48-0f45-4811-80d2-5dcbb7821ce1/",
82+
"requires_dist": "[]",
83+
"requires_external": "[]",
84+
"requires_python": "",
85+
"summary": "Make sure your collections are in call number order.",
86+
"supported_platform": "",
87+
"version": "0.1"
4888
}
4989

90+
5091
Add content to a repository
5192
---------------------------
5293

53-
Once there is a content unit, it can be added and removed and from to repositories::
94+
Once there is a content unit, it can be added and removed from repositories using add_content_units or remove_content_units respectively.
95+
96+
.. literalinclude:: ../_scripts/add_content_repo.sh
97+
:language: bash
5498

55-
$ 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/\"]"
99+
Repository Version GET response (after task complete)::
100+
101+
{
102+
"base_version": null,
103+
"content_summary": {
104+
"added": {
105+
"python.python": {
106+
"count": 1,
107+
"href": "/pulp/api/v3/content/python/packages/?repository_version_added=/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/"
108+
}
109+
},
110+
"present": {
111+
"python.python": {
112+
"count": 1,
113+
"href": "/pulp/api/v3/content/python/packages/?repository_version=/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/"
114+
}
115+
},
116+
"removed": {}
117+
},
118+
"number": 1,
119+
"pulp_created": "2020-05-28T21:04:54.403979Z",
120+
"pulp_href": "/pulp/api/v3/repositories/python/python/931109d3-db86-4933-bf1d-45b4d4216d5d/versions/1/"
121+
}

0 commit comments

Comments
 (0)