github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/functional/.jenkins/main.sh (about) 1 #!/bin/bash 2 3 set -o errexit 4 set -o xtrace 5 6 CURRENT_DIR=$(pwd) 7 8 main() { 9 case $1 in 10 11 --log-into-dockerhub) 12 log_into_dockerhub 13 ;; 14 15 --pull-infrastructure-images) 16 pull_infrastructure_images 17 ;; 18 19 --setup-machine) 20 setup_machine 21 ;; 22 23 --shutdown-infrastructure) 24 shutdown_infrastructure 25 ;; 26 27 --start-infrastructure) 28 start_infrastructure 29 ;; 30 31 *) 32 echo "Error: 33 Unknown command. 34 Usage: main.sh [--create-test-user|--log-into-dockerhub|--pull-infrastructure-images| 35 --setup-machine|--shutdown-infrastructure|--start-infrastructure] 36 37 Aborting." 38 exit 1 39 ;; 40 esac 41 } 42 43 setup_machine() { 44 rm -rf "$CURRENT_DIR/.runner/ci-infrastructure" 45 46 echo "Fetching exploded infra" 47 48 mkdir -p "$CURRENT_DIR/.runner" 49 50 cd "$CURRENT_DIR/.runner" 51 52 git clone git@github.com:wedeploy/ci-infrastructure.git 53 54 chmod +x "$CURRENT_DIR/.runner/ci-infrastructure/runner/exploded-infra-runner.sh" 55 56 dig +trace wedeploy.domains 57 58 curl https://cdn.liferay.cloud/cli/latest/lcp.sh -fsSL | sudo bash 59 } 60 61 start_infrastructure() { 62 local BUILD_TAG=staging 63 local WEDEPLOY_ENVIRONMENT=wd-paas-test-us-east-1 64 bash "$CURRENT_DIR/.runner/ci-infrastructure/runner/exploded-infra-runner.sh" --run $BUILD_TAG $WEDEPLOY_ENVIRONMENT 65 } 66 67 shutdown_infrastructure() { 68 bash "$CURRENT_DIR/.runner/ci-infrastructure/runner/exploded-infra-runner.sh" --shutdown 69 } 70 71 pull_infrastructure_images() { 72 sh "$CURRENT_DIR/.runner/ci-infrastructure/runner/exploded-infra-runner.sh" --pull-images 73 } 74 75 log_into_dockerhub() { 76 echo "INFO: 77 logging into docker hub. 78 " 79 bash -ci 'docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD' 80 } 81 82 main "$@"