robert.tomczyk | 0c8e2ec | 2019-07-25 16:50:20 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # ============LICENSE_START======================================================= |
| 4 | # Copyright (C) 2018-2019 Nordix Foundation. |
| 5 | # ================================================================================ |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ============LICENSE_END========================================================= |
| 20 | set -o errexit |
| 21 | set -o nounset |
| 22 | set -o pipefail |
| 23 | |
| 24 | ARTIFACTORY_URL="https://artifactory.nordix.org/artifactory" |
| 25 | GEODE_BUILD_VERSION=$(cat $WORKSPACE/geode-build-version/number) |
| 26 | GEODE_UPSTREAM_VERSION=$(echo ${GEODE_BUILD_VERSION} | awk -F "." '{print $1"."$2"."$3}') |
| 27 | cd $WORKSPACE/geode |
| 28 | |
| 29 | GEODE_ARTIFACT_PATH=$(find geode-assembly/build/distributions \( -name \*.tgz ! -name \*src.tgz \)) |
| 30 | GEODE_ARTIFACT=${GEODE_ARTIFACT_PATH##*/} |
| 31 | SHA_CHECKSUM=$(shasum -a 1 ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }') |
| 32 | SHA256_CHECKSUM=$(sha256sum ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }') |
| 33 | MD5_CHECKSUM=$(md5sum ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }') |
| 34 | |
| 35 | if [[ ${GEODE_BUILD_VERSION} =~ \.RC[0-9]+ ]] ; then |
| 36 | LOCATION="staging" |
| 37 | else |
| 38 | LOCATION="release" |
| 39 | fi |
| 40 | echo "-----------------------------------------------------------" |
| 41 | echo -e "\nUploading ${GEODE_ARTIFACT} to geode staging area: " |
| 42 | echo -e "geode/${GEODE_UPSTREAM_VERSION}/${LOCATION} on artifactory.nordix.org\n" |
| 43 | curl -H "X-JFrog-Art-Api:${ARTIFACTORY_API_KEY}" \ |
| 44 | -H "X-Checksum-Sha1:${SHA_CHECKSUM}" \ |
| 45 | -H "X-Checksum-Sha256:${SHA256_CHECKSUM}" \ |
| 46 | -H "X-Checksum-MD5:${MD5_CHECKSUM}" \ |
| 47 | -X PUT "${ARTIFACTORY_URL}/geode/${GEODE_UPSTREAM_VERSION}/${LOCATION}/${GEODE_ARTIFACT}" \ |
| 48 | -T ${GEODE_ARTIFACT_PATH} |
| 49 | echo "-----------------------------------------------------------" |