-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-nexus3.pipeline.yaml
140 lines (140 loc) · 3.38 KB
/
docker-nexus3.pipeline.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: docker-nexus3-pipeline
spec:
params:
- name: deployment-name
type: string
description: Deployment name
default: docker-nexus3
- name: git-url
type: string
description: Git code repository
default: 'https://github.com/kevchu3/docker-nexus3-pipeline.git'
- name: git-revision
type: string
description: Git revision to use
default: main
- name: IMAGE
type: string
description: Fully qualified image to be built
default: 'image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/docker-nexus3:latest'
workspaces:
- name: my-workspace
tasks:
- name: git-clone
taskRef:
resolver: cluster
params:
- name: kind
value: task
- name: name
value: git-clone
- name: namespace
value: openshift-pipelines
workspaces:
- name: output
workspace: my-workspace
params:
- name: URL
value: $(params.git-url)
- name: SUBDIRECTORY
value: ""
- name: DELETE_EXISTING
value: "true"
- name: REVISION
value: $(params.git-revision)
- name: build-image
taskRef:
resolver: cluster
params:
- name: kind
value: task
- name: name
value: buildah
- name: namespace
value: openshift-pipelines
workspaces:
- name: source
workspace: my-workspace
params:
- name: IMAGE
value: $(params.IMAGE)
- name: TLSVERIFY
value: 'false'
- name: DOCKERFILE
value: 'docker-nexus3/Dockerfile.rh.ubi.java17'
- name: CONTEXT
value: 'docker-nexus3'
runAfter:
- git-clone
- name: apply-manifests
taskRef:
name: apply-manifests
params:
- name: manifest_dir
value: yaml
workspaces:
- name: source
workspace: my-workspace
runAfter:
- build-image
- name: update-deployment
taskRef:
name: update-deployment
params:
- name: deployment
value: $(params.deployment-name)
- name: IMAGE
value: $(params.IMAGE)
runAfter:
- apply-manifests
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: apply-manifests
spec:
workspaces:
- name: source
params:
- name: manifest_dir
description: The directory in source that contains yaml manifests
type: string
default: "k8s"
steps:
- name: apply
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
workingDir: /workspace/source
command: ["/bin/bash", "-c"]
args:
- |-
echo Applying manifests in $(inputs.params.manifest_dir) directory
oc apply -k $(inputs.params.manifest_dir)
echo -----------------------------------
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: update-deployment
spec:
params:
- name: deployment
description: The name of the deployment patch the image
type: string
- name: IMAGE
description: Location of image to be patched with
type: string
steps:
- name: patch
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
command: ["/bin/bash", "-c"]
args:
- |-
oc patch deployment $(inputs.params.deployment) --patch='{"spec":{"template":{"spec":{
"containers":[{
"name": "$(inputs.params.deployment)",
"image":"$(inputs.params.IMAGE)"
}]
}}}}'