gcb-task

command module
v0.0.0-...-16211ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

README

Google Cloud Build for Tekton

This repo provides an experimental Tekton Custom Task that executes a Google Cloud Build.

The intention is to demonstrate the kinds of things a Custom Task can do, and to demonstrate how to write a Custom Task.

Install

Install and configure ko.

ko apply -f config/

This will build and install the controller on your cluster, in the namespace cloudbuild-task.

Service Account Setup

Builds need to be created by a Service Account with appropriate permissions.

Create a GCP Service Account with the Cloud Build Editor role, create and download a key file for that SA, and create a K8s Secret with that Service Account Key:

kubectl create secret generic sa-key --from-file=key.json=PATH-TO-KEY-FILE.json -n cloudbuild-task

Run a Build

Create a Run that refers to a Build:

$ kubectl create -f gcb-run.yaml 
run.tekton.dev/gcb-run-j2w5p created
$ kubectl get runs -w
NAME            SUCCEEDED   REASON         STARTTIME   COMPLETIONTIME
gcb-run-j2w5p   Unknown     BuildWorking   15s         
gcb-run-j2w5p   True        BuildSucceeded   31s         1s

Outstanding Work

Thanks!😊 There's plenty more to do though.

Namely:

  • Don't hard-code a trivial GCB build, either let users define their build using a CRD, and/or read a build config from a repo or parameter value.
  • Accept a source archive in GCS as an input parameter, to integrate with other Tasks in a Pipeline.
  • Emit the build ID as an output result.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
apis/cloudbuild/v1alpha1
Package v1alpha1 contains API Schema definitions for the pipeline v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/imjasonh/gcb-task/pkg/apis/cloudbuild +k8s:defaulter-gen=TypeMeta +groupName=cloudbuild.googleapis.com
Package v1alpha1 contains API Schema definitions for the pipeline v1alpha1 API group +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/imjasonh/gcb-task/pkg/apis/cloudbuild +k8s:defaulter-gen=TypeMeta +groupName=cloudbuild.googleapis.com
client/cloudbuild/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/cloudbuild/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/cloudbuild/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/cloudbuild/clientset/versioned/typed/cloudbuild/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/cloudbuild/clientset/versioned/typed/cloudbuild/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL