Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions utils/scripts/pulp-upload
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,22 @@ for file in *.whl *.tar.gz; do
echo "Uploaded $file with attestation."
uploaded+=("$file")
else
echo "ERROR: Failed to upload $file"
failed+=("$file")
# Upload failed — could be a race condition where another task uploaded it first.
# Re-fetch the latest repository version and check if the package exists now.
echo "Upload failed for $file, checking if another task uploaded it..."
sleep 5
PULP_REPOSITORY_VERSION=$( curl --fail --silent --retry 3 --max-time 30 "${PULP_QUERY_BASE}repositories/python/python/" \
| jq -r ".results[] | select(.name==\"${PULP_REPOSITORY}\") | .latest_version_href" )
WHEEL_EXISTS_NOW=$( curl --fail --silent --retry 3 --max-time 30 -G \
"${PULP_QUERY_BASE}content/python/packages/" --data-urlencode "filename=${file}" \
--data-urlencode "repository_version=${PULP_REPOSITORY_VERSION}" | jq '.results | length != 0' )
if $WHEEL_EXISTS_NOW; then
echo "Package ${file} was probably uploaded by another task — not an error."
skipped_existing+=("$file")
else
echo "ERROR: Failed to upload $file"
failed+=("$file")
fi
fi
done

Expand Down