-
Notifications
You must be signed in to change notification settings - Fork 84
Swith to Master/Detail Publications #242
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| export BASE_ADDR=http://localhost:24817 | ||
| export CONTENT_ADDR=http://localhost:24816 | ||
|
|
||
| wait_for_pulp() { | ||
| unset CREATED_RESOURCE | ||
| local task_url=$1 | ||
| while [ -z "$CREATED_RESOURCE" ] | ||
|
|
||
| do | ||
| sleep 1 | ||
| export CREATED_RESOURCE=$(http $BASE_ADDR$task_url | jq -r '.created_resources | first') | ||
| done | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| pstop | ||
| pclean | ||
| prestart | ||
| pip uninstall -y shelf-reader | ||
|
|
||
| echo "is shelf reader installed?" | ||
| pip freeze | grep shelf-reader |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Distributions are created asynchronously. Create one, and specify the publication that will | ||
| # be served at the base path specified. | ||
| export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/distributions/ \ | ||
| name='baz' \ | ||
| base_path='foo' \ | ||
| publication=$PUBLICATION_HREF | jq -r '.task') | ||
|
|
||
| # Poll the task (here we use a function defined in docs/_scripts/base.sh) | ||
| # When the task is complete, it gives us the href for our new Distribution | ||
| wait_for_pulp $TASK_URL | ||
| export DIST_PATH=${CREATED_RESOURCE[0]} | ||
|
|
||
| # Lets inspect the Distribution | ||
| http $BASE_ADDR$DIST_PATH |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| echo 'pip install --trusted-host localhost -i $CONTENT_ADDR/pulp/content/foo/simple/ shelf-reader' | ||
| pip install --trusted-host localhost -i $CONTENT_ADDR/pulp/content/foo/simple/ shelf-reader | ||
|
|
||
| echo "is shelf reader installed?" | ||
| pip freeze | grep shelf-reader |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Create a new publication specifying the repository_version. | ||
| # Alternatively, you can specify the repository, and Pulp will assume the latest version. | ||
| export TASK_URL=$(http POST $BASE_ADDR/pulp/api/v3/publications/python/pypi/ \ | ||
| repository_version=$REPOVERSION_HREF | jq -r '.task') | ||
|
|
||
| # Poll the task (here we use a function defined in docs/_scripts/base.sh) | ||
| # When the task is complete, it gives us a new Publication | ||
| wait_for_pulp $TASK_URL | ||
| export PUBLICATION_HREF=${CREATED_RESOURCE[0]} | ||
|
|
||
|
|
||
| # Lets inspect our newly created Publication. | ||
| http $BASE_ADDR$PUBLICATION_HREF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # This script will execute the component scripts and ensure that the documented examples | ||
| # work as expected. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idea for another day: It might be worth running quickstart.sh when building the docs, to test it out. As a possible side benefit, we will populate the db, which might allow us to include examples in the REST API docs. |
||
|
|
||
| # THIS SCRIPT CURRENTLY MUST BE RUN IN A PULPLIFT DEVELOPMENT ENVIRONMENT | ||
| # TODO: remove the usage of pulp-devel bash functions so they can be directly modified | ||
| # for user environments. | ||
|
|
||
| # From the _scripts directory, run with `source quickstart.sh` (source to preserve the environment | ||
| # variables) | ||
| source clean.sh | ||
| source base.sh | ||
|
|
||
| source repo.sh | ||
| source remote.sh | ||
| source sync.sh | ||
|
|
||
| source publication.sh | ||
| source distribution.sh | ||
| source pip.sh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Create a remote that syncs some versions of django into your repository. | ||
| http POST $BASE_ADDR/pulp/api/v3/remotes/python/python/ \ | ||
| name='bar' \ | ||
| url='https://pypi.org/' \ | ||
| includes:='[{"name": "shelf-reader"}]' | ||
|
|
||
| # Export an environment variable for the new remote URI. | ||
| export REMOTE_HREF=$(http $BASE_ADDR/pulp/api/v3/remotes/python/python/ | jq -r '.results[] | select(.name == "bar") | ._href') | ||
|
|
||
| # Lets inspect our newly created RepositoryVersion. | ||
| http $BASE_ADDR$REMOTE_HREF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Start by creating a new repository named "foo": | ||
| http POST $BASE_ADDR/pulp/api/v3/repositories/ name=foo | ||
|
|
||
| # If you want to copy/paste your way through the guide, | ||
| # create an environment variable for the repository URI. | ||
| export REPO_HREF=$(http $BASE_ADDR/pulp/api/v3/repositories/ | \ | ||
| jq -r '.results[] | select(.name == "foo") | ._href') | ||
|
|
||
| # Lets inspect our newly created repository. | ||
| http $BASE_ADDR$REPO_HREF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Using the Remote we just created, we kick off a sync task | ||
| export TASK_URL=$(http POST $BASE_ADDR$REMOTE_HREF'sync/' repository=$REPO_HREF mirror=False \ | ||
| | jq -r '.task') | ||
|
|
||
| # Poll the task (here we use a function defined in docs/_scripts/base.sh) | ||
| # When the task is complete, it gives us a new repository version | ||
| wait_for_pulp $TASK_URL | ||
| export REPOVERSION_HREF=${CREATED_RESOURCE[0]} | ||
|
|
||
| # Lets inspect our newly created RepositoryVersion | ||
| http $BASE_ADDR$REPOVERSION_HREF |
Large diffs are not rendered by default.
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.
This seems to fail sometimes, CREATED_RESOURCE gets set to
null.