Do not leave staging repo open
[releng/builder.git] / jjb / autorelease / include-raw-autorelease-maven-deploy.sh
1 #!/bin/bash
2 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
3 ##############################################################################
4 # Copyright (c) 2015 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11
12 # Job will pass in a variable ${DATESTAMP} if this variable is false than we
13 # we are likely releasing a release candidate. We should skip closing the
14 # Nexus staging repository so that we can sign the artifacts.
15 SKIP_STAGING_CLOSE=false
16 # TODO: Figure out a solution to Open staging repos not being available
17 #       immediately. This means integration tests cannot reliably download and
18 #       test the new build if we leave the staging repo open.
19 # if [ "${DATESTAMP}" == "false" ]
20 # then
21 #     SKIP_STAGING_CLOSE=true
22 # fi
23
24 mkdir -p hide/from/pom/files
25 cd hide/from/pom/files
26 mkdir -p m2repo/org/opendaylight/
27
28 (IFS='
29 '
30 for m in `xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' ../../../../pom.xml`; do
31     rsync -avz --exclude 'maven-metadata-local.xml' \
32                --exclude 'maven-metadata-*' \
33                --exclude '_remote.repositories' \
34                --exclude 'resolver-status.properties' \
35                "/tmp/r/org/opendaylight/$m" m2repo/org/opendaylight/
36 done)
37
38 # Add exception for integration project since they release under the
39 # integration top-level project.
40 rsync -avz --exclude 'maven-metadata-local.xml' \
41            --exclude 'maven-metadata-*' \
42            --exclude '_remote.repositories' \
43            --exclude 'resolver-status.properties' \
44            "/tmp/r/org/opendaylight/integration" m2repo/org/opendaylight/
45
46 mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.2:deploy-staged-repository \
47     -DskipStagingRepositoryClose=${SKIP_STAGING_CLOSE} \
48     -DrepositoryDirectory="`pwd`/m2repo" \
49     -DnexusUrl=http://nexus.opendaylight.org/ \
50     -DstagingProfileId="425e43800fea70" \
51     -DserverId="opendaylight.staging" \
52     -s $SETTINGS_FILE \
53     -gs $GLOBAL_SETTINGS_FILE | tee $WORKSPACE/deploy-staged-repository.log