6 if [ -z "$ARTIFACT_TYPE" ]; then
7 echo "ERROR: ARTIFACT_TYPE not provided...exiting"
12 echo "Uploading the Apex ${ARTIFACT_TYPE} artifact. This could take some time..."
13 echo "--------------------------------------------------------"
16 if [[ ! "$ARTIFACT_VERSION" =~ dev ]]; then
17 source $BUILD_DIRECTORY/../opnfv.properties
21 # clone releng repository
22 echo "Cloning releng repository..."
23 [ -d releng ] && rm -rf releng
24 git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
25 #this is where we import the siging key
26 if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then
27 if ! $WORKSPACE/releng/utils/gpg_import_key.sh; then
28 echo "WARNING: Failed to run gpg key import"
34 for artifact in $RPM_LIST $SRPM_LIST; do
35 echo "Signing artifact: ${artifact}"
36 gpg2 -vvv --batch --yes --no-tty \
37 --default-key opnfv-helpdesk@rt.linuxfoundation.org \
38 --passphrase besteffort \
39 --detach-sig $artifact
40 gsutil cp "$artifact".sig gs://$GS_URL/$(basename "$artifact".sig)
41 echo "Upload complete for ${artifact} signature"
46 gpg2 -vvv --batch --yes --no-tty \
47 --default-key opnfv-helpdesk@rt.linuxfoundation.org \
48 --passphrase besteffort \
49 --detach-sig $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso
51 gsutil cp $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso.sig gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso.sig
52 echo "ISO signature Upload Complete!"
56 gsutil cp $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log
57 echo "ISO Upload Complete!"
61 for artifact in $RPM_LIST $SRPM_LIST; do
62 echo "Uploading artifact: ${artifact}"
63 gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log
64 echo "Upload complete for ${artifact}"
66 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log
67 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log
69 # Make the property files viewable on the artifact site
71 -h "Content-Type:text/html" \
72 -h "Cache-Control:private, max-age=0, no-transform" \
73 gs://$GS_URL/latest.properties \
74 gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1
78 # Uploads snapshot artifact and updated properties file
79 echo "Uploading snapshot artifacts"
80 # snapshot dir is the same node in the create job workspace
81 # only 1 promotion job can run at a time on a slave
82 snapshot_dir="${WORKSPACE}/../apex-create-snapshot"
83 if [ -z "$SNAP_TYPE" ]; then
84 echo "ERROR: SNAP_TYPE not provided...exiting"
87 gsutil cp ${snapshot_dir}/apex-${SNAP_TYPE}-snap-`date +%Y-%m-%d`.tar.gz gs://$GS_URL/ > gsutil.iso.log
88 if [ "$SNAP_TYPE" == 'csit' ]; then
89 gsutil cp ${snapshot_dir}/snapshot.properties gs://$GS_URL/snapshot.properties > gsutil.latest.log
91 echo "Upload complete for Snapshot"
96 GERRIT_PATCHSET_NUMBER=$(echo $GERRIT_REFSPEC | grep -Eo '[0-9]+$')
97 export OPNFV_ARTIFACT_VERSION="dev${GERRIT_CHANGE_NUMBER}_${GERRIT_PATCHSET_NUMBER}"
98 echo "Uploading development build tarball"
99 pushd $BUILD_DIRECTORY > /dev/null
100 tar czf apex-${OPNFV_ARTIFACT_VERSION}.tar.gz *.qcow2 *.vmlinuz *.initrd
101 gsutil cp apex-${OPNFV_ARTIFACT_VERSION}.tar.gz gs://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz > gsutil.latest.log
105 # Always import the signing key, if it's available the artifacts will be
106 # signed before being uploaded
109 if gpg2 --list-keys | grep "opnfv-helpdesk@rt.linuxfoundation.org"; then
110 echo "Signing Key avaliable"
114 if [ "$ARTIFACT_TYPE" == 'snapshot' ]; then
116 elif [ "$ARTIFACT_TYPE" == 'iso' ]; then
117 if [[ "$ARTIFACT_VERSION" =~ dev || "$BRANCH" != 'stable/fraser' ]]; then
118 echo "Skipping ISO artifact upload for ${ARTIFACT_TYPE} due to dev/${BRANCH} build"
121 if [[ -n "$SIGN_ARTIFACT" && "$SIGN_ARTIFACT" == "true" ]]; then
125 elif [ "$ARTIFACT_TYPE" == 'rpm' ]; then
126 if [[ "$ARTIFACT_VERSION" =~ dev ]]; then
127 if [[ "$BRANCH" != 'stable/fraser' ]]; then
128 echo "will not upload artifacts, ${BRANCH} uses upstream"
131 echo "dev build detected, will upload image tarball"
132 ARTIFACT_TYPE=tarball
136 RPM_INSTALL_PATH=$BUILD_DIRECTORY/noarch
137 # RPM URL should be python package for master, and is only package we need
138 RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL)
139 SRPM_INSTALL_PATH=$BUILD_DIRECTORY
140 SRPM_LIST=$SRPM_INSTALL_PATH/$(basename $OPNFV_SRPM_URL)
141 if [[ "$BRANCH" == 'stable/fraser' ]]; then
142 VERSION_EXTENSION=$(echo $(basename $OPNFV_RPM_URL) | sed 's/opnfv-apex-//')
143 RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-undercloud-${VERSION_EXTENSION}"
144 RPM_LIST+=" ${RPM_INSTALL_PATH}/python34-opnfv-apex-${VERSION_EXTENSION}"
145 VERSION_EXTENSION=$(echo $(basename $OPNFV_SRPM_URL) | sed 's/opnfv-apex-//')
146 SRPM_LIST+=" ${SRPM_INSTALL_PATH}/opnfv-apex-undercloud-${VERSION_EXTENSION}"
147 SRPM_LIST+=" ${SRPM_INSTALL_PATH}/python34-opnfv-apex-${VERSION_EXTENSION}"
150 if [[ -n "$SIGN_ARTIFACT" && "$SIGN_ARTIFACT" == "true" ]]; then
156 echo "ERROR: Unknown artifact type ${ARTIFACT_TYPE} to upload...exiting"
161 echo "--------------------------------------------------------"
163 if [ "$ARTIFACT_TYPE" == 'iso' ]; then echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"; fi
164 if [ "$ARTIFACT_TYPE" == 'rpm' ]; then echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"; fi
165 if [ "$ARTIFACT_TYPE" == 'tarball' ]; then echo "Dev tarball Artifact is available as http://$GS_URL/apex-${OPNFV_ARTIFACT_VERSION}.tar.gz)"; fi