Merge "Compress large error attachments"
[releng/builder.git] / scripts / odlsign-bulk
1 #!/bin/bash
2
3 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
4 ##############################################################################
5 # Copyright (c) 2016 The Linux Foundation and others.
6 #
7 # All rights reserved. This program and the accompanying materials
8 # are made available under the terms of the Eclipse Public License v1.0
9 # which accompanies this distribution, and is available at
10 # http://www.eclipse.org/legal/epl-v10.html
11 ##############################################################################
12
13 # Force any errors to cause the script to end with failure
14 set -eu -o pipefail
15
16 function print_usage {
17     echo "Usage: $0 <staging-repo>"
18     echo ""
19     echo "    <staging-repo>   : The Nexus staging repo ID to sign."
20 }
21
22 if [ -z "$1" ]; then
23     print_usage
24     exit 1
25 fi
26
27 SIGNREPO=$1
28 SIGNATURES_DIR="gpg-signatures"
29 TMPFILE=/tmp/project-list.txt
30
31 wget -q https://nexus.opendaylight.org/content/repositories/$SIGNREPO/org/opendaylight/ -O $TMPFILE
32 PROJECTS=`grep '/</a>' $TMPFILE | sed -e 's#/</a>.*##' -e 's#.*/">##'`
33 echo "Projects detected: $PROJECTS"
34
35 #
36 # Prepare staging repo to upload signatures to
37 #
38
39 if [ -d "$SIGNATURES_DIR" ]; then
40     echo "$SIGNATURES_DIR directory exists. Clearing..."
41     rm -rf $SIGNATURES_DIR
42 fi
43 mkdir $SIGNATURES_DIR
44
45 mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy-staged-repository \
46     -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
47     -DskipStagingRepositoryClose=true \
48     -DrepositoryDirectory="$SIGNATURES_DIR" \
49     -DnexusUrl=https://nexus.opendaylight.org/ \
50     -DstagingProfileId="425e43800fea70" \
51     -DserverId="opendaylight.staging" | tee /tmp/deploy-staged-repository.log
52
53 STAGED_REPO_ID=`grep 'Created staging repository with ID' /tmp/deploy-staged-repository.log | sed -e 's/.*ID "//' -e 's/".*//'`
54 echo "Staged Repo: $STAGED_REPO_ID"
55
56 #
57 # Finally retrieve and sign artifacts.
58 #
59
60 for i in $PROJECTS
61 do
62     echo "Signing $i"
63     ./odlrelease sign http://nexus.opendaylight.org/content/repositories/$SIGNREPO/org/opendaylight/$i/
64     mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy-staged-repository \
65         -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
66         -DskipStagingRepositoryClose=true \
67         -DstagingRepositoryId=$STAGED_REPO_ID \
68         -DrepositoryDirectory="$SIGNATURES_DIR" \
69         -DnexusUrl=https://nexus.opendaylight.org/ \
70         -DstagingProfileId="425e43800fea70" \
71         -DserverId="opendaylight.staging"
72 done