Lott, Christopher (cl778h) | 162bf7f | 2019-06-12 22:12:06 -0400 | [diff] [blame^] | 1 | #!/bin/bash -l |
| 2 | # use login flag to get $HOME/.local/bin in PATH |
| 3 | |
Lott, Christopher (cl778h) | db2347d | 2019-06-12 09:53:40 -0400 | [diff] [blame] | 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 | |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 24 | # extracts artifacts created by the builder |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 25 | # file with paths of generated deb, rpm packages |
| 26 | pkgs="/tmp/build_output.yml" |
Lott, Christopher (cl778h) | db2347d | 2019-06-12 09:53:40 -0400 | [diff] [blame] | 27 | |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 28 | # access builder files by creating a container with a trivial command |
Lott, Christopher (cl778h) | c1f5d87 | 2019-06-12 13:17:21 -0400 | [diff] [blame] | 29 | # environment variables are injected in previous Jenkins steps |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 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 | |
Lott, Christopher (cl778h) | 162bf7f | 2019-06-12 22:12:06 -0400 | [diff] [blame^] | 34 | # pip installs yq to $HOME/.local/bin |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 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 |