blob: 448269167d51e0865af4c19c29d14e20052d2691 [file] [log] [blame]
Lott, Christopher (cl778h)d59c1b82019-11-14 09:06:25 -05001#!/bin/bash
2
Bin Yang76b5afb2020-06-04 05:10:19 +00003# Copyright (C) 2020 Wind River Systems, Inc.
Lott, Christopher (cl778h)d59c1b82019-11-14 09:06:25 -05004#
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
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
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.
16
17# Uploads a Yocto image to Nexus.
18
Bin Yang76b5afb2020-06-04 05:10:19 +000019echo "--> upload-inf.sh"
Lott, Christopher (cl778h)d59c1b82019-11-14 09:06:25 -050020
21# Ensure we fail the job if any steps fail.
22set -eu -o pipefail
23
24echo "INFO: creating virtual environment"
25virtualenv -p python3 /tmp/venv
26PATH=/tmp/venv/bin:$PATH
Jackie Huang5da35a02021-12-14 10:59:23 +080027
28pip_pkgs="pip setuptools lftools"
29for pkg in $pip_pkgs; do
30 cmd_pip="python -m pip install -q --upgrade $pkg"
31 echo "INFO: installing packages: $cmd_pip"
32 $cmd_pip
33done
Lott, Christopher (cl778h)d59c1b82019-11-14 09:06:25 -050034
35# NEXUS_URL is set by Jenkins
36nexus_repo_id="images"
37nexus_repo_url="$NEXUS_URL/content/sites/$nexus_repo_id"
38echo "INFO: upload to $nexus_repo_url"
39
40repo_dir="$WORKSPACE/nexus/$nexus_repo_id"
Jackie Huang462e5da2022-05-17 17:37:35 +080041repo_iso_dir_latest="$repo_dir/org/o-ran-sc/pti/rtp/latest"
42repo_iso_dir_branch="$repo_dir/org/o-ran-sc/pti/rtp/$GERRIT_BRANCH"
43echo "INFO: create staging directory $repo_iso_dir_latest and $repo_iso_dir_branch"
44mkdir -p "$repo_iso_dir_latest" "$repo_iso_dir_branch"
Lott, Christopher (cl778h)d59c1b82019-11-14 09:06:25 -050045
Jackie Huang462e5da2022-05-17 17:37:35 +080046# Expect Yocto based ISO file: inf-image-yocto-aio-x86-64.iso
47# in build subdir: workspace/workspace_yocto/prj_output/
48iso_yocto="workspace/workspace_yocto/prj_output/inf-image-yocto-aio-x86-64.iso"
49
50# Expect CentOS based ISO file: inf-image-centos-all-x86-64.iso
51# in build subdir: workspace/workspace_centos/prj_output/
52iso_centos="workspace/workspace_centos/prj_output/inf-image-centos-all-x86-64.iso"
53
54echo "INFO: copy $iso_yocto and $iso_centos to staging directory $repo_iso_dir_latest"
55cp "$iso_yocto" "$iso_centos" "$repo_iso_dir_latest"
56
57echo "INFO: copy $iso_yocto and $iso_centos to staging directory $repo_iso_dir_branch"
58cp "$iso_yocto" "$iso_centos" "$repo_iso_dir_branch"
Lott, Christopher (cl778h)d59c1b82019-11-14 09:06:25 -050059
60cmd="lftools deploy nexus $nexus_repo_url $repo_dir"
61echo "INFO: Upload ISO to Nexus: $cmd"
62$cmd
63
Bin Yang76b5afb2020-06-04 05:10:19 +000064echo "--> upload-inf.sh ends"