Skip to content

Commit

Permalink
APPSRE-11030: Add tekton pipelines (#9)
Browse files Browse the repository at this point in the history
* APPSRE-11030: Add tekton pipelines

This adds two `PipelineRun` objects, one of which will "respond" to
incoming pull requests to cause a build, and the other will "respond" to
merges to the main ("master") branch, causing a build.

Signed-off-by: Lisa Seelye <[email protected]>


---------

Signed-off-by: Lisa Seelye <[email protected]>
Co-authored-by: Lisa Seelye <[email protected]>
  • Loading branch information
lisa and lisa authored Nov 19, 2024
1 parent 9ee810f commit 125ca53
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .tekton/vault-exporter-master-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
annotations:
build.appstudio.openshift.io/repo: https://github.com/app-sre/vault-exporter?rev={{revision}}
build.appstudio.redhat.com/commit_sha: '{{revision}}'
build.appstudio.redhat.com/pull_request_number: '{{pull_request_number}}'
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
pipelinesascode.tekton.dev/max-keep-runs: "10"
pipelinesascode.tekton.dev/on-cel-expression: event == "pull_request" && target_branch
== "master"
creationTimestamp: null
labels:
appstudio.openshift.io/application: vault-exporter-master
appstudio.openshift.io/component: vault-exporter-master
pipelines.appstudio.openshift.io/type: build
name: vault-exporter-master-on-pull-request
namespace: app-sre-tenant
spec:
params:
- name: git-url
value: '{{source_url}}'
- name: revision
value: '{{revision}}'
- name: output-image
value: quay.io/redhat-user-workloads/app-sre-tenant/vault-exporter-master/vault-exporter-master:on-pr-{{revision}}
- name: image-expires-after
value: 5d
- name: dockerfile
value: Dockerfile
- name: path-context
value: .
- name: target-stage
value: test
pipelineRef:
resolver: git
params:
- name: url
value: https://github.com/app-sre/shared-pipelines
- name: revision
value: main
- name: pathInRepo
value: pipelines/multi-arch-build-pipeline.yaml
taskRunTemplate: {}
workspaces:
- name: workspace
volumeClaimTemplate:
metadata:
creationTimestamp: null
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
status: {}
- name: git-auth
secret:
secretName: '{{ git_auth_secret }}'
status: {}
57 changes: 57 additions & 0 deletions .tekton/vault-exporter-master-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
annotations:
build.appstudio.openshift.io/repo: https://github.com/app-sre/vault-exporter?rev={{revision}}
build.appstudio.redhat.com/commit_sha: '{{revision}}'
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
pipelinesascode.tekton.dev/max-keep-runs: "25"
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch
== "master"
creationTimestamp: null
labels:
appstudio.openshift.io/application: vault-exporter
appstudio.openshift.io/component: vault-exporter
pipelines.appstudio.openshift.io/type: build
name: vault-exporter-master-on-push
namespace: app-sre-tenant
spec:
params:
- name: git-url
value: '{{source_url}}'
- name: revision
value: '{{revision}}'
- name: output-image
value: quay.io/redhat-user-workloads/app-sre-tenant/vault-exporter-master/vault-exporter-master:{{revision}}
- name: dockerfile
value: Dockerfile
- name: path-context
value: .
- name: target-stage
value: prod
pipelineRef:
resolver: git
params:
- name: url
value: https://github.com/app-sre/shared-pipelines
- name: revision
value: main
- name: pathInRepo
value: pipelines/multi-arch-build-pipeline.yaml
taskRunTemplate: {}
workspaces:
- name: workspace
volumeClaimTemplate:
metadata:
creationTimestamp: null
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
status: {}
- name: git-auth
secret:
secretName: '{{ git_auth_secret }}'
status: {}
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ COPY --chown=${uid}:0 . .

RUN make clean vet build

FROM builder AS test

ARG uid=1001

RUN make clean vet

FROM registry.access.redhat.com/ubi9-minimal:9.4-1227.1726694542 AS prod

ARG uid=1001

COPY --chown=${uid}:0 --from=builder /build/vault-exporter /
Expand Down

1 comment on commit 125ca53

@cubismod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/retest

Please sign in to comment.