Update Tekton pipeline to reference upstream tasks

This commit is contained in:
Ben Wilson 2020-08-31 09:48:13 -04:00
parent 6aa9bdfc40
commit e5c7f50a11
7 changed files with 124 additions and 90 deletions

View File

@ -2,4 +2,12 @@
The configurations in this directory are for automating lightwalletd operations using Tekton.
Currently new tags will trigger a docker build and push to https://hub.docker.com/r/electriccoinco/lightwalletd
Currently new tags will trigger a docker build and push to https://hub.docker.com/r/electriccoinco/lightwalletd
## Required Pipeline tasks
- git-clone
Currently sourced from https://github.com/tektoncd/catalog/tree/master/task/git-clone/0.2
- kaniko
Currently sourced from https://github.com/tektoncd/catalog/tree/master/task/kaniko/0.1

View File

@ -1,28 +0,0 @@
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: lightwalletd-tag-pipeline
spec:
resources:
- name: source
type: git
- name: cloudlog
type: cloudEvent
- name: lightwalletd-image
type: image
params:
- name: tagName
tasks:
- name: lightwalletd-build-docker-image
taskRef:
name: build-docker-image-from-git-source
resources:
inputs:
- name: docker-source
resource: source
outputs:
- name: builtImage
resource: lightwalletd-image
- name: notification
resource: cloudlog

View File

@ -0,0 +1,39 @@
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: lightwalletd-tag-pipeline
spec:
params:
- name: gitTag
- name: gitRepositoryURL
- name: dockerHubRepo
workspaces:
- name: source
tasks:
- name: git-clone
taskRef:
name: git-clone
workspaces:
- name: output
workspace: source
params:
- name: url
value: $(params.gitRepositoryURL)
- name: revision
value: $(params.gitTag)
- name: refspec
value: +refs/tags/*:refs/remotes/origin/tags/* +refs/heads/*:refs/heads/*
- name: verbose
value: "true"
- name: kaniko-build
taskRef:
name: kaniko
runAfter:
- git-clone
params:
- name: IMAGE
value: $(params.dockerHubRepo):$(params.gitTag)
workspaces:
- name: source
workspace: source

View File

@ -0,0 +1,25 @@
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: lightwalletd-tag-pipeline-
spec:
serviceAccountName: ecc-tekton
pipelineRef:
name: lightwalletd-tag-pipeline
workspaces:
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
params:
- name: gitTag
value: GetMempoolTx
- name: gitRepositoryURL
value: https://github.com/zcash/lightwalletd.git
- name: dockerHubRepo
value: electriccoinco/lightwalletd

View File

@ -1,13 +0,0 @@
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
name: lightwalletd-tag-binding
spec:
params:
- name: dockerImageName
value: electriccoinco/lightwalletd
- name: tagName
value: $(body.extensions.tag)
- name: gitRepositoryURL
value: $(body.repository.clone_url)

View File

@ -0,0 +1,51 @@
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
name: lightwalletd-tag-binding
spec:
params:
- name: gitTag
value: $(body.tag)
- name: gitRepositoryURL
value: $(body.repository.git_http_url)
- name: dockerHubRepo
value: electriccoinco/zcashd_exporter
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerTemplate
metadata:
name: lightwalletd-tag-pipeline-template
spec:
params:
- name: gitTag
description: Git tag
- name: gitRepositoryURL
description: Git repo url
- name: dockerHubRepo
description: Docker Hub repository name
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: lightwalletd-tag-pipeline-
spec:
serviceAccountName: ecc-tekton
pipelineRef:
name: lightwalletd-tag-pipeline
workspaces:
- name: source
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
params:
- name: gitRepositoryURL
value: $(params.gitRepositoryURL)
- name: gitTag
value: $(params.gitTag)
- name: dockerHubRepo
value: $(params.dockerHubRepo)

View File

@ -1,48 +0,0 @@
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerTemplate
metadata:
name: lightwalletd-tag-pipeline-template
spec:
params:
- name: gitRepositoryURL
description: Git repo url
- name: tagName
description: Release tag name
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
generateName: lightwalletd-tag-pipeline-
spec:
serviceAccountName: ecc-tekton
pipelineRef:
name: lightwalletd-tag-pipeline
resources:
- name: source
resourceSpec:
type: git
params:
- name: revision
value: $(params.tagName)
- name: url
value: $(params.gitRepositoryURL)
- name: refspec
value: "+refs/tags/*:refs/remotes/origin/tags/*"
- name: lightwalletd-image
resourceSpec:
type: image
params:
- name: url
value: electriccoinco/lightwalletd:$(params.tagName)
- name: cloudlog
resourceSpec:
type: cloudEvent
params:
- name: targetURI
value: http://cloudlog:8080/inbox
params:
- name: gitRepositoryURL
value: $(params.gitRepositoryURL)
- name: tagName
value: $(params.tagName)