7563499018e5740d2f17745b1d6e7a3ab359f695
[releng/builder.git] / jjb / opendaylight-infra-deploy-maven-site.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 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 # Ensure we fail the job if any steps fail.
13 set -eu -o pipefail
14
15 # shellcheck disable=SC1090
16 . ~/lf-env.sh
17
18 # Check if openstack venv was previously created
19 if [ -f "/tmp/.os_lf_venv" ]; then
20     os_lf_venv=$(cat "/tmp/.os_lf_venv")
21 fi
22
23 if [ -d "${os_lf_venv}" ] && [ -f "${os_lf_venv}/bin/openstack" ]; then
24     echo "Re-use existing venv: ${os_lf_venv}"
25     PATH=$os_lf_venv/bin:$PATH
26 else
27     lf-activate-venv --python python3 lftools
28 fi
29
30 MAVEN_GROUP_ID=$(xmlstarlet sel \
31       -N "x=http://maven.apache.org/POM/4.0.0" \
32       -t \
33       --if "/x:project/x:groupId" \
34       -v "/x:project/x:groupId" \
35       --elif "/x:project/x:parent/x:groupId" \
36       -v "/x:project/x:parent/x:groupId" \
37       --else -o "" \
38       pom.xml 2>/dev/null)
39
40 cd "$WORKSPACE/target"
41 mv staged-site "$STREAM"
42 zip -r maven-site.zip "$STREAM"
43 lftools deploy nexus-zip "$NEXUS_URL" site "$MAVEN_GROUP_ID" maven-site.zip