Added TSDR CSIT Jobs into distribution-test Job
[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 function print_usage {
14     echo "Usage: $0 <staging-repo>"
15     echo ""
16     echo "    <staging-repo>   : The Nexus staging repo ID to sign."
17 }
18
19 if [ -z "$1" ]; then
20     print_usage
21     exit 1
22 fi
23
24 SIGNREPO=$1
25 SIGNATURES_DIR="gpg-signatures"
26 TMPFILE=/tmp/project-list.txt
27
28 wget -q https://nexus.opendaylight.org/content/repositories/$SIGNREPO/org/opendaylight/ -O $TMPFILE
29 PROJECTS=`grep '/</a>' $TMPFILE | sed -e 's#/</a>.*##' -e 's#.*/">##'`
30 echo "Projects detected: $PROJECTS"
31
32 #
33 # Prepare staging repo to upload signatures to
34 #
35
36 if [ -d "$SIGNATURES_DIR" ]; then
37     echo "$SIGNATURES_DIR directory exists. Clearing..."
38     rm -rf $SIGNATURES_DIR
39 fi
40 mkdir $SIGNATURES_DIR
41
42 mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy-staged-repository \
43     -DskipStagingRepositoryClose=true \
44     -DrepositoryDirectory="$SIGNATURES_DIR" \
45     -DnexusUrl=https://nexus.opendaylight.org/ \
46     -DstagingProfileId="425e43800fea70" \
47     -DserverId="opendaylight.staging" | tee /tmp/deploy-staged-repository.log
48
49 STAGED_REPO_ID=`grep 'Created staging repository with ID' /tmp/deploy-staged-repository.log | sed -e 's/.*ID "//' -e 's/".*//'`
50 echo "Staged Repo: $STAGED_REPO"
51
52 #
53 # Finally retrieve and sign artifacts.
54 #
55
56 for i in $PROJECTS
57 do
58     echo "Signing $i"
59     ./odlrelease sign http://nexus.opendaylight.org/content/repositories/$SIGNREPO/org/opendaylight/$i/
60     mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy-staged-repository \
61         -DskipStagingRepositoryClose=true \
62         -DstagingRepositoryId=$STAGED_REPO_ID \
63         -DrepositoryDirectory="$SIGNATURES_DIR" \
64         -DnexusUrl=https://nexus.opendaylight.org/ \
65         -DstagingProfileId="425e43800fea70" \
66         -DserverId="opendaylight.staging"
67 done