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}
20 OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
21 GS_UPLOAD_LOCATION="${STORE_URL}/${OPNFV_ARTIFACT_VERSION}"
23 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
24 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
25 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
26 echo "OPNFV_ARTIFACT_URL=$GS_UPLOAD_LOCATION"
27 echo "OPNFV_BUILD_URL=$BUILD_URL"
28 ) > $WORKSPACE/opnfv.properties
29 source $WORKSPACE/opnfv.properties
32 # clone releng repository
33 echo "Cloning releng repository..."
34 [ -d releng ] && rm -rf releng
35 git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
36 #this is where we import the siging key
37 if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
38 source $WORKSPACE/releng/utils/gpg_import_key.sh
43 gpg2 -vvv --batch --yes --no-tty \
44 --default-key opnfv-helpdesk@rt.linuxfoundation.org \
45 --passphrase besteffort \
46 --detach-sig ${CACHE_DIR}/${STORE_FILE_NAME}
48 gsutil cp ${CACHE_DIR}/${STORE_FILE_NAME}.sig ${STORE_URL}/${STORE_FILE_NAME}.sig
49 echo "signature Upload Complete!"
54 echo "Uploading to artifact. This could take some time..."
58 # upload artifact and additional files to google storage
59 gsutil cp ${CACHE_DIR}/${STORE_FILE_NAME} \
60 ${STORE_URL}/${STORE_FILE_NAME} > gsutil.dockerfile.log 2>&1
61 gsutil cp $WORKSPACE/opnfv.properties \
62 ${STORE_URL}/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
63 gsutil cp $WORKSPACE/opnfv.properties \
64 ${STORE_URL}/latest.properties > gsutil.latest.log 2>&1
67 -h "Content-Type:text/html" \
68 -h "Cache-Control:private, max-age=0, no-transform" \
69 ${STORE_URL}/latest.properties \
70 ${STORE_URL}/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
73 -h "Cache-Control:private, max-age=0, no-transform" \
74 ${STORE_URL}/${STORE_FILE_NAME} > /dev/null 2>&1
76 # disabled errexit due to gsutil setmeta complaints
77 # BadRequestException: 400 Invalid argument
78 # check if we uploaded the file successfully to see if things are fine
79 gsutil ls ${STORE_URL}/${STORE_FILE_NAME} > /dev/null 2>&1
80 if [[ $? -ne 0 ]]; then
81 echo "Problem while uploading artifact!"
85 echo "dovetail: uploading Done!"
87 echo "--------------------------------------------------------"