Add missing content/repositories path to URL
[releng/global-jjb.git] / shell / deploy-maven-file.sh
1 #!/bin/bash
2 # @License EPL-1.0 <http://spdx.org/licenses/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 packages (rpms/debs) or any file to Nexus hosted
13 # maven2 repository.
14 #
15 # $NEXUS_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 "---> deploy-maven-file.sh"
20 # Ensure we fail the job if any steps fail.
21 set -eu -o pipefail
22
23 DEPLOY_LOG="$WORKSPACE/archives/deploy-maven-file.log"
24 mkdir -p "$WORKSPACE/archives"
25
26 NEXUS_REPO_URL="${NEXUS_URL}/content/repositories/$REPO_ID"
27
28 while IFS="" read -r file
29 do
30     lftools deploy maven-file "$NEXUS_REPO_URL" \
31                               "$REPO_ID" \
32                               "$file" \
33                               -b "$MVN" \
34                               -g "$GROUP_ID" | tee "$DEPLOY_LOG"
35 done < <(find "$UPLOAD_FILES_PATH" -type f -name "*")