substitutions: # GCS bucket name. _GCS_BUCKET: 'gs://keras-cv-github-test' # GKE cluster name. _CLUSTER_NAME: 'keras-cv-test-cluster' # Location of GKE cluster. _CLUSTER_ZONE: 'us-west1-b' # Image name. _IMAGE_NAME: 'us-west1-docker.pkg.dev/keras-team-test/keras-cv-test/keras-cv-image' steps: - name: 'docker' id: build-image args: [ 'build', '.', '-f', 'cloudbuild/Dockerfile', '-t', '$_IMAGE_NAME:$BUILD_ID', ] - name: 'docker' id: push-image waitFor: - build-image args: ['push', '$_IMAGE_NAME:$BUILD_ID'] - name: 'golang' id: download-jsonnet waitFor: ['-'] entrypoint: 'go' args: [ 'install', 'github.com/google/go-jsonnet/cmd/jsonnet@latest', ] - name: 'google/cloud-sdk' id: clone-templates waitFor: ['-'] entrypoint: 'git' args: [ 'clone', 'https://github.com/GoogleCloudPlatform/ml-testing-accelerators.git', ] - name: 'golang' id: build-templates waitFor: - download-jsonnet - clone-templates entrypoint: 'jsonnet' args: [ 'cloudbuild/unit_test_jobs.jsonnet', '--string', '-J', 'ml-testing-accelerators', '--ext-str', 'image=$_IMAGE_NAME', '--ext-str', 'tag_name=$BUILD_ID', '--ext-str', 'gcs_bucket=$_GCS_BUCKET', '-o', 'output.yaml', ] - name: 'google/cloud-sdk' id: create-job waitFor: - push-image - build-templates entrypoint: bash args: - -c - | set -u set -e set -x gcloud container clusters get-credentials $_CLUSTER_NAME --zone $_CLUSTER_ZONE --project keras-team-test job_name=$(kubectl create -f output.yaml -o name) sleep 5 pod_name=$(kubectl wait --for condition=ready --timeout=10m pod -l job-name=${job_name#job.batch/} -o name) kubectl logs -f $pod_name --container=train sleep 5 gcloud artifacts docker images delete $_IMAGE_NAME:$BUILD_ID exit $(kubectl get $pod_name -o jsonpath={.status.containerStatuses[0].state.terminated.exitCode}) timeout: 1800s # 30 minutes options: volumes: - name: go-modules path: /go