Apex: Refactor snapshot pipeline for other types
[releng.git] / jjb / apex / apex-fetch-snap-info.sh
1 #!/usr/bin/env bash
2
3 ##############################################################################
4 # Copyright (c) 2018 Tim Rozet (Red Hat) and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 set -o errexit
13 set -o nounset
14 set -o pipefail
15
16 echo "Fetching overcloudrc, ssh key, and node.yaml from deployment..."
17
18 SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o LogLevel=error)
19
20 tmp_dir=/tmp/snap
21 rm -rf ${tmp_dir}
22 mkdir -p ${tmp_dir}
23
24 # TODO(trozet) remove this after fix goes in for tripleo_inspector to copy these
25 pushd ${tmp_dir} > /dev/null
26 echo "Copying overcloudrc and ssh key from Undercloud..."
27 # Store overcloudrc
28 UNDERCLOUD=$(sudo virsh domifaddr undercloud | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
29 sudo scp ${SSH_OPTIONS[@]} stack@${UNDERCLOUD}:overcloudrc ./
30 # Copy out ssh key of stack from undercloud
31 sudo scp ${SSH_OPTIONS[@]} stack@${UNDERCLOUD}:.ssh/id_rsa ./
32 sudo chmod 0600 id_rsa
33 popd > /dev/null
34
35 echo "Gathering introspection information"
36 git clone https://gerrit.opnfv.org/gerrit/sdnvpn.git
37 pushd sdnvpn/odl-pipeline/lib > /dev/null
38 sudo ./tripleo_introspector.sh --out-file ${tmp_dir}/node.yaml
39 popd > /dev/null
40 sudo rm -rf sdnvpn
41
42 sudo chown jenkins-ci:jenkins-ci ${tmp_dir}/*
43
44 ls -lrt ${tmp_dir}
45
46 echo "Fetch complete"