-
Notifications
You must be signed in to change notification settings - Fork 0
/
os-maven-clustertask.yml
190 lines (178 loc) · 8.28 KB
/
os-maven-clustertask.yml
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
apiVersion: tekton.dev/v1beta1
kind: ClusterTask
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"tekton.dev/v1beta1","kind":"ClusterTask","metadata":{"annotations":{"manifestival":"new","tekton.dev/pipelines.minVersion":"0.12.1","tekton.dev/tags":"build-tool"},"labels":{"app.kubernetes.io/version":"0.1","operator.tekton.dev/provider-type":"community"},"name":"maven","namespace":"openshift-pipelines","ownerReferences":[{"apiVersion":"operator.tekton.dev/v1alpha1","blockOwnerDeletion":true,"controller":true,"kind":"Config","name":"cluster","uid":"623ee2f6-8192-401d-896b-3a36f8a8566f"}]},"spec":{"description":"This
Task can be used to run a Maven
build.","params":[{"default":"gcr.io/cloud-builders/mvn","description":"Maven
base
image","name":"MAVEN_IMAGE","type":"string"},{"default":["package"],"description":"maven
goals to
run","name":"GOALS","type":"array"},{"default":"","description":"The Maven
repository mirror
url","name":"MAVEN_MIRROR_URL","type":"string"},{"default":"","description":"The
username for the proxy
server","name":"PROXY_USER","type":"string"},{"default":"","description":"The
password for the proxy
server","name":"PROXY_PASSWORD","type":"string"},{"default":"","description":"Port
number for the proxy
server","name":"PROXY_PORT","type":"string"},{"default":"","description":"Proxy
server
Host","name":"PROXY_HOST","type":"string"},{"default":"","description":"Non
proxy server
host","name":"PROXY_NON_PROXY_HOSTS","type":"string"},{"default":"http","description":"Protocol
for the proxy ie http or
https","name":"PROXY_PROTOCOL","type":"string"}],"steps":[{"image":"registry.access.redhat.com/ubi8/ubi-minimal:latest","name":"mvn-settings","script":"#!/usr/bin/env
bash\n\n[[ -f $(workspaces.maven-settings.path)/settings.xml ]]
\u0026\u0026 \\\necho 'using existing
$(workspaces.maven-settings.path)/settings.xml' \u0026\u0026 exit 0\n\ncat
\u003e $(workspaces.maven-settings.path)/settings.xml
\u003c\u003cEOF\n\u003csettings\u003e\n \u003cmirrors\u003e\n
\u003c!-- The mirrors added here are generated from environment variables.
Don't change. --\u003e\n \u003c!-- ### mirrors from ENV ### --\u003e\n
\u003c/mirrors\u003e\n \u003cproxies\u003e\n \u003c!-- The proxies
added here are generated from environment variables. Don't change.
--\u003e\n \u003c!-- ### HTTP proxy from ENV ### --\u003e\n
\u003c/proxies\u003e\n\u003c/settings\u003e\nEOF\n\nxml=\"\"\nif [ -n
\"$(params.PROXY_HOST)\" -a -n \"$(params.PROXY_PORT)\" ]; then\n
xml=\"\u003cproxy\u003e\\\n
\u003cid\u003egenproxy\u003c/id\u003e\\\n
\u003cactive\u003etrue\u003c/active\u003e\\\n
\u003cprotocol\u003e$(params.PROXY_PROTOCOL)\u003c/protocol\u003e\\\n
\u003chost\u003e$(params.PROXY_HOST)\u003c/host\u003e\\\n
\u003cport\u003e$(params.PROXY_PORT)\u003c/port\u003e\"\n if [ -n
\"$(params.PROXY_USER)\" -a -n \"$(params.PROXY_PASSWORD)\" ]; then\n
xml=\"$xml\\\n
\u003cusername\u003e$(params.PROXY_USER)\u003c/username\u003e\\\n
\u003cpassword\u003e$(params.PROXY_PASSWORD)\u003c/password\u003e\"\n
fi\n if [ -n \"$(params.PROXY_NON_PROXY_HOSTS)\" ]; then\n
xml=\"$xml\\\n
\u003cnonProxyHosts\u003e$(params.PROXY_NON_PROXY_HOSTS)\u003c/nonProxyHosts\u003e\"\n
fi\n xml=\"$xml\\\n \u003c/proxy\u003e\"\n sed -i \"s|\u003c!-- ###
HTTP proxy from ENV ### --\u003e|$xml|\"
$(workspaces.maven-settings.path)/settings.xml\nfi\n\nif [ -n
\"$(params.MAVEN_MIRROR_URL)\" ]; then\n xml=\"
\u003cmirror\u003e\\\n
\u003cid\u003emirror.default\u003c/id\u003e\\\n
\u003curl\u003e$(params.MAVEN_MIRROR_URL)\u003c/url\u003e\\\n
\u003cmirrorOf\u003ecentral\u003c/mirrorOf\u003e\\\n
\u003c/mirror\u003e\"\n sed -i \"s|\u003c!-- ### mirrors from ENV ###
--\u003e|$xml|\"
$(workspaces.maven-settings.path)/settings.xml\nfi\n"},{"args":["-s","$(workspaces.maven-settings.path)/settings.xml","$(params.GOALS)"],"command":["/usr/bin/mvn"],"image":"$(params.MAVEN_IMAGE)","name":"mvn-goals","workingDir":"$(workspaces.source.path)"}],"workspaces":[{"description":"The
workspace consisting of maven
project.","name":"source"},{"description":"The workspace consisting of the
custom maven settings provided by the user.","name":"maven-settings"}]}}
manifestival: new
tekton.dev/pipelines.minVersion: 0.12.1
tekton.dev/tags: build-tool
name: os-maven
generation: 1
spec:
description: This Task can be used to run a Maven build.
params:
- default: gcr.io/cloud-builders/mvn
description: Maven base image
name: MAVEN_IMAGE
type: string
- default:
- package
description: maven goals to run
name: GOALS
type: array
- default: ''
description: The Maven repository mirror url
name: MAVEN_MIRROR_URL
type: string
- default: ''
description: The username for the proxy server
name: PROXY_USER
type: string
- default: ''
description: The password for the proxy server
name: PROXY_PASSWORD
type: string
- default: ''
description: Port number for the proxy server
name: PROXY_PORT
type: string
- default: ''
description: Proxy server Host
name: PROXY_HOST
type: string
- default: ''
description: Non proxy server host
name: PROXY_NON_PROXY_HOSTS
type: string
- default: http
description: Protocol for the proxy ie http or https
name: PROXY_PROTOCOL
type: string
steps:
- image: 'registry.access.redhat.com/ubi8/ubi-minimal:latest'
name: mvn-settings
resources: {}
script: >
#!/usr/bin/env bash
[[ -f $(workspaces.maven-settings.path)/settings.xml ]] && \
echo 'using existing $(workspaces.maven-settings.path)/settings.xml' &&
exit 0
cat > $(workspaces.maven-settings.path)/settings.xml <<EOF
<settings>
<mirrors>
<!-- The mirrors added here are generated from environment variables. Don't change. -->
<!-- ### mirrors from ENV ### -->
</mirrors>
<proxies>
<!-- The proxies added here are generated from environment variables. Don't change. -->
<!-- ### HTTP proxy from ENV ### -->
</proxies>
</settings>
EOF
xml=""
if [ -n "$(params.PROXY_HOST)" -a -n "$(params.PROXY_PORT)" ]; then
xml="<proxy>\
<id>genproxy</id>\
<active>true</active>\
<protocol>$(params.PROXY_PROTOCOL)</protocol>\
<host>$(params.PROXY_HOST)</host>\
<port>$(params.PROXY_PORT)</port>"
if [ -n "$(params.PROXY_USER)" -a -n "$(params.PROXY_PASSWORD)" ]; then
xml="$xml\
<username>$(params.PROXY_USER)</username>\
<password>$(params.PROXY_PASSWORD)</password>"
fi
if [ -n "$(params.PROXY_NON_PROXY_HOSTS)" ]; then
xml="$xml\
<nonProxyHosts>$(params.PROXY_NON_PROXY_HOSTS)</nonProxyHosts>"
fi
xml="$xml\
</proxy>"
sed -i "s|<!-- ### HTTP proxy from ENV ### -->|$xml|" $(workspaces.maven-settings.path)/settings.xml
fi
if [ -n "$(params.MAVEN_MIRROR_URL)" ]; then
xml=" <mirror>\
<id>mirror.default</id>\
<url>$(params.MAVEN_MIRROR_URL)</url>\
<mirrorOf>central</mirrorOf>\
</mirror>"
sed -i "s|<!-- ### mirrors from ENV ### -->|$xml|" $(workspaces.maven-settings.path)/settings.xml
fi
- args:
- '-s'
- $(workspaces.maven-settings.path)/settings.xml
- $(params.GOALS)
- '-Popenshift'
command:
- /usr/bin/mvn
image: $(params.MAVEN_IMAGE)
name: mvn-goals
resources: {}
workingDir: $(workspaces.source.path)
workspaces:
- description: The workspace consisting of maven project.
name: source
- description: >-
The workspace consisting of the custom maven settings provided by the
user.
name: maven-settings