X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=jjb%2Fric-plt-lib-rmr%2Fshell%2Fcopy-rmr-packages.sh;h=c13c62077d2d579f1e215f5710429730027cae92;hb=66a126044c9b105e41d8cf359823e66e5c9a43e3;hp=e15a1e296c77201e5be46bb5a9de20267bfda627;hpb=c1f5d877924423fedcd4b2364965fc415592c40c;p=ci-management.git diff --git a/jjb/ric-plt-lib-rmr/shell/copy-rmr-packages.sh b/jjb/ric-plt-lib-rmr/shell/copy-rmr-packages.sh index e15a1e29..c13c6207 100755 --- a/jjb/ric-plt-lib-rmr/shell/copy-rmr-packages.sh +++ b/jjb/ric-plt-lib-rmr/shell/copy-rmr-packages.sh @@ -1,4 +1,7 @@ -#!/bin/bash +#!/bin/bash -l +# use login flag to get $HOME/.local/bin in PATH +# bcos pip installs yq to $HOME/.local/bin + #================================================================================== # Copyright (c) 2019 Nokia # Copyright (c) 2018-2019 AT&T Intellectual Property. @@ -19,17 +22,20 @@ set -eux -o pipefail echo "--> copy-rmr-packages.sh" -# extracts to host the artifacts created by the builder - -# This file is created by RMr library build process -# with path(s) to the generated artifact(s) -file="/tmp/rmr_deb_path" +# extracts artifacts created by the builder +# file with paths of generated deb, rpm packages +pkgs="build_packages.yml" -# create a container from the image by running a trivial command +# access builder files within a container created by running a trivial command # environment variables are injected in previous Jenkins steps -container=$(docker run -d "$CONTAINER_PUSH_REGISTRY"/"$DOCKER_NAME":"$DOCKER_IMAGE_TAG" ls "$file") -docker logs "$container" -docker cp "$container:$file" . -filebase=$(basename "$file") -deb=$(cat "$filebase") -docker cp "$container:$deb" . +container=$(docker run -d "$CONTAINER_PUSH_REGISTRY"/"$DOCKER_NAME":"$DOCKER_IMAGE_TAG" ls) +docker cp "${container}:/tmp/${pkgs}" . + +count=$(yq -r '.files | length' $pkgs) +# modern bash syntax is helpful +for (( i = 0; i < count; i++ )); do + file=$(yq -r ".files[$i]" "$pkgs") + docker cp "$container":"$file" . + base=$(basename "$file") + echo "Push file $base" # TODO +done