1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-25 06:17:50 +00:00
catalog/gke-deploy/build-push-gke-deploy.yaml
Vincent Demeester 532a862f03 gke-deploy: use workspace instead of GitResource 🐐
This migrate gke-deploy to use `workspace` instead of an input
`GitResource`.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
2020-03-11 07:43:48 -05:00

137 lines
3.9 KiB
YAML

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-and-push
spec:
params:
- name: pathToContext
description: The path to the build context relative to your source repo's root. This is used by Kaniko.
default: .
- name: pathToDockerFile
description: The path to the dockerfile to build, relative to the context.
default: Dockerfile
- name: imageUrl
description: URL of image repository.
- name: imageTag
description: Tag to apply to the built image.
default: latest
workspaces:
- name: source
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor
command:
- /kaniko/executor
args:
- --dockerfile=$(params.pathToDockerFile)
- --destination=$(params.imageUrl):$(params.imageTag)
- --context=$(workspaces.source.path)/$(params.pathToContext)
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: deploy-using-gke-deploy
spec:
params:
- name: pathToKubernetesConfigs
description: The path to the Kubernetes configs to deploy, relative to your source repo's root.
- name: imageUrl
description: URL of image repository
- name: imageTag
description: Tag of the images to be used.
default: latest
- name: clusterName
description: Name of target GKE cluster to deploy to.
- name: clusterLocation
description: Zone/region of target GKE cluster to deploy to.
- name: clusterProject
description: Project of target GKE cluster to deploy to.
default: ""
workspaces:
- name: source
steps:
- name: deploy-using-gke-deploy
image: gcr.io/cloud-builders/gke-deploy
workingDir: $(workspaces.source.path)
command: ["/gke-deploy"]
args:
- "run"
- "--image=$(params.imageUrl):$(params.imageTag)"
- "--filename=$(workspaces.source.path)/$(params.pathToKubernetesConfigs)"
- "--cluster=$(params.clusterName)"
- "--location=$(params.clusterLocation)"
- "--project=$(params.clusterProject)"
- "--output=/var/tmp/gke-deploy"
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: build-push-gke-deploy
spec:
workspaces:
- name: source
params:
- name: pathToContext
type: string
description: The path to the build context relative to your source repo's root. This is used by Kaniko.
default: .
- name: pathToDockerFile
type: string
description: The path to the dockerfile to build, relative to the context.
default: Dockerfile
- name: pathToKubernetesConfigs
type: string
description: The path to the Kubernetes configs to deploy, relative to your source repo's root.
- name: imageUrl
type: string
description: URL of image repository.
- name: imageTag
type: string
description: Tag to apply to the built image.
default: latest
- name: clusterName
type: string
description: Name of target GKE cluster to deploy to.
- name: clusterLocation
type: string
description: Zone/region of target GKE cluster to deploy to.
- name: clusterProject
type: string
description: Project of target GKE cluster to deploy to.
default: ""
tasks:
- name: build-and-push
taskRef:
name: build-and-push
params:
- name: pathToContext
value: "$(params.pathToContext)"
- name: imageUrl
value: "$(params.imageUrl)"
- name: imageTag
value: "$(params.imageTag)"
workspaces:
- name: source
workspace: source
- name: deploy-using-gke-deploy
taskRef:
name: deploy-using-gke-deploy
runAfter:
- build-and-push
params:
- name: pathToKubernetesConfigs
value: "$(params.pathToKubernetesConfigs)"
- name: imageUrl
value: "$(params.imageUrl)"
- name: imageTag
value: "$(params.imageTag)"
- name: clusterName
value: "$(params.clusterName)"
- name: clusterLocation
value: "$(params.clusterLocation)"
- name: clusterProject
value: "$(params.clusterProject)"
workspaces:
- name: source
workspace: source