| # Copyright 2018 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the License); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an AS IS BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| substitutions: |
| "_TEST_1": "smoke_test" |
| "_INPUT_IMAGE_1": "cos-dev-69-10895-0-0" |
| "_TEST_2": "gpu_test" |
| "_INPUT_IMAGE_2": "cos-69-10895-71-0" |
| "_INPUT_PROJECT": "cos-cloud" |
| steps: |
| - name: 'gcr.io/cloud-builders/bazel' |
| id: "docker-build" |
| args: ["run", "--spawn_strategy=standalone", ":cos_customizer", "--", "--norun"] |
| # TEST_1 workflow |
| - name: 'bazel:cos_customizer' |
| waitFor: "docker-build" |
| id: "test-1-start-build" |
| args: ["-local-state-workdir=.${_TEST_1}", |
| "start-image-build", |
| "-build-context=testing/${_TEST_1}", |
| "-image-name=${_INPUT_IMAGE_1}", |
| "-image-project=${_INPUT_PROJECT}", |
| "-gcs-bucket=${PROJECT_ID}_cloudbuild", |
| "-gcs-workdir=customizer-${_TEST_1}-$BUILD_ID"] |
| - name: 'bazel:cos_customizer' |
| waitFor: "test-1-start-build" |
| id: "test-1-run-script" |
| args: ["-local-state-workdir=.${_TEST_1}", |
| "run-script", |
| "-script=preload.sh"] |
| - name: 'bazel:cos_customizer' |
| waitFor: "test-1-run-script" |
| id: "test-1-finish-build" |
| args: ["-local-state-workdir=.${_TEST_1}", |
| "finish-image-build", |
| "-zone=us-west1-b", |
| "-project=$PROJECT_ID", |
| "-image-name=preload-test-t1-$BUILD_ID", |
| "-image-project=$PROJECT_ID"] |
| - name: 'gcr.io/compute-image-tools/daisy' |
| waitFor: "test-1-finish-build" |
| id: "test-1-test-build" |
| args: ["-project=$PROJECT_ID", "-zone=us-west1-b", "-var:image_name", |
| "preload-test-t1-$BUILD_ID", "-var:image_project", "$PROJECT_ID", |
| "-var:test_cfg", "../${_TEST_1}/preload_test.cfg", "testing/util/run_test.wf.json"] |
| # TEST_2 workflow |
| - name: 'busybox' |
| args: ["sed", "-i", "-e", "s|%s|'396.26'|", |
| "testing/${_TEST_2}/preload_test.cfg"] |
| - name: 'bazel:cos_customizer' |
| waitFor: "docker-build" |
| id: "test-2-start-build" |
| args: ["-local-state-workdir=.${_TEST_2}", |
| "start-image-build", |
| "-build-context=testing/${_TEST_2}", |
| "-image-name=${_INPUT_IMAGE_2}", |
| "-image-project=${_INPUT_PROJECT}", |
| "-gcs-bucket=${PROJECT_ID}_cloudbuild", |
| "-gcs-workdir=customizer-${_TEST_2}-$BUILD_ID"] |
| - name: 'bazel:cos_customizer' |
| waitFor: "test-2-start-build" |
| id: "test-2-install-gpu" |
| args: ["-local-state-workdir=.${_TEST_2}", |
| "install-gpu", |
| "-version=396.26", |
| "-md5sum=4c4b23467495338ef2612769ebeadb3d", |
| "-gpu-type=nvidia-tesla-k80"] |
| - name: 'bazel:cos_customizer' |
| waitFor: "test-2-install-gpu" |
| id: "test-2-run-script" |
| args: ["-local-state-workdir=.${_TEST_2}", |
| "run-script", |
| "-script=preload.sh"] |
| - name: 'bazel:cos_customizer' |
| waitFor: "test-2-run-script" |
| id: "test-2-finish-build" |
| args: ["-local-state-workdir=.${_TEST_2}", |
| "finish-image-build", |
| "-zone=us-west1-b", |
| "-project=$PROJECT_ID", |
| "-image-name=preload-test-t2-$BUILD_ID", |
| "-image-project=$PROJECT_ID"] |
| - name: 'gcr.io/compute-image-tools/daisy' |
| waitFor: "test-2-finish-build" |
| id: "test-2-test-build" |
| args: ["-project=$PROJECT_ID", "-zone=us-west1-b", "-var:image_name", |
| "preload-test-t2-$BUILD_ID", "-var:image_project", "$PROJECT_ID", |
| "-var:test_cfg", "../${_TEST_2}/preload_test.cfg", "-var:vm_workflow", |
| "./gpu_vm.wf.json", "testing/util/run_test.wf.json"] |
| options: |
| machineType: 'N1_HIGHCPU_32' |
| timeout: "7200s" |