aboutsummaryrefslogtreecommitdiffstats
path: root/screwdriver/upload-rpm-to-artifactory.sh
blob: 0c679debb48386dc781e64cf917696dd94d10ae4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

set -euo pipefail

RPM=$1
OS_DISTRO=centos
RELEASEVER=8
MATURITY=release
BASEARCH=x86_64

main() {
  if [[ -z $JFROG_API_TOKEN ]] || [[ -z $RPM ]]; then
      echo "Usage: $0 <RPM package>."
      echo "Environment variable JFROG_API_TOKEN must be set in environment."
      exit 1
  fi

  curl -vLf -H "Authorization: Bearer $JFROG_API_TOKEN" \
            -H "X-Checksum-Sha1: $(sha1sum $RPM | awk '{print $1}')" \
            -H "X-Checksum-Sha256: $(sha256sum $RPM | awk '{print $1}')" \
            -H "X-Checksum-MD5: $(md5sum $RPM | awk '{print $1}')" \
            -X PUT "https://artifactory.yahooinc.com/artifactory/vespa/$OS_DISTRO/$RELEASEVER/$MATURITY/$BASEARCH/Packages/$RPM" \
            -T $RPM
}

main "$@"