| #!/bin/bash |
| |
| # Source file to set access credentials to Jenkins API on salt-master node (day01 deployment steps) |
| # Requires: |
| # - ENV_NAME |
| # Example usage: |
| # $> . ./tcp_tests/utils/env_salt |
| # $> . ./tcp_tests/utils/env_jenkins_day01 |
| # $> ./tcp_tests/utils/run_jenkins_job.py --verbose --job-name=deploy_openstack --job-parameters="{... json ...}" |
| |
| CURRENT_DIR=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) |
| export PYTHONPATH=${CURRENT_DIR}/../.. |
| |
| 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)} |
| |
| if [ -z "$SALT_MASTER_IP" ]; then |
| echo "SALT_MASTER_IP not found in the environment '${ENV_NAME}'" |
| unset JENKINS_URL |
| unset JENKINS_USER |
| unset JENKINS_PASS |
| unset JENKINS_START_TIMEOUT |
| unset JENKINS_BUILD_TIMEOUT |
| else |
| # For run_jenkins_job.py |
| export JENKINS_URL=http://${SALT_MASTER_IP}:8081 |
| export JENKINS_USER=admin |
| export JENKINS_PASS=r00tme |
| export JENKINS_START_TIMEOUT=60 |
| export JENKINS_BUILD_TIMEOUT=1800 |
| fi |
| |
| echo "export JENKINS_URL='$JENKINS_URL' # Jenkins API URL" |
| echo "export JENKINS_USER='${JENKINS_USER}' # Jenkins API username" |
| echo "export JENKINS_PASS='${JENKINS_PASS}' # Jenkins API password or token" |
| echo "export JENKINS_START_TIMEOUT='${JENKINS_START_TIMEOUT}' # Timeout waiting for job in queue to start building" |
| echo "export JENKINS_BUILD_TIMEOUT='${JENKINS_BUILD_TIMEOUT}' # Timeout waiting for building job to complete" |