2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2020 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
24 # Make directory to hold file artifacts (.war .jar etc)
25 mkdir -p $ARTIFACT_DIRECTORY
27 # Ensure at root of $WORKSPACE
30 # For each file artifact create a copy in ARTIFACT_DIRECTORY
31 # ARTIFACT_DIRECTORY's contents will be pushed to Artifactory
32 # Required because artifacts in target directories will be deleted during a mvn clean
33 # which is done before archiving the source repos in order limit file size
34 for ARTIFACT in $ARTIFACT_PATHS
36 # Check if file exists before copying
37 if [ ! -f "$ARTIFACT" ]; then
38 echo "$ARTIFACT does not exist."
42 echo "----------------------------------------------------"
43 echo "Info: Copy $ARTIFACT into $ARTIFACT_DIRECTORY"
44 echo "----------------------------------------------------"
45 cp $WORKSPACE/$ARTIFACT $ARTIFACT_DIRECTORY
48 cd $ARTIFACT_DIRECTORY
50 # Rename the artifacts to include SHA commit ids of the projects for traceability
51 # e.g. 6d3abef-d96bad4-catalog-be-1.6.1-SNAPSHOT.war
54 echo "----------------------------------------------------"
55 echo "Info: Adding CommitIDs $COMMIT_IDS to $ARTIFACT filename"
56 echo "----------------------------------------------------"
57 mv "$ARTIFACT" "$COMMIT_IDS-$ARTIFACT"