Summary
Today with pulp-cli, if a user wants to upload 3 rpms, they have to run:
pulp artifact upload --file "$PKG1"
pulp artifact upload --file "$PKG2"
pulp artifact upload --file "$PKG3"
Then for each of those you have to grab the href of each artifact and fetch the sha256:
pulp show --href "${ARTIFACT_HREF_1}" | jq -r '.sha256')
pulp show --href "${ARTIFACT_HREF_2}" | jq -r '.sha256')
pulp show --href "${ARTIFACT_HREF_3}" | jq -r '.sha256'
Then for each of those, they have to use the sha256 to create a content unit and grab the unit href:
PACKAGE_HREF1=$(pulp rpm content create --sha256 "${ARTIFACT_SHA256}" | jq -r '.pulp_href')
PACKAGE_HREF2=$(pulp rpm content create --sha256 "${ARTIFACT_SHA256}" | jq -r '.pulp_href')
PACKAGE_HREF3=$(pulp rpm content create --sha256 "${ARTIFACT_SHA256}" | jq -r '.pulp_href')
Finally you can add these to a repository:
TASK_HREF=$(pulp rpm repository content modify
--repository "${REPO_NAME}"
--add-content "[{"pulp_href": "${PACKAGE_HREF1}"}, {"pulp_href": "${PACKAGE_HREF2}"}, {"pulp_href": "${PACKAGE_HREF3}"}]"
2>&1 >/dev/null | awk '{print $4}')
This is a LOT of commands to run for a user and there isn't an easy way for me to easily give a couple commands to a user to run to upload an arbitrary list of rpms. Having a command that handled everything and simply took in a list of rpms and outputted a repo version would be much simpler.
An example of what i'm thinking of:
# pulp rpm repository content upload --repository "${REPO_NAME}" --files=*.rpm
A new repository version has been created at /pulp/api/v3/repositories/rpm/abcdef/versions/5
This command would need to handle things such as:
- An rpm already exists (such as if i interrupt the command half way through and restart it)
Examples
Summary
Today with pulp-cli, if a user wants to upload 3 rpms, they have to run:
pulp artifact upload --file "$PKG1"
pulp artifact upload --file "$PKG2"
pulp artifact upload --file "$PKG3"
Then for each of those you have to grab the href of each artifact and fetch the sha256:
pulp show --href "${ARTIFACT_HREF_1}" | jq -r '.sha256')
pulp show --href "${ARTIFACT_HREF_2}" | jq -r '.sha256')
pulp show --href "${ARTIFACT_HREF_3}" | jq -r '.sha256'
Then for each of those, they have to use the sha256 to create a content unit and grab the unit href:
PACKAGE_HREF1=$(pulp rpm content create --sha256 "${ARTIFACT_SHA256}" | jq -r '.pulp_href')
PACKAGE_HREF2=$(pulp rpm content create --sha256 "${ARTIFACT_SHA256}" | jq -r '.pulp_href')
PACKAGE_HREF3=$(pulp rpm content create --sha256 "${ARTIFACT_SHA256}" | jq -r '.pulp_href')
Finally you can add these to a repository:
TASK_HREF=$(pulp rpm repository content modify
--repository "${REPO_NAME}"
--add-content "[{"pulp_href": "${PACKAGE_HREF1}"}, {"pulp_href": "${PACKAGE_HREF2}"}, {"pulp_href": "${PACKAGE_HREF3}"}]"
2>&1 >/dev/null | awk '{print $4}')
This is a LOT of commands to run for a user and there isn't an easy way for me to easily give a couple commands to a user to run to upload an arbitrary list of rpms. Having a command that handled everything and simply took in a list of rpms and outputted a repo version would be much simpler.
An example of what i'm thinking of:
This command would need to handle things such as:
Examples