diff --git a/Dispatchfile b/Dispatchfile index 6893d59..9c38568 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/chhsiao/devx-dispatch-demo" } task "unit-test": { @@ -29,44 +29,28 @@ 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", - "--dockerfile=/workspace/src-repo/Dockerfile", - "--cache=true", - "--cache-ttl=10h" - ] - env: [ - { - name: "GOOGLE_APPLICATION_CREDENTIALS" - value: "/builder/volumes/gcloud-auth/key.json" - } + "--oci-layout-path=/workspace/output/docker-image", + "--dockerfile=/workspace/src-repo/Dockerfile" ] } ] - 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 +62,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"] } }, {