Use login flag to get $HOME/.local/bin on path
[ci-management.git] / jjb / ric-plt-lib-rmr / shell / copy-rmr-packages.sh
1 #!/bin/bash -l
2 # use login flag to get $HOME/.local/bin in PATH
3
4 #==================================================================================
5 #       Copyright (c) 2019 Nokia
6 #       Copyright (c) 2018-2019 AT&T Intellectual Property.
7 #
8 #   Licensed under the Apache License, Version 2.0 (the "License");
9 #   you may not use this file except in compliance with the License.
10 #   You may obtain a copy of the License at
11 #
12 #       http://www.apache.org/licenses/LICENSE-2.0
13 #
14 #   Unless required by applicable law or agreed to in writing, software
15 #   distributed under the License is distributed on an "AS IS" BASIS,
16 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 #   See the License for the specific language governing permissions and
18 #   limitations under the License.
19 #==================================================================================
20
21 set -eux -o pipefail
22 echo "--> copy-rmr-packages.sh"
23
24 # extracts artifacts created by the builder
25 # file with paths of generated deb, rpm packages
26 pkgs="/tmp/build_output.yml"
27
28 # access builder files by creating a container with a trivial command
29 # environment variables are injected in previous Jenkins steps
30 container=$(docker run -d "$CONTAINER_PUSH_REGISTRY"/"$DOCKER_NAME":"$DOCKER_IMAGE_TAG" ls)
31 docker cp "$container":"$pkgs" .
32 pkgs_base=$(basename "$pkgs")
33
34 # pip installs yq to $HOME/.local/bin
35 deb=$(yq -r .deb "$pkgs_base")
36 docker cp "$container":"$deb" .
37 deb_base=$(basename "$deb")
38 echo "Push file $deb_base" # TODO
39
40 rpm=$(yq -r .rpm "$pkgs_base")
41 docker cp "$container":"$rpm" .
42 rpm_base=$(basename "$rpm")
43 echo "Push file $rpm_base" # TODO