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 reference in ARTIFACT_DIRECTORY
31 # uses softlinks in order to save space and time
32 # ARTIFACT_DIRECTORY contents will be pushed to Artifactory
33 for ARTIFACT in $ARTIFACT_PATHS
35 # Check if file exists before creating a softlink
36 if [ ! -f "$ARTIFACT" ]; then
37 echo "$ARTIFACT does not exist."
41 echo "----------------------------------------------------"
42 echo "Info: Copy $ARTIFACT into $ARTIFACT_DIRECTORY"
43 echo "----------------------------------------------------"
44 ln -sf $WORKSPACE/$ARTIFACT $ARTIFACT_DIRECTORY
47 cd $ARTIFACT_DIRECTORY
49 # Rename the artifacts to include SHA commit ids of the projects for traceability
50 # e.g. 6d3abef-d96bad4-catalog-be-1.6.1-SNAPSHOT.war
53 echo "----------------------------------------------------"
54 echo "Info: Adding CommitIDs $COMMIT_IDS to $ARTIFACT filename"
55 echo "----------------------------------------------------"
56 mv "$ARTIFACT" "$COMMIT_IDS-$ARTIFACT"