GEODE: Publish geode to Nordix Artifactory 47/1747/9
authorrobert.tomczyk <robert.tomczyk@est.tech>
Thu, 25 Jul 2019 15:50:20 +0000 (16:50 +0100)
committerrobert.tomczyk <robert.tomczyk@est.tech>
Fri, 26 Jul 2019 10:49:22 +0000 (11:49 +0100)
Change-Id: Idce925d1f77ce92cb193eddd31ff6f5f715b734b

jjb/geode/apache-geode-build/apache-geode-build.yaml
jjb/geode/apache-geode-build/execute_build.sh
jjb/geode/apache-geode-build/publish_geode.sh [new file with mode: 0644]
jjb/geode/apache-geode-build/set_geode_build_version.sh
jjb/geode/apache-geode-macros.yaml
jjb/geode/global-template-apache-geode-build.yaml

index 1e52b34fb53d6accfecb1fbbfe6e2262d8f86f81..970a3fd0753faeabb76584708ea52764f3399b74 100644 (file)
@@ -19,7 +19,7 @@
 # ============LICENSE_END=========================================================
 
 - project:
-    name: 'apache-geode-build'
+    name: 'apache-geode-build-release'
     build-executor: 'apache-geode-execute-build-macro'
 
     artifact-slug: 'build'
@@ -30,4 +30,4 @@
     dunit-parallel-forks: '0'
 
     jobs:
-      - 'apache-geode-build-jdk{java-build-version}'
+      - 'apache-geode-build-release-jdk{java-build-version}'
index 8e3a5b658d6df55646c53d5fbefeae153679aec7..7a08281300bac1761541f5125359e76fbf37d9c5 100755 (executable)
@@ -49,7 +49,8 @@ if [ -e "${ROOT_DIR}/geode-build-version" ] ; then
   else
     GEODE_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE} | cut -d'-' -f1)
     echo -e "\nGEODE VERSION is ${GEODE_VERSION}"
-    BUILD_ID=$(cat ${GEODE_BUILD_VERSION_FILE} | cut -d'.' -f4)
+    BUILD_DATE=$(cat ${GEODE_BUILD_VERSION_FILE} | cut -d'-' -f2 | cut -d'.' -f2)
+    echo -e "GEODE BUILD_DATE is ${BUILD_DATE}"
     FULL_PRODUCT_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE})
     echo -e "FULL PRODUCT VERSION is ${FULL_PRODUCT_VERSION}\n"
   fi
@@ -84,7 +85,7 @@ GRADLE_ARGS="\
     ${GRADLE_SKIP_TASK_OPTIONS} \
     ${GRADLE_GLOBAL_ARGS} \
     -Pversion=${FULL_PRODUCT_VERSION} \
-    -PbuildId=${BUILD_ID} \
+    -PbuildId=${BUILD_DATE} \
     build install javadoc spotlessCheck rat checkPom resolveDependencies -x test"
 
 EXEC_COMMAND="mkdir -p tmp && cd geode && ${SET_JAVA_HOME} && ./gradlew ${GRADLE_ARGS}"
diff --git a/jjb/geode/apache-geode-build/publish_geode.sh b/jjb/geode/apache-geode-build/publish_geode.sh
new file mode 100644 (file)
index 0000000..a428a09
--- /dev/null
@@ -0,0 +1,49 @@
+#!/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 "-----------------------------------------------------------"
index c597b8bf812994fbd73008dd14b23ad8ceaca46d..4028771b5b3a45f28200a2f48b680c41235ae0c1 100755 (executable)
@@ -24,8 +24,15 @@ set -o pipefail
 cd $WORKSPACE/geode
 
 # Get most recent tag that is reachable from a commit
-GEODE_VERSION=$(git describe  | sed -r "s#rel/v(.*)#\1#")
+GEODE_VERSION=$(git describe --abbrev=0 | sed -r "s#rel/v(.*)#\1#")
+BUILD_DATE=$(date '+%Y%m%d%H%M')
 if [ ! -d ${WORKSPACE}/geode-build-version ] ; then
    mkdir ${WORKSPACE}/geode-build-version
 fi
-echo "$GEODE_VERSION" > ${WORKSPACE}/geode-build-version/number
+# Make sure the Geode tag version is in agreed fromat: \d.\d.\d.[ \d or RC\d ]
+if [[ ${GEODE_VERSION} =~ ^[0-9]+\.[0-9]+\.[0-9]+\.(RC[0-9]+|[0-9]+)$ ]] ; then
+  echo "${GEODE_VERSION}-NORDIX.${BUILD_DATE}" > ${WORKSPACE}/geode-build-version/number
+else
+  echo "ERROR: Incorrect geode version specified: ${GEODE_VERSION}"
+  exit 1
+fi
index 71aca9f8b76abc2194b4a7be67b4bab1a0b70ae0..a2a32bec0772384d653b08ce33107a99b2d17d89 100644 (file)
@@ -38,6 +38,8 @@
           !include-raw: ./apache-geode-build/set_geode_build_version.sh
       - shell:
           !include-raw: ./apache-geode-build/execute_build.sh
+      - shell:
+          !include-raw: ./apache-geode-build/publish_geode.sh
 
 - builder:
     name: 'apache-geode-setup-slave-macro'
index a78b074ad4d920ebbda20bea271d5f9095029714..c114282dd84cccc0e8f0cfa12bf3aebdb4b8e445 100644 (file)
@@ -18,7 +18,7 @@
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 - job-template:
-    name: 'apache-geode-build-jdk{java-build-version}'
+    name: 'apache-geode-build-release-jdk{java-build-version}'
 
     node: geode-ubuntu1804
     disabled: false
       - logrotate
       - github:
           url: 'https://github.com/Nordix/geode.git/'
+    wrappers:
+      - credentials-binding:
+          - username-password-separated:
+              credential-id: infra-nordix-artifactory-api-key
+              username: ARTIFACTORY_USER
+              password: ARTIFACTORY_API_KEY
 
     parameters:
       - string: