diff options
author | Arnstein Ressem <aressem@yahooinc.com> | 2023-11-03 10:50:25 +0100 |
---|---|---|
committer | Arnstein Ressem <aressem@yahooinc.com> | 2023-11-03 10:50:25 +0100 |
commit | a1a0df2bf50ed9904c9ba8f858a9b1eaa703348c (patch) | |
tree | efa75e002d29ca5275e8e2a30749b5c05d4429cf /screwdriver/upload-rpm-to-cloudsmith.sh | |
parent | 96f6abe9caa338074ee39cb2fd566d3efff464c9 (diff) |
Add job for periodic upload to cloudsmith.
Diffstat (limited to 'screwdriver/upload-rpm-to-cloudsmith.sh')
-rwxr-xr-x | screwdriver/upload-rpm-to-cloudsmith.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/screwdriver/upload-rpm-to-cloudsmith.sh b/screwdriver/upload-rpm-to-cloudsmith.sh new file mode 100755 index 00000000000..dd24185433b --- /dev/null +++ b/screwdriver/upload-rpm-to-cloudsmith.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +set -euo pipefail + +if (( $# < 1 )); then + echo "Usage: $0 <RPM file>" + exit 1 +fi + +if [[ -z $CLOUDSMITH_API_CREDS ]]; then + echo "Environment CLOUDSMITH_API_CREDS not set. Exiting." + exit 1 +fi + +RPM=$1 +OS_DISTRO=el +RELEASEVER=8 + +main() { + + FID=$(curl -sLf \ + --upload-file $RPM \ + -u "$CLOUDSMITH_API_CREDS" \ + -H "Content-Sha256: $(sha256sum $RPM | cut -f1 -d' ')" \ + https://upload.cloudsmith.io/vespa/vespa/$RPM | jq -re '.identifier') + + if [[ -n $FID ]]; then + curl -sLf -X POST -H "Content-Type: application/json" \ + -u "$CLOUDSMITH_API_CREDS" \ + -d "{\"package_file\": \"$FID\", \"distribution\": \"$OS_DISTRO/$RELEASEVER\"}" \ + https://api-prd.cloudsmith.io/v1/packages/vespa/vespa/upload/rpm/ + fi +} + +main "$@" |