Dennis Dmitriev | 3ec2e53 | 2018-06-08 04:33:34 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Source file to set access credentials to Jenkins API on salt-master node (day01 deployment steps) |
| 4 | # Requires: |
| 5 | # - ENV_NAME |
| 6 | # Example usage: |
| 7 | # $> . ./tcp_tests/utils/env_salt |
| 8 | # $> . ./tcp_tests/utils/env_jenkins_day01 |
| 9 | # $> ./tcp_tests/utils/run_jenkins_job.py --verbose --job-name=deploy_openstack --job-parameters="{... json ...}" |
| 10 | |
| 11 | CURRENT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) |
| 12 | export PYTHONPATH=${CURRENT_DIR}/../.. |
| 13 | |
| 14 | SALT_MASTER_IP=${SALT_MASTER_IP:-$(for node in $(dos.py slave-ip-list --address-pool-name admin-pool01 ${ENV_NAME}); do echo $node|grep cfg01|cut -d',' -f2; done)} |
| 15 | |
| 16 | if [ -z "$SALT_MASTER_IP" ]; then |
| 17 | echo "SALT_MASTER_IP not found in the environment '${ENV_NAME}'" |
| 18 | unset JENKINS_URL |
| 19 | unset JENKINS_USER |
| 20 | unset JENKINS_PASS |
| 21 | unset JENKINS_START_TIMEOUT |
| 22 | unset JENKINS_BUILD_TIMEOUT |
| 23 | else |
| 24 | # For run_jenkins_job.py |
| 25 | export JENKINS_URL=http://${SALT_MASTER_IP}:8081 |
| 26 | export JENKINS_USER=admin |
| 27 | export JENKINS_PASS=r00tme |
| 28 | export JENKINS_START_TIMEOUT=60 |
| 29 | export JENKINS_BUILD_TIMEOUT=1800 |
| 30 | fi |
| 31 | |
| 32 | echo "export JENKINS_URL='$JENKINS_URL' # Jenkins API URL" |
| 33 | echo "export JENKINS_USER='${JENKINS_USER}' # Jenkins API username" |
| 34 | echo "export JENKINS_PASS='${JENKINS_PASS}' # Jenkins API password or token" |
| 35 | echo "export JENKINS_START_TIMEOUT='${JENKINS_START_TIMEOUT}' # Timeout waiting for job in queue to start building" |
| 36 | echo "export JENKINS_BUILD_TIMEOUT='${JENKINS_BUILD_TIMEOUT}' # Timeout waiting for building job to complete" |