From 1e2a13fdfea976656a35001bad382c3fd1f3520a Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Tue, 18 Jun 2019 14:14:16 -0400 Subject: [PATCH] Copy out DEB and RPM files, plain and dev Using the new simple files: (list) format Signed-off-by: Lott, Christopher (cl778h) Change-Id: I8a2df39b4a967d08d6272a9dc430c87f3b40b707 --- jjb/ric-plt-lib-rmr/shell/copy-rmr-packages.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) 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 78caaea3..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,5 +1,6 @@ #!/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 @@ -23,21 +24,18 @@ echo "--> copy-rmr-packages.sh" # extracts artifacts created by the builder # file with paths of generated deb, rpm packages -pkgs="/tmp/build_output.yml" +pkgs="build_packages.yml" -# access builder files by creating a container with 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) -docker cp "$container":"$pkgs" . -pkgs_base=$(basename "$pkgs") +docker cp "${container}:/tmp/${pkgs}" . -# pip installs yq to $HOME/.local/bin -deb=$(yq -r .deb "$pkgs_base") -docker cp "$container":"$deb" . -deb_base=$(basename "$deb") -echo "Push file $deb_base" # TODO - -rpm=$(yq -r .rpm "$pkgs_base") -docker cp "$container":"$rpm" . -rpm_base=$(basename "$rpm") -echo "Push file $rpm_base" # TODO +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 -- 2.16.6