Update infrautils jobs for 2024.09 Scandium
[releng/builder.git] / jjb / opflex / scripts / deploy-opflex.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 # Todo: remove this script once change no 5753 is merged in global-jjb
13 # This script publishes OpFlex artifacts to Nexus repository.
14 #
15 # $MAVEN_REPO_URL          :  Jenkins global variable should be defined.
16 # $REPO_ID                 :  Provided by a job parameter.
17 # $GROUP_ID                :  Provided by a job parameter.
18 # $UPLOAD_FILES_PATH        :  Provided by a job parameter.
19 echo "---> scripts/deploy-opflex.sh"
20
21 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
22 # Ensure we fail the job if any steps fail.
23 set -e -o pipefail
24 set +u
25
26 export MAVEN_OPTIONS
27 export MAVEN_PARAMS
28
29 DEPLOY_LOG="$WORKSPACE/archives/deploy-maven-file.log"
30 mkdir -p "$WORKSPACE/archives"
31
32 while IFS="" read -r file
33 do
34     lftools deploy maven-file "$MAVEN_REPO_URL" \
35                               "$REPO_ID" \
36                               "$file" \
37                               -b "$MVN" \
38                               -g "$GROUP_ID" \
39                               -p "$MAVEN_PARAMS $MAVEN_OPTIONS" \
40                               |& tee "$DEPLOY_LOG"
41 done < <(find "$UPLOAD_FILES_PATH" -type f -name "*")