From 08b2aa8da2cd72af7993cbb1ab6a5585331255df Mon Sep 17 00:00:00 2001 From: Chun-Hung Hsiao Date: Wed, 12 Feb 2020 21:27:48 -0800 Subject: [PATCH 1/3] Update Dispatchfile --- Dispatchfile | 73 +++++++--------------------------------------------- 1 file changed, 10 insertions(+), 63 deletions(-) diff --git a/Dispatchfile b/Dispatchfile index 6893d59..c7ec6c0 100644 --- a/Dispatchfile +++ b/Dispatchfile @@ -4,9 +4,9 @@ resource "src-repo": { param revision: "$(context.git.commit)" } -resource "gcr-image": { +resource "docker-image": { type: "image" - param url: "gcr.io/massive-bliss-781/devx-dispatch-demo" + param url: "docker.io/chhsia0/devx-dispatch-demo" } task "unit-test": { @@ -29,44 +29,30 @@ task "unit-test": { task "build-image": { inputs: ["src-repo"] - outputs: ["gcr-image"] + outputs: ["docker-image"] deps: ["unit-test"] steps: [ { name: "build-and-push" image: "gcr.io/kaniko-project/executor" args: [ - "--destination=$(outputs.resources.gcr-image.url):$(context.build.name)", + "--destination=$(outputs.resources.docker-image.url):$(context.build.name)", "--context=/workspace/src-repo", - "--oci-layout-path=/builder/home/image-outputs/gcr-image", + "--oci-layout-path=/workspace/output/docker-image", "--dockerfile=/workspace/src-repo/Dockerfile", "--cache=true", "--cache-ttl=10h" ] - env: [ - { - name: "GOOGLE_APPLICATION_CREDENTIALS" - value: "/builder/volumes/gcloud-auth/key.json" - } - ] - } - ] - volumes: [ - { - name: "gcloud-auth" - secret: { - secretName: "devx-gcloud-auth" - } } ] } task "integration-test": { - inputs: ["gcr-image"] + inputs: ["docker-image"] steps:[ { name: "run-test" - image: "$(inputs.resources.gcr-image.url)@$(inputs.resources.gcr-image.digest)" + image: "$(inputs.resources.docker-image.url)@$(inputs.resources.docker-image.digest)" command: ["/hello-app.test"] env: [ { @@ -78,50 +64,11 @@ task "integration-test": { ] } -task "deploy": { - inputs: ["gcr-image"] - deps: ["integration-test"] - steps: [ - { - name: "gcloud-auth-sa" - image: "gcr.io/cloud-builders/gcloud" - args: [ - "auth", - "activate-service-account", - "--key-file=/builder/volumes/gcloud-auth/key.json", - "--quiet" - ] - }, - { - name: "gcloud-run" - image: "gcr.io/cloud-builders/gcloud" - args: [ - "run", - "deploy", - "devx-dispatch-demo", - "--project=massive-bliss-781", - "--image=$(inputs.resources.gcr-image.url)@$(inputs.resources.gcr-image.digest)", - "--region=us-central1", - "--platform=managed", - "--quiet" - ] - } - ] - volumes: [ - { - name: "gcloud-auth" - secret: { - secretName: "devx-gcloud-auth" - } - } - ] -} - actions: [ { - tasks: ["deploy"] - on push: { - branches: ["gcloud"] + tasks: ["integration-test"] + on pull_request: { + chatops: ["test"] } }, { From d353674df272223434adab15c9bfcbb5b092d155 Mon Sep 17 00:00:00 2001 From: Chun-Hung Hsiao Date: Wed, 12 Feb 2020 21:32:00 -0800 Subject: [PATCH 2/3] Update Dispatchfile --- Dispatchfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dispatchfile b/Dispatchfile index c7ec6c0..be604a8 100644 --- a/Dispatchfile +++ b/Dispatchfile @@ -6,7 +6,7 @@ resource "src-repo": { resource "docker-image": { type: "image" - param url: "docker.io/chhsia0/devx-dispatch-demo" + param url: "docker.io/chhsiao/devx-dispatch-demo" } task "unit-test": { From 8b7d507e73cb0df4e181dffa3d4d96ff5427d155 Mon Sep 17 00:00:00 2001 From: Chun-Hung Hsiao Date: Wed, 12 Feb 2020 22:05:06 -0800 Subject: [PATCH 3/3] Update Dispatchfile --- Dispatchfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dispatchfile b/Dispatchfile index be604a8..9c38568 100644 --- a/Dispatchfile +++ b/Dispatchfile @@ -39,9 +39,7 @@ task "build-image": { "--destination=$(outputs.resources.docker-image.url):$(context.build.name)", "--context=/workspace/src-repo", "--oci-layout-path=/workspace/output/docker-image", - "--dockerfile=/workspace/src-repo/Dockerfile", - "--cache=true", - "--cache-ttl=10h" + "--dockerfile=/workspace/src-repo/Dockerfile" ] } ]