blob: a428a092753ae8668e79acc182a0f41c70bb5698 [file] [log] [blame]
robert.tomczyk0c8e2ec2019-07-25 16:50:20 +01001#!/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=========================================================
20set -o errexit
21set -o nounset
22set -o pipefail
23
24ARTIFACTORY_URL="https://artifactory.nordix.org/artifactory"
25GEODE_BUILD_VERSION=$(cat $WORKSPACE/geode-build-version/number)
26GEODE_UPSTREAM_VERSION=$(echo ${GEODE_BUILD_VERSION} | awk -F "." '{print $1"."$2"."$3}')
27cd $WORKSPACE/geode
28
29GEODE_ARTIFACT_PATH=$(find geode-assembly/build/distributions \( -name \*.tgz ! -name \*src.tgz \))
30GEODE_ARTIFACT=${GEODE_ARTIFACT_PATH##*/}
31SHA_CHECKSUM=$(shasum -a 1 ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }')
32SHA256_CHECKSUM=$(sha256sum ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }')
33MD5_CHECKSUM=$(md5sum ${GEODE_ARTIFACT_PATH} | awk '{ print $1 }')
34
35if [[ ${GEODE_BUILD_VERSION} =~ \.RC[0-9]+ ]] ; then
36 LOCATION="staging"
37else
38 LOCATION="release"
39fi
40echo "-----------------------------------------------------------"
41echo -e "\nUploading ${GEODE_ARTIFACT} to geode staging area: "
42echo -e "geode/${GEODE_UPSTREAM_VERSION}/${LOCATION} on artifactory.nordix.org\n"
43curl -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}
49echo "-----------------------------------------------------------"