Apex: removes opendaylight-sfc rpm from upload
[releng.git] / jjb / apex / apex-upload-artifact.sh
1 #!/bin/bash
2 set -o errexit
3 set -o nounset
4 set -o pipefail
5
6 # log info to console
7 echo "Uploading the Apex artifact. This could take some time..."
8 echo "--------------------------------------------------------"
9 echo
10
11 # source the opnfv.properties to get ARTIFACT_VERSION
12 source $WORKSPACE/opnfv.properties
13
14 # clone releng repository
15 echo "Cloning releng repository..."
16 [ -d releng ] && rm -rf releng
17 git clone https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng/ &> /dev/null
18 #this is where we import the siging key
19 if [ -f $WORKSPACE/releng/utils/gpg_import_key.sh ]; then 
20   source $WORKSPACE/releng/utils/gpg_import_key.sh
21 fi
22
23 signrpm () {
24 for artifact in $RPM_LIST $SRPM_LIST; do
25   echo "Signing artifact: ${artifact}"
26   gpg2 -vvv --batch --yes --no-tty \
27     --default-key opnfv-helpdesk@rt.linuxfoundation.org \
28     --passphrase besteffort \
29     --detach-sig $artifact
30     gsutil cp "$artifact".sig gs://$GS_URL/$(basename "$artifact".sig)
31     echo "Upload complete for ${artifact} signature"
32 done
33 }
34
35 signiso () {
36 time gpg2 -vvv --batch --yes --no-tty \
37   --default-key opnfv-helpdesk@rt.linuxfoundation.org  \
38   --passphrase besteffort \
39   --detach-sig $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso
40
41 gsutil cp $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso.sig gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso.sig 
42 echo "ISO signature Upload Complete!"
43 }
44
45 uploadiso () {
46 # upload artifact and additional files to google storage
47 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
48 echo "ISO Upload Complete!"
49 RPM_INSTALL_PATH=$BUILD_DIRECTORY/noarch
50 RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL)
51 VERSION_EXTENSION=$(echo $(basename $OPNFV_RPM_URL) | sed 's/opnfv-apex-//')
52 for pkg in common undercloud onos; do
53     RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}"
54 done
55 SRPM_INSTALL_PATH=$BUILD_DIRECTORY
56 SRPM_LIST=$SRPM_INSTALL_PATH/$(basename $OPNFV_SRPM_URL)
57 VERSION_EXTENSION=$(echo $(basename $OPNFV_SRPM_URL) | sed 's/opnfv-apex-//')
58 for pkg in common undercloud onos; do
59     SRPM_LIST+=" ${SRPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}"
60 done
61 }
62
63 uploadrpm () {
64 #This is where we upload the rpms
65 for artifact in $RPM_LIST $SRPM_LIST; do
66   echo "Uploading artifact: ${artifact}"
67   gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log
68   echo "Upload complete for ${artifact}"
69 done
70 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log
71 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log
72 }
73
74 if gpg2 --list-keys | grep "opnfv-helpdesk@rt.linuxfoundation.org"; then
75   echo "Signing Key avaliable"
76   signiso
77   uploadiso
78   signrpm
79   uploadrpm
80 else
81   uploadiso
82   uploadrpm
83 fi
84
85 echo
86 echo "--------------------------------------------------------"
87 echo "Done!"
88 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
89 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"