7 echo "Downloading the Apex artifact. This could take some time..."
8 echo "--------------------------------------------------------"
11 [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
13 if [ -z "$DEPLOY_SCENARIO" ]; then
14 echo "Deploy scenario not set!"
16 elif [[ "$DEPLOY_SCENARIO" == *gate* ]]; then
17 echo "Detecting Gating scenario..."
18 if [ -z "$GERRIT_EVENT_COMMENT_TEXT" ]; then
19 echo "ERROR: Gate job triggered without comment!"
22 DEPLOY_SCENARIO=$(echo ${GERRIT_EVENT_COMMENT_TEXT} | grep start-gate-scenario | grep -Eo 'os-.*$')
23 if [ -z "$DEPLOY_SCENARIO" ]; then
24 echo "ERROR: Unable to detect scenario in Gerrit Comment!"
25 echo "Format of comment to trigger gate should be 'start-gate-scenario: <scenario>'"
28 echo "Gate scenario detected: ${DEPLOY_SCENARIO}"
33 # if upstream we do not need to download anything
34 if [[ "$DEPLOY_SCENARIO" =~ upstream ]]; then
35 echo "Upstream deployment detected, skipping download artifact"
36 elif [[ "$ARTIFACT_VERSION" =~ dev ]]; then
38 GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$')
39 export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}"
41 pushd ${BUILD_DIRECTORY} > /dev/null
42 echo "Downloading packaged dev build: apex-${OPNFV_ARTIFACT_VERSION}.tar.gz"
43 curl --fail -s -o $BUILD_DIRECTORY/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz http://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz
44 tar -xvf apex-${OPNFV_ARTIFACT_VERSION}.tar.gz
47 echo "Will use RPMs..."
50 echo "Downloading latest properties file"
52 # get the properties file in order to get info regarding artifacts
53 curl --fail -s -o $BUILD_DIRECTORY/opnfv.properties http://$GS_URL/latest.properties
55 # source the file so we get OPNFV vars
56 source $BUILD_DIRECTORY/opnfv.properties
58 RPM_INSTALL_PATH=$(echo "http://"$OPNFV_RPM_URL | sed 's/\/'"$(basename $OPNFV_RPM_URL)"'//')
59 RPM_LIST=$(basename $OPNFV_RPM_URL)
62 VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | grep -Eo '[0-9]+\.[0-9]+-([0-9]{8}|[a-z]+-[0-9]\.[0-9]+)')
63 # build RPM List which already includes base Apex RPM
64 RPM_LIST+=" opnfv-apex-undercloud-${VERSION_EXTENSION}.noarch.rpm"
66 # add back legacy support for danube
67 if [ "$BRANCH" == 'stable/danube' ]; then
68 RPM_LIST+=" opnfv-apex-common-${VERSION_EXTENSION}.noarch.rpm"
70 RPM_LIST+=" python34-opnfv-apex-${VERSION_EXTENSION}.noarch.rpm"
73 # remove old / install new RPMs
74 if rpm -q opnfv-apex > /dev/null; then
75 INSTALLED_RPMS=$(rpm -qa | grep apex)
76 if [ -n "$INSTALLED_RPMS" ]; then
77 sudo yum remove -y ${INSTALLED_RPMS}
80 # Create an rpms dir on slave
83 # Remove older rpms which do not match this version
84 find . ! -name "*${VERSION_EXTENSION}.noarch.rpm" -type f -exec rm -f {} +
85 # Download RPM only if changed on server
86 for rpm in $RPM_LIST; do
87 wget -N ${RPM_INSTALL_PATH}/${rpm}
89 if ! sudo yum install -y $RPM_LIST; then
90 echo "Unable to install new RPMs: $RPM_LIST"
96 # TODO: Uncomment these lines to verify SHA512SUMs once the sums are
98 # echo "$OPNFV_ARTIFACT_SHA512SUM $BUILD_DIRECTORY/apex.iso" | sha512sum -c
99 # echo "$OPNFV_RPM_SHA512SUM $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL)" | sha512sum -c
102 ls -al $BUILD_DIRECTORY
105 echo "--------------------------------------------------------"