version: v1.0 name: Docker Image Testing agent: machine: type: e1-standard-2 os_image: ubuntu1804 blocks: - name: Test task: jobs: - name: 'Alpine Test' commands: - checkout - cd alpine - artifact pull workflow postal-alpine-container.tar - docker load -i postal-alpine-container.tar - docker-compose up -d - for i in {1..20}; do if [[ $(docker inspect postal | jq -r '.[].State.Health.Status') == "healthy" ]]; then break; elif [[ $i -eq 20 ]]; then exit 1; else sleep 15; fi; done; - name: 'Ubuntu Test' commands: - checkout - cd ubuntu - artifact pull workflow postal-ubuntu-container.tar - docker load -i postal-ubuntu-container.tar - docker-compose up -d - for i in {1..20}; do if [[ $(docker inspect postal | jq -r '.[].State.Health.Status') == "healthy" ]]; then break; elif [[ $i -eq 20 ]]; then exit 1; else sleep 15; fi; done; promotions: - name: Upload to Production pipeline_file: upload-production.yml auto_promote: when: result = 'passed' and branch = 'master' - name: Dummy Upload pipeline_file: upload-dummy.yml auto_promote: when: result = 'passed' and branch != 'master'