From 93c3d0982212f60d7127e3897e315b84fda4b3ab Mon Sep 17 00:00:00 2001 From: Nick Kubala Date: Thu, 18 Apr 2019 15:05:38 -0700 Subject: [PATCH] don't run GCB example on structure tests --- examples/google-cloud-build/Dockerfile | 7 ++++ examples/google-cloud-build/README.adoc | 33 +++++++++++++++++++ examples/google-cloud-build/k8s-pod.yaml | 8 +++++ examples/google-cloud-build/main.go | 14 ++++++++ examples/google-cloud-build/skaffold.yaml | 12 +++++++ .../examples/google-cloud-build/Dockerfile | 7 ++++ .../examples/google-cloud-build/README.adoc | 33 +++++++++++++++++++ .../examples/google-cloud-build/k8s-pod.yaml | 8 +++++ .../examples/google-cloud-build/main.go | 14 ++++++++ .../examples/google-cloud-build/skaffold.yaml | 11 +++++++ .../examples/structure-tests/skaffold.yaml | 4 --- integration/run_test.go | 3 +- 12 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 examples/google-cloud-build/Dockerfile create mode 100644 examples/google-cloud-build/README.adoc create mode 100644 examples/google-cloud-build/k8s-pod.yaml create mode 100644 examples/google-cloud-build/main.go create mode 100644 examples/google-cloud-build/skaffold.yaml create mode 100644 integration/examples/google-cloud-build/Dockerfile create mode 100644 integration/examples/google-cloud-build/README.adoc create mode 100644 integration/examples/google-cloud-build/k8s-pod.yaml create mode 100644 integration/examples/google-cloud-build/main.go create mode 100644 integration/examples/google-cloud-build/skaffold.yaml diff --git a/examples/google-cloud-build/Dockerfile b/examples/google-cloud-build/Dockerfile new file mode 100644 index 00000000000..184d6cce3e3 --- /dev/null +++ b/examples/google-cloud-build/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.10.1-alpine3.7 as builder +COPY main.go . +RUN go build -o /app main.go + +FROM alpine:3.7 +CMD ["./app"] +COPY --from=builder /app . diff --git a/examples/google-cloud-build/README.adoc b/examples/google-cloud-build/README.adoc new file mode 100644 index 00000000000..4b4e8b09266 --- /dev/null +++ b/examples/google-cloud-build/README.adoc @@ -0,0 +1,33 @@ +=== Example: Getting started with a simple go app +:icons: font + +This is a simple example based on + +* *building* a single go file app and with a multistage `Dockerfile` using Google Cloud Build +* *tagging* using the default tagPolicy (`gitCommit`) +* *deploying* a single container pod using `kubectl` + +ifndef::env-github[] +==== link:{github-repo-tree}/examples/getting-started[Example files icon:github[]] + +[source,yaml, indent=3, title=skaffold.yaml] +---- +include::skaffold.yaml[] +---- + +[source,go, indent=3, title=main.go, syntax=go] +---- +include::main.go[] +---- + +[source,docker, indent=3, title=Dockerfile] +---- +include::Dockerfile[] +---- + +[source,yaml, indent=3, title=k8s-pod.yaml] +---- +include::k8s-pod.yaml[] +---- + +endif::[] diff --git a/examples/google-cloud-build/k8s-pod.yaml b/examples/google-cloud-build/k8s-pod.yaml new file mode 100644 index 00000000000..14cc6911607 --- /dev/null +++ b/examples/google-cloud-build/k8s-pod.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Pod +metadata: + name: getting-started +spec: + containers: + - name: getting-started + image: gcr.io/k8s-skaffold/skaffold-example diff --git a/examples/google-cloud-build/main.go b/examples/google-cloud-build/main.go new file mode 100644 index 00000000000..593721cfe2e --- /dev/null +++ b/examples/google-cloud-build/main.go @@ -0,0 +1,14 @@ +package main + +import ( + "fmt" + "time" +) + +func main() { + for { + fmt.Println("Hello world!") + + time.Sleep(time.Second * 1) + } +} diff --git a/examples/google-cloud-build/skaffold.yaml b/examples/google-cloud-build/skaffold.yaml new file mode 100644 index 00000000000..78940a20fd1 --- /dev/null +++ b/examples/google-cloud-build/skaffold.yaml @@ -0,0 +1,12 @@ +apiVersion: skaffold/v1beta8 +kind: Config +build: + googleCloudBuild: + projectId: k8s-skaffold + artifacts: + - image: gcr.io/k8s-skaffold/skaffold-example + +deploy: + kubectl: + manifests: + - k8s-* diff --git a/integration/examples/google-cloud-build/Dockerfile b/integration/examples/google-cloud-build/Dockerfile new file mode 100644 index 00000000000..184d6cce3e3 --- /dev/null +++ b/integration/examples/google-cloud-build/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:1.10.1-alpine3.7 as builder +COPY main.go . +RUN go build -o /app main.go + +FROM alpine:3.7 +CMD ["./app"] +COPY --from=builder /app . diff --git a/integration/examples/google-cloud-build/README.adoc b/integration/examples/google-cloud-build/README.adoc new file mode 100644 index 00000000000..4b4e8b09266 --- /dev/null +++ b/integration/examples/google-cloud-build/README.adoc @@ -0,0 +1,33 @@ +=== Example: Getting started with a simple go app +:icons: font + +This is a simple example based on + +* *building* a single go file app and with a multistage `Dockerfile` using Google Cloud Build +* *tagging* using the default tagPolicy (`gitCommit`) +* *deploying* a single container pod using `kubectl` + +ifndef::env-github[] +==== link:{github-repo-tree}/examples/getting-started[Example files icon:github[]] + +[source,yaml, indent=3, title=skaffold.yaml] +---- +include::skaffold.yaml[] +---- + +[source,go, indent=3, title=main.go, syntax=go] +---- +include::main.go[] +---- + +[source,docker, indent=3, title=Dockerfile] +---- +include::Dockerfile[] +---- + +[source,yaml, indent=3, title=k8s-pod.yaml] +---- +include::k8s-pod.yaml[] +---- + +endif::[] diff --git a/integration/examples/google-cloud-build/k8s-pod.yaml b/integration/examples/google-cloud-build/k8s-pod.yaml new file mode 100644 index 00000000000..14cc6911607 --- /dev/null +++ b/integration/examples/google-cloud-build/k8s-pod.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Pod +metadata: + name: getting-started +spec: + containers: + - name: getting-started + image: gcr.io/k8s-skaffold/skaffold-example diff --git a/integration/examples/google-cloud-build/main.go b/integration/examples/google-cloud-build/main.go new file mode 100644 index 00000000000..593721cfe2e --- /dev/null +++ b/integration/examples/google-cloud-build/main.go @@ -0,0 +1,14 @@ +package main + +import ( + "fmt" + "time" +) + +func main() { + for { + fmt.Println("Hello world!") + + time.Sleep(time.Second * 1) + } +} diff --git a/integration/examples/google-cloud-build/skaffold.yaml b/integration/examples/google-cloud-build/skaffold.yaml new file mode 100644 index 00000000000..c25f9c7eee5 --- /dev/null +++ b/integration/examples/google-cloud-build/skaffold.yaml @@ -0,0 +1,11 @@ +apiVersion: skaffold/v1beta8 +kind: Config +build: + googleCloudBuild: + projectId: k8s-skaffold + artifacts: + - image: gcr.io/k8s-skaffold/skaffold-example +deploy: + kubectl: + manifests: + - k8s-* diff --git a/integration/examples/structure-tests/skaffold.yaml b/integration/examples/structure-tests/skaffold.yaml index 93e01ed7a38..c8d27422cf4 100644 --- a/integration/examples/structure-tests/skaffold.yaml +++ b/integration/examples/structure-tests/skaffold.yaml @@ -12,10 +12,6 @@ deploy: manifests: - k8s-* profiles: - - name: gcb - build: - googleCloudBuild: - projectId: k8s-skaffold - name: test test: - image: gcr.io/k8s-skaffold/skaffold-example diff --git a/integration/run_test.go b/integration/run_test.go index ae32e36d823..2a0b7bc50f7 100644 --- a/integration/run_test.go +++ b/integration/run_test.go @@ -65,8 +65,7 @@ func TestRun(t *testing.T) { pods: []string{"bazel"}, }, { description: "Google Cloud Build", - dir: "examples/structure-tests", - args: []string{"-p", "gcb"}, + dir: "examples/google-cloud-build", pods: []string{"getting-started"}, remoteOnly: true, }, {