blob: c13c62077d2d579f1e215f5710429730027cae92 [file] [log] [blame]
Lott, Christopher (cl778h)162bf7f2019-06-12 22:12:06 -04001#!/bin/bash -l
2# use login flag to get $HOME/.local/bin in PATH
Lott, Christopher (cl778h)1e2a13f2019-06-18 14:14:16 -04003# bcos pip installs yq to $HOME/.local/bin
Lott, Christopher (cl778h)162bf7f2019-06-12 22:12:06 -04004
Lott, Christopher (cl778h)db2347d2019-06-12 09:53:40 -04005#==================================================================================
6# Copyright (c) 2019 Nokia
7# Copyright (c) 2018-2019 AT&T Intellectual Property.
8#
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20#==================================================================================
21
22set -eux -o pipefail
23echo "--> copy-rmr-packages.sh"
24
Lott, Christopher (cl778h)28b61382019-06-12 14:54:12 -040025# extracts artifacts created by the builder
Lott, Christopher (cl778h)28b61382019-06-12 14:54:12 -040026# file with paths of generated deb, rpm packages
Lott, Christopher (cl778h)1e2a13f2019-06-18 14:14:16 -040027pkgs="build_packages.yml"
Lott, Christopher (cl778h)db2347d2019-06-12 09:53:40 -040028
Lott, Christopher (cl778h)1e2a13f2019-06-18 14:14:16 -040029# access builder files within a container created by running a trivial command
Lott, Christopher (cl778h)c1f5d872019-06-12 13:17:21 -040030# environment variables are injected in previous Jenkins steps
Lott, Christopher (cl778h)28b61382019-06-12 14:54:12 -040031container=$(docker run -d "$CONTAINER_PUSH_REGISTRY"/"$DOCKER_NAME":"$DOCKER_IMAGE_TAG" ls)
Lott, Christopher (cl778h)1e2a13f2019-06-18 14:14:16 -040032docker cp "${container}:/tmp/${pkgs}" .
Lott, Christopher (cl778h)28b61382019-06-12 14:54:12 -040033
Lott, Christopher (cl778h)1e2a13f2019-06-18 14:14:16 -040034count=$(yq -r '.files | length' $pkgs)
35# modern bash syntax is helpful
36for (( i = 0; i < count; i++ )); do
37 file=$(yq -r ".files[$i]" "$pkgs")
38 docker cp "$container":"$file" .
39 base=$(basename "$file")
40 echo "Push file $base" # TODO
41done