2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
12 echo "dovetail: pull and save the images"
14 [[ -d ${CACHE_DIR} ]] || mkdir -p ${CACHE_DIR}
17 sudo docker pull ${DOCKER_REPO_NAME}:${DOCKER_TAG}
18 sudo docker save -o ${STORE_FILE_NAME} ${DOCKER_REPO_NAME}:${DOCKER_TAG}
19 sudo chmod og+rw ${STORE_FILE_NAME}
21 OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
22 GS_UPLOAD_LOCATION="${STORE_URL}/${OPNFV_ARTIFACT_VERSION}"
24 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
25 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
26 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
27 echo "OPNFV_ARTIFACT_URL=$GS_UPLOAD_LOCATION"
28 echo "OPNFV_BUILD_URL=$BUILD_URL"
29 ) > $WORKSPACE/opnfv.properties
30 source $WORKSPACE/opnfv.properties
33 # clone releng repository
34 echo "Cloning releng repository..."
35 [ -d releng ] && rm -rf releng
36 git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
37 #this is where we import the siging key
38 if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
39 source $WORKSPACE/releng/utils/gpg_import_key.sh
44 gpg2 -vvv --batch --yes --no-tty \
45 --default-key opnfv-helpdesk@rt.linuxfoundation.org \
46 --passphrase besteffort \
47 --detach-sig ${CACHE_DIR}/${STORE_FILE_NAME}
49 gsutil cp ${CACHE_DIR}/${STORE_FILE_NAME}.sig ${STORE_URL}/${STORE_FILE_NAME}.sig
50 echo "signature Upload Complete!"
55 echo "Uploading ${STORE_FILE_NAME} to artifact. This could take some time..."
59 # upload artifact and additional files to google storage
60 gsutil cp ${CACHE_DIR}/${STORE_FILE_NAME} \
61 ${STORE_URL}/${STORE_FILE_NAME} > gsutil.dockerfile.log 2>&1
62 gsutil cp $WORKSPACE/opnfv.properties \
63 ${STORE_URL}/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
64 gsutil cp $WORKSPACE/opnfv.properties \
65 ${STORE_URL}/latest.properties > gsutil.latest.log 2>&1
68 -h "Content-Type:text/html" \
69 -h "Cache-Control:private, max-age=0, no-transform" \
70 ${STORE_URL}/latest.properties \
71 ${STORE_URL}/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
74 -h "Cache-Control:private, max-age=0, no-transform" \
75 ${STORE_URL}/${STORE_FILE_NAME} > /dev/null 2>&1
77 # disabled errexit due to gsutil setmeta complaints
78 # BadRequestException: 400 Invalid argument
79 # check if we uploaded the file successfully to see if things are fine
80 gsutil ls ${STORE_URL}/${STORE_FILE_NAME} > /dev/null 2>&1
81 if [[ $? -ne 0 ]]; then
82 echo "Problem while uploading artifact!"
86 echo "dovetail: uploading Done!"
88 echo "--------------------------------------------------------"