Merge "Add signing to Akraino deploy templates"
[ci-management.git] / jjb / shell / ta-iso-deploy.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 echo "---> ta-iso-deploy.sh"
13
14 # Ensure we fail the job if any steps fail.
15 set -eu -o pipefail
16
17 set -x  # Trace commands for this script to make debugging easier.
18
19 set +f  # Ensure filename expansion (globbing) is enabled
20
21 NEXUS_REPO=images-snapshots
22 release_path=TA/images/${JOB_NAME##*-}
23
24 repo_dir="$WORKSPACE/work/nexus/$NEXUS_REPO"
25 upload_dir1="$repo_dir/$release_path/$BUILD_ID"
26 upload_dir2="$repo_dir/$release_path/latest"
27 nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO"
28
29 mkdir -p "$upload_dir1"
30 mkdir -p "$upload_dir2"
31
32 platform_arch=$(uname -m)
33 if [ "${platform_arch}" != 'x86_64' ]; then
34     # On non-x86 architecture, rename the artifacts appropiately
35     pushd "$WORKSPACE/work/results/images/"
36     rename "s/\./.${platform_arch}./" *.*
37     sed -i "s/\./.${platform_arch}./" *."${platform_arch}".iso.*
38     popd
39 fi
40
41 cp "$WORKSPACE/work/results/images/"* "$upload_dir1"
42 cp "$WORKSPACE/work/results/images/"* "$upload_dir2"
43
44 echo "-----> Sign all artifacts"
45 lftools sign sigul "$repo_dir"
46
47 echo "-----> Upload ISOs to Nexus"
48 lftools deploy nexus "$nexus_repo_url" "$repo_dir"
49 rm -rf "$repo_dir"
50
51 set +x  # Disable trace since we no longer need it.
52 echo "ISOs location: <a href=\"$nexus_repo_url\">$nexus_repo_url</a>"