Skip to content

Advanced Copy

You can copy packages between Pulp repositories, along with all associated structure content using the advanced copy API.

For example, let us first set up an example repository with some test content:

pulp deb remote create --name=${NAME} ${REMOTE_OPTIONS[@]}
pulp deb repository create --name=${NAME}-src --remote=${NAME}
pulp deb repository sync --name=${NAME}-src

Now let us copy just one package from this src repository to a different target repository using the advanced copy API:

SRC_VERSION_HREF=$(pulp deb repository show --name=${NAME}-src | jq -r '.latest_version_href')
TARGET_REPO_HREF=$(pulp deb repository create --name=${NAME}-target | jq -r '.pulp_href')
  pulp deb repository content --type=package list --repository=${NAME}-src \
  | jq -r '.[0].pulp_href'
echo "\
    \"source_repo_version\": \"${SRC_VERSION_HREF}\",
    \"dest_repo\": \"${TARGET_REPO_HREF}\",
    \"content\": [
]" > copy_config.json
http post ${PULP_URL}/pulp/api/v3/deb/copy/ config:=@copy_config.json

After the copy task has completed, check the new repository version to see we do not just have deb.package type content, but also structure content of type deb.package_release_component and others:

pulp deb repository version show --repository=${NAME}-target

Our example copy_config.json from the above example might look like this:

    "source_repo_version": "/pulp/api/v3/repositories/deb/apt/018a600b-06d1-71a8-ac7f-6275e8ed7fd7/versions/1/",
    "dest_repo": "/pulp/api/v3/repositories/deb/apt/018a600b-a719-75ea-b7b8-4916176496ba/",
    "content": [

This example could easily be extended with extra values in the "content" list to copy several packages at once.