Skip to content

Commit 3ae9319

Browse files
authored
changes for v1alpha1 tekton (#107)
* changes for v1alpha1 tekton
1 parent 8b93beb commit 3ae9319

File tree

5 files changed

+97
-95
lines changed

5 files changed

+97
-95
lines changed
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
apiVersion: tekton.dev/v1beta1
1+
apiVersion: tekton.dev/v1alpha1
22
kind: Task
33
metadata:
44
name: promote
55
spec:
6-
params:
7-
- name: github-secret
8-
type: string
9-
description: secret name of the github that has the access token. The key name is token.
10-
- name: from
11-
type: string
12-
description: github repository url to be promoted from
13-
- name: to
14-
type: string
15-
description: github repository url to be promoted to
16-
- name: service
17-
type: string
18-
description: service name to be promoted
19-
- name: commit-name
20-
type: string
21-
description: the GitHub username to username
22-
- name: commit-email
23-
type: string
24-
description: the GitHub email to use
6+
inputs:
7+
params:
8+
- name: github-secret
9+
type: string
10+
description: secret name of the github that has the access token. The key name is token.
11+
- name: from
12+
type: string
13+
description: github repository url to be promoted from
14+
- name: to
15+
type: string
16+
description: github repository url to be promoted to
17+
- name: service
18+
type: string
19+
description: service name to be promoted
20+
- name: commit-name
21+
type: string
22+
description: the GitHub username to username
23+
- name: commit-email
24+
type: string
25+
description: the GitHub email to use
2526
steps:
2627
- name: promote
2728
image: quay.io/redhat-developer/gitops-cli
2829
imagePullPolicy: Always
2930
script: |
3031
#!/bin/sh
31-
services promote --commit-name=$(params.commit-name) --commit-email=$(params.commit-email) --from $(params.from) --to $(params.to) --service $(params.service)
32+
services promote --commit-name=$(inputs.params.commit-name) --commit-email=$(inputs.params.commit-email) --from $(inputs.params.from) --to $(inputs.params.to) --service $(inputs.params.service)
3233
env:
3334
- name: GITHUB_TOKEN
3435
valueFrom:
3536
secretKeyRef:
36-
name: $(params.github-secret)
37+
name: $(inputs.params.github-secret)
3738
key: token
3839

tekton-example/v1alpha1/resources/service-promote-pipeline.yaml

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@ kind: Pipeline
33
metadata:
44
name: service-promote-pipeline
55
spec:
6-
workspaces:
7-
- name: repo-space
86
params:
9-
- name: commitId
10-
type: string
11-
description: commit ID of the source repository.
12-
- name: github-secret
13-
type: string
14-
description: name of the secret that contains the GitHub access token, the access token must be in a token key.
15-
- name: from
16-
type: string
17-
description: github repository url to be promoted from
18-
default: /workspace/repo
19-
- name: to
20-
type: string
21-
description: github repository url to be promoted to
22-
- name: service
23-
type: string
24-
description: service name to be promoted
25-
- name: commit-name
26-
type: string
27-
description: the GitHub name to use on the commit
28-
- name: commit-email
29-
type: string
30-
description: the GitHub email to use on the commit
7+
- name: commitId
8+
type: string
9+
description: commit ID of the source repository.
10+
- name: github-secret
11+
type: string
12+
description: name of the secret that contains the GitHub access token, the access token must be in a token key.
13+
- name: from
14+
type: string
15+
description: github repository url to be promoted from
16+
default: /workspace/repo
17+
- name: to
18+
type: string
19+
description: github repository url to be promoted to
20+
- name: service
21+
type: string
22+
description: service name to be promoted
23+
- name: commit-name
24+
type: string
25+
description: the GitHub name to use on the commit
26+
- name: commit-email
27+
type: string
28+
description: the GitHub email to use on the commit
3129
resources:
32-
- name: git-source
33-
type: git
34-
- name: docker-image
35-
type: image
30+
- name: git-source
31+
type: git
32+
- name: docker-image
33+
type: image
34+
workspaces:
35+
- name: repo-space
3636
tasks:
3737
- name: build-simple
3838
taskRef:
@@ -41,15 +41,15 @@ spec:
4141
- name: repo
4242
workspace: repo-space
4343
params:
44-
- name: commitId
45-
value: $(params.commitId)
44+
- name: commitId
45+
value: $(params.commitId)
4646
resources:
4747
inputs:
48-
- name: git-source
49-
resource: git-source
48+
- name: git-source
49+
resource: git-source
5050
outputs:
51-
- name: builtImage
52-
resource: docker-image
51+
- name: builtImage
52+
resource: docker-image
5353
- name: promote
5454
runAfter: [build-simple]
5555
taskRef:
@@ -58,18 +58,18 @@ spec:
5858
- name: repo
5959
workspace: repo-space
6060
params:
61-
- name: github-secret
62-
value: $(params.github-secret)
63-
- name: from
64-
value: $(params.from)
65-
- name: to
66-
value: $(params.to)
67-
- name: service
68-
value: $(params.service)
69-
- name: commit-name
70-
value: $(params.commit-name)
71-
- name: commit-email
72-
value: $(params.commit-email)
61+
- name: github-secret
62+
value: $(params.github-secret)
63+
- name: from
64+
value: $(params.from)
65+
- name: to
66+
value: $(params.to)
67+
- name: service
68+
value: $(params.service)
69+
- name: commit-name
70+
value: $(params.commit-name)
71+
- name: commit-email
72+
value: $(params.commit-email)
7373

7474

7575

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
apiVersion: tekton.dev/v1beta1
1+
apiVersion: tekton.dev/v1alpha1
22
kind: Task
33
metadata:
44
name: service-promote
55
spec:
66
workspaces:
77
- name: repo
8-
params:
9-
- name: github-secret
10-
type: string
11-
description: name of the secret that contains the GitHub access token, the access token must be in a token key.
12-
- name: from
13-
type: string
14-
description: GitHub repository URL to be promoted from
15-
default: /workspace/repo
16-
- name: to
17-
type: string
18-
description: GitHub repository URL to be promoted to
19-
- name: service
20-
type: string
21-
description: service name to be promoted
22-
- name: commit-name
23-
type: string
24-
description: the GitHub username to username
25-
- name: commit-email
26-
type: string
27-
description: the GitHub email to use
8+
inputs:
9+
params:
10+
- name: github-secret
11+
type: string
12+
description: name of the secret that contains the GitHub access token, the access token must be in a token key.
13+
- name: from
14+
type: string
15+
description: GitHub repository URL to be promoted from
16+
default: /workspace/repo
17+
- name: to
18+
type: string
19+
description: GitHub repository URL to be promoted to
20+
- name: service
21+
type: string
22+
description: service name to be promoted
23+
- name: commit-name
24+
type: string
25+
description: the GitHub username to username
26+
- name: commit-email
27+
type: string
28+
description: the GitHub email to use
2829
steps:
2930
- name: promote
3031
image: quay.io/redhat-developer/gitops-cli
3132
imagePullPolicy: Always
3233
script: |
3334
#!/bin/sh -x
34-
cd $(params.from)
35+
cd $(inputs.params.from)
3536
gitCommit=$(git rev-parse --short HEAD)
36-
services promote --commit-name=$(params.commit-name) --commit-email=$(params.commit-email) --from $(params.from) --to $(params.to) --service $(params.service) --commit-message "Publish $(params.service) commit $gitCommit"
37+
services promote --commit-name=$(inputs.params.commit-name) --commit-email=$(inputs.params.commit-email) --from $(inputs.params.from) --to $(inputs.params.to) --service $(inputs.params.service) --commit-message "Publish $(inputs.params.service) commit $gitCommit"
3738
env:
3839
- name: GITHUB_TOKEN
3940
valueFrom:
4041
secretKeyRef:
41-
name: $(params.github-secret)
42+
name: $(inputs.params.github-secret)
4243
key: token
4344

tekton-example/v1alpha1/templates/auth.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ metadata:
1818
stringData:
1919
token: REPLACE_ME.GITHUB_ACCESS_TOKEN
2020

21+
2122
---
2223

2324
apiVersion: v1
@@ -39,4 +40,4 @@ metadata:
3940
name: demo
4041
secrets:
4142
- name: secret-github
42-
- name: secret-dockerhub
43+
- name: secret-dockerhub

tekton-example/v1alpha1/templates/resources.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ spec:
3232
resources:
3333
requests:
3434
storage: 16Mi
35-
volumeMode: Filesystem
3635
accessModes:
37-
- ReadWriteOnce
36+
- ReadWriteOnce

0 commit comments

Comments
 (0)