| #!/usr/bin/env bash |
| # |
| # ============LICENSE_START======================================================= |
| # Copyright (C) 2018-2019 Nordix Foundation. |
| # ================================================================================ |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| # ============LICENSE_END========================================================= |
| set -o errexit |
| set -o nounset |
| set -o pipefail |
| |
| ARTIFACTORY_URL="https://artifactory.nordix.org/artifactory" |
| GEODE_BUILD_VERSION=$(cat $WORKSPACE/geode-build-version/number) |
| GEODE_UPSTREAM_VERSION=$(echo ${GEODE_BUILD_VERSION} | awk -F "." '{print $1"."$2"."$3}') |
| cd $WORKSPACE/geode |
| |
| GEODE_ARTIFACT_PATH=$(find geode-assembly/build/distributions \( -name \*.tgz ! -name \*src.tgz \)) |
| GEODE_ARTIFACT=${GEODE_ARTIFACT_PATH##*/} |
| SHA_CHECKSUM=$(shasum -a 1 ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }') |
| SHA256_CHECKSUM=$(sha256sum ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }') |
| MD5_CHECKSUM=$(md5sum ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }') |
| |
| if [[ ${GEODE_BUILD_VERSION} =~ \.RC[0-9]+ ]] ; then |
| LOCATION="staging" |
| else |
| LOCATION="release" |
| fi |
| echo "-----------------------------------------------------------" |
| echo -e "\nUploading ${GEODE_ARTIFACT} to geode staging area: " |
| echo -e "geode/${GEODE_UPSTREAM_VERSION}/${LOCATION} on artifactory.nordix.org\n" |
| curl -H "X-JFrog-Art-Api:${ARTIFACTORY_API_KEY}" \ |
| -H "X-Checksum-Sha1:${SHA_CHECKSUM}" \ |
| -H "X-Checksum-Sha256:${SHA256_CHECKSUM}" \ |
| -H "X-Checksum-MD5:${MD5_CHECKSUM}" \ |
| -X PUT "${ARTIFACTORY_URL}/geode/${GEODE_UPSTREAM_VERSION}/${LOCATION}/${GEODE_ARTIFACT}" \ |
| -T ${GEODE_ARTIFACT_PATH} |
| echo "-----------------------------------------------------------" |