Make sure that jjb-cleanup.sh allows unbound vars
[releng/global-jjb.git] / shell / maven-stage.sh
1 #!/bin/bash -l
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 # This script publishes artifacts to a staging repo in Nexus.
13 #
14 # $WORKSPACE/m2repo   :  Exists and used to deploy the staging repository.
15 # $NEXUS_URL          :  Jenkins global variable should be defined.
16 # $STAGING_PROFILE_ID :  Provided by a job parameter.
17
18 # Ensure we fail the job if any steps fail.
19 set -xeu -o pipefail
20
21 TMP_FILE="$(mktemp)"
22 lftools deploy nexus-stage "$NEXUS_URL" "$STAGING_PROFILE_ID" "$WORKSPACE/m2repo" | tee "$TMP_FILE"
23 staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' "$TMP_FILE")
24
25 # Store repo info to a file in archives
26 mkdir -p "$WORKSPACE/archives"
27 echo "$staging_repo" > "$WORKSPACE/archives/staging-repo.txt"
28
29 # Cleanup
30 rm -f "$TMP_FILE"