Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / shell / maven-build-deps.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 echo "---> maven-build-deps.sh"
12 # Builds projects provided via $DEPENDENCY_BUILD_ORDER list
13 #
14 # This runs a `mvn clean install` against all projects provided by a list. This
15 # script is a companion script for the gerrit-fetch-dependencies script which
16 # clones project repos to "$WORKSPACE/.repos".
17
18 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
19 # Ensure we fail the job if any steps fail.
20 set -e -o pipefail
21 set +u
22
23 IFS=" " read -r -a PROJECTS <<< "$DEPENDENCY_BUILD_ORDER"
24 REPOS_DIR="$WORKSPACE/.repos"
25
26 export MAVEN_OPTS
27
28 for project in "${PROJECTS[@]}"; do
29     pushd "$REPOS_DIR/$project"
30     # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
31     # shellcheck disable=SC2086
32     $MVN clean install \
33         -e -Pq \
34         -DskipTests=true \
35         --global-settings "$GLOBAL_SETTINGS_FILE" \
36         --settings "$SETTINGS_FILE" \
37         $MAVEN_OPTIONS $MAVEN_PARAMS
38     popd
39 done