Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example for skaffold generate-pipeline #2822

Merged
merged 4 commits into from
Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/generate-pipeline/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.12.9-alpine3.10 as builder
COPY main.go .
RUN go build -o /app main.go

FROM alpine:3.10
CMD ["./app"]
COPY --from=builder /app .
27 changes: 27 additions & 0 deletions examples/generate-pipeline/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
=== Example: Getting started with skaffold and CI/CD using Tekton
:icons: font

This is a simple example to show users how to run the generate-pipeline command

_Please keep in mind that the generate-pipeline command is still a WIP_

Prerequisites:

* Install tekton on your cluster (https://github.com/tektoncd/pipeline/blob/master/docs/install.md)
* Have kaniko secrets setup (https://github.com/GoogleContainerTools/kaniko)
* Container registry must be public
* Give your default service account the cluster-admin role (necessary to have pipeline access secrets)
----
kubectl create clusterrolebinding serviceaccounts-cluster-admin \
--clusterrole=cluster-admin \
--user=system:serviceaccount:default:default
----

To generate and run a pipeline:

* Run skaffold generate-pipeline
* Modify skaffold.yaml to use a valid GCSbucket for kaniko
* Commit and push updated skaffold.yaml
* kubectl apply -f pipeline.yaml
* Create a pipelinerun.yaml
* kubectl apply -f pipelinerun.yaml
8 changes: 8 additions & 0 deletions examples/generate-pipeline/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: generate-pipeline
spec:
containers:
- name: generate-pipeline
image: gcr.io/k8s-skaffold/pipeline-example
14 changes: 14 additions & 0 deletions examples/generate-pipeline/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import (
"fmt"
"time"
)

func main() {
for {
fmt.Println("Hello world!")

time.Sleep(time.Second * 1)
}
}
9 changes: 9 additions & 0 deletions examples/generate-pipeline/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: skaffold/v1beta14
kind: Config
build:
artifacts:
- image: gcr.io/k8s-skaffold/pipeline-example
deploy:
kubectl:
manifests:
- k8s-*
7 changes: 7 additions & 0 deletions integration/examples/generate-pipeline/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.12.9-alpine3.10 as builder
COPY main.go .
RUN go build -o /app main.go

FROM alpine:3.10
CMD ["./app"]
COPY --from=builder /app .
27 changes: 27 additions & 0 deletions integration/examples/generate-pipeline/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
=== Example: Getting started with skaffold and CI/CD using Tekton
:icons: font

This is a simple example to show users how to run the generate-pipeline command

_Please keep in mind that the generate-pipeline command is still a WIP_

Prerequisites:

* Install tekton on your cluster (https://github.com/tektoncd/pipeline/blob/master/docs/install.md)
* Have kaniko secrets setup (https://github.com/GoogleContainerTools/kaniko)
* Container registry must be public
* Give your default service account the cluster-admin role (necessary to have pipeline access secrets)
----
kubectl create clusterrolebinding serviceaccounts-cluster-admin \
--clusterrole=cluster-admin \
--user=system:serviceaccount:default:default
----

To generate and run a pipeline:

* Run skaffold generate-pipeline
* Modify skaffold.yaml to use a valid GCSbucket for kaniko
* Commit and push updated skaffold.yaml
* kubectl apply -f pipeline.yaml
* Create a pipelinerun.yaml
* kubectl apply -f pipelinerun.yaml
8 changes: 8 additions & 0 deletions integration/examples/generate-pipeline/k8s-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: generate-pipeline
spec:
containers:
- name: generate-pipeline
image: gcr.io/k8s-skaffold/pipeline-example
14 changes: 14 additions & 0 deletions integration/examples/generate-pipeline/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import (
"fmt"
"time"
)

func main() {
for {
fmt.Println("Hello world!")

time.Sleep(time.Second * 1)
}
}
9 changes: 9 additions & 0 deletions integration/examples/generate-pipeline/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: skaffold/v1beta14
kind: Config
build:
artifacts:
- image: gcr.io/k8s-skaffold/pipeline-example
deploy:
kubectl:
manifests:
- k8s-*