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 |
Lott, Christopher (cl778h) | 1e2a13f | 2019-06-18 14:14:16 -0400 | [diff] [blame] | 3 | # bcos pip installs yq to $HOME/.local/bin |
Lott, Christopher (cl778h) | 162bf7f | 2019-06-12 22:12:06 -0400 | [diff] [blame] | 4 | |
Lott, Christopher (cl778h) | db2347d | 2019-06-12 09:53:40 -0400 | [diff] [blame] | 5 | #================================================================================== |
| 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 | |
| 22 | set -eux -o pipefail |
| 23 | echo "--> copy-rmr-packages.sh" |
| 24 | |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 25 | # extracts artifacts created by the builder |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 26 | # file with paths of generated deb, rpm packages |
Lott, Christopher (cl778h) | 1e2a13f | 2019-06-18 14:14:16 -0400 | [diff] [blame] | 27 | pkgs="build_packages.yml" |
Lott, Christopher (cl778h) | db2347d | 2019-06-12 09:53:40 -0400 | [diff] [blame] | 28 | |
Lott, Christopher (cl778h) | 1e2a13f | 2019-06-18 14:14:16 -0400 | [diff] [blame] | 29 | # access builder files within a container created by running a trivial command |
Lott, Christopher (cl778h) | c1f5d87 | 2019-06-12 13:17:21 -0400 | [diff] [blame] | 30 | # environment variables are injected in previous Jenkins steps |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 31 | container=$(docker run -d "$CONTAINER_PUSH_REGISTRY"/"$DOCKER_NAME":"$DOCKER_IMAGE_TAG" ls) |
Lott, Christopher (cl778h) | 1e2a13f | 2019-06-18 14:14:16 -0400 | [diff] [blame] | 32 | docker cp "${container}:/tmp/${pkgs}" . |
Lott, Christopher (cl778h) | 28b6138 | 2019-06-12 14:54:12 -0400 | [diff] [blame] | 33 | |
Lott, Christopher (cl778h) | 1e2a13f | 2019-06-18 14:14:16 -0400 | [diff] [blame] | 34 | count=$(yq -r '.files | length' $pkgs) |
| 35 | # modern bash syntax is helpful |
| 36 | for (( 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 |
| 41 | done |