From f29ce54c75b54ce722191404b3a923ecd9717c80 Mon Sep 17 00:00:00 2001 From: Dagang Wei Date: Fri, 14 Jun 2019 13:32:09 -0700 Subject: [PATCH] Add Cloud Build for presubmit test (#4) --- cloud_build/Dockerfile | 9 +++++++++ cloud_build/cloudbuild.yaml | 8 ++++++++ cloud_build/presubmit.sh | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 cloud_build/Dockerfile create mode 100644 cloud_build/cloudbuild.yaml create mode 100644 cloud_build/presubmit.sh diff --git a/cloud_build/Dockerfile b/cloud_build/Dockerfile new file mode 100644 index 0000000..3610f8f --- /dev/null +++ b/cloud_build/Dockerfile @@ -0,0 +1,9 @@ +# This Dockerfile creates an image for running presubmit tests. + +FROM gcr.io/cloud-builders/gcloud + +# Copy everything into the container +COPY . /dataproc-custom-images/ +RUN ls -a /dataproc-custom-images + +ENTRYPOINT ["bash", "/dataproc-custom-images/cloud_build/presubmit.sh"] diff --git a/cloud_build/cloudbuild.yaml b/cloud_build/cloudbuild.yaml new file mode 100644 index 0000000..73c5e04 --- /dev/null +++ b/cloud_build/cloudbuild.yaml @@ -0,0 +1,8 @@ +steps: +# 1. Create a Docker image containing dataproc-custom-images repo +- name: 'gcr.io/cloud-builders/docker' + args: ['build', '--tag=gcr.io/google.com/cloud-dataproc-ci/dataproc-custom-images-presubmit', '-f', 'cloud_build/Dockerfile', '.'] +# 2. Run presumit tests +- name: 'gcr.io/google.com/cloud-dataproc-ci/dataproc-custom-images-presubmit' + entrypoint: 'bash' + args: ['/dataproc-custom-images/cloud_build/presubmit.sh'] diff --git a/cloud_build/presubmit.sh b/cloud_build/presubmit.sh new file mode 100644 index 0000000..0fc1c9f --- /dev/null +++ b/cloud_build/presubmit.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright 2019 Google Inc. All Rights Reserved. +# +# 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. + +cd /dataproc-custom-images + +# Run all tests +python2 -m unittest discover