3 # Copyright (c) 2020 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 echo "---> jjb/scripts/maven_push_functions.sh"
19 echo "*******************************************************************"
20 echo "* STARTING PUSH OF PACKAGES TO REPOS"
21 echo "* NOTHING THAT HAPPENS BELOW THIS POINT IS RELATED TO BUILD FAILURE"
22 echo "*******************************************************************"
24 [ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn"
25 GROUP_ID="io.fd.${PROJECT}"
26 BASEURL="${NEXUSPROXY}/content/repositories/fd.io."
39 d_classifier="-Dclassifier=$7"
42 if [ ! -f "$push_file" ] ; then
43 echo "file for deployment does not exist: $push_file"
47 # Disable checks for doublequote to prevent glob / splitting
48 # shellcheck disable=SC2086
49 $MVN -B org.apache.maven.plugins:maven-deploy-plugin:deploy-file \
50 -Dfile=$push_file -DrepositoryId=$repoId \
51 -Durl=$url -DgroupId=$GROUP_ID \
52 -Dversion=$version -DartifactId=$artifactId \
53 -Dtype=$file_type $d_classifier\
54 -gs $GLOBAL_SETTINGS_FILE -s $SETTINGS_FILE
56 # make sure the script bombs if we fail an upload
57 if [ "$?" != '0' ]; then
58 echo "ERROR: There was an error with the upload"
66 repoId="${BASEREPOID}snapshot"
67 url="${BASEURL}snapshot"
70 # * jvpp-registry-16.09.jar
73 basefile=$(basename -s .jar "$jarfile")
74 artifactId=$(echo "$basefile" | rev | cut -d '-' -f 2- | rev)
75 version=$(echo "$basefile" | rev | cut -d '-' -f 1 | rev)
77 push_file "$jarfile" "$repoId" "$url" "${version}-SNAPSHOT" "$artifactId" jar
83 repoId="fd.io.${REPO_NAME}"
84 url="${BASEURL}${REPO_NAME}"
86 basefile=$(basename -s .deb "$debfile")
87 artifactId=$(echo "$basefile" | cut -f 1 -d '_')
88 version=$(echo "$basefile" | cut -f 2- -d '_')
92 push_file "$debfile" "$repoId" "$url" "$version" "$artifactId" "$file_type" "$classifier"
98 repoId="fd.io.${REPO_NAME}"
99 url="${BASEURL}${REPO_NAME}"
101 if grep -qE '\.s(rc\.)?rpm' <<<"$rpmfile"
103 rpmrelease=$(rpm -qp --queryformat="%{release}.src" "$rpmfile")
105 rpmrelease=$(rpm -qp --queryformat="%{release}.%{arch}" "$rpmfile")
107 artifactId=$(rpm -qp --queryformat="%{name}" "$rpmfile")
108 version=$(rpm -qp --queryformat="%{version}" "$rpmfile")
109 push_file "$rpmfile" "$repoId" "$url" "${version}-${rpmrelease}" "$artifactId" rpm