Scripting

Each workflow renders bash scripts that allow the developers to ensure the continued correctness of the instructions. These scripts may also be helpful to users as a basis for their own scripts. All of the scripts can be found at https://github.com/pulp/pulp_file/tree/main/docs/_scripts/

The following scripts are used in conjunction with all the workflow scripts:

Setup

#!/usr/bin/env bash
set -e

echo "Setting environment variables for default hostname/port for the API and the Content app"
export BASE_ADDR=${BASE_ADDR:-http://localhost:24817}

if [ -z "$(pip freeze | grep pulp-cli)" ]; then
  echo "Installing pulp-cli"
  pip install pulp-cli[pygments]
fi

if [ ! -f ~/.config/pulp/settings.toml ]; then
  echo "Configuring pulp-cli"
  mkdir -p ~/.config/pulp
  cat > ~/.config/pulp/cli.toml << EOF
[cli]
base_url = "$BASE_ADDR"
verify_ssl = false
format = "json"
EOF
fi

Correctness Check (Destructive)

To check the correctness of the sync and publish workflow scripts, they can all be run together using:

#!/usr/bin/env bash

# This script will execute the component scripts and ensure that the documented examples
# work as expected.

# From the _scripts directory, run with `source docs_check_sync_publish.sh` (source to preserve the
# environment variables)
source setup.sh

source repo.sh
source remote.sh
source sync.sh

source publication.sh
source distribution.sh
source download_after_sync.sh

To check the correctness of the upload and publish workflow scripts, they can all be run together using: script.

#!/usr/bin/env bash

# This script will execute the component scripts and ensure that the documented examples
# work as expected.

# NOTE: These scripts use httpie and requires a .netrc for authentication with Pulp

# From the _scripts directory, run with `source docs_check_upload_publish.sh` (source to preserve
# the environment variables)
source setup.sh

source repo.sh
source artifact.sh
source content.sh
source add_remove.sh

source publication.sh
source distribution.sh
source download_after_upload.sh