-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy paths2i-java-workshop.yml
More file actions
152 lines (147 loc) · 4.63 KB
/
s2i-java-workshop.yml
File metadata and controls
152 lines (147 loc) · 4.63 KB
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
apiVersion: tekton.dev/v1beta1
kind: ClusterTask
metadata:
name: s2i-java-workshop
spec:
description: s2i-java task clones a Git repository and builds and pushes a container
image using S2I and a Java builder image.
params:
- default: latest
description: The tag of java imagestream for java version
name: VERSION
type: string
- default: .
description: The location of the path to run s2i from
name: PATH_CONTEXT
type: string
- default: "true"
description: Verify the TLS on the registry endpoint (for push/pull to a non-TLS
registry)
name: TLSVERIFY
type: string
- default: ""
description: Additional Maven arguments
name: MAVEN_ARGS_APPEND
type: string
- default: "false"
description: Remove the Maven repository after the artifact is built
name: MAVEN_CLEAR_REPO
type: string
- default: ""
description: The base URL of a mirror used for retrieving artifacts
name: MAVEN_MIRROR_URL
type: string
- description: Location of the repo where image has to be pushed
name: IMAGE
type: string
- default: registry.redhat.io/rhel8/buildah@sha256:0a86ecbdfbe86e9d225b7fe4b090a0dd6d323f8afdfdf2bd933ff223ddb53320
description: The location of the buildah builder image.
name: BUILDER_IMAGE
type: string
- default: "false"
description: Skip pushing the built image
name: SKIP_PUSH
type: string
- default: ""
description: The name of the ImageStream which should be updated
name: IMAGESTREAM
type: string
- default: ""
description: The Tag of the ImageStream which should be updated
name: IMAGESTREAMTAG
type: string
results:
- description: Digest of the image just built.
name: IMAGE_DIGEST
steps:
- args:
- |-
echo "MAVEN_CLEAR_REPO=$(params.MAVEN_CLEAR_REPO)" > env-file
[[ '$(params.MAVEN_ARGS_APPEND)' != "" ]] &&
echo "MAVEN_ARGS_APPEND=$(params.MAVEN_ARGS_APPEND)" >> env-file
[[ '$(params.MAVEN_MIRROR_URL)' != "" ]] &&
echo "MAVEN_MIRROR_URL=$(params.MAVEN_MIRROR_URL)" >> env-file
echo "Generated Env file"
echo "------------------------------"
cat env-file
echo "------------------------------"
command:
- /bin/sh
- -c
env:
- name: HOME
value: /tekton/home
image: registry.redhat.io/ocp-tools-4-tech-preview/source-to-image-rhel8@sha256:98d8cb3a255641ca6a1bce854e5e2460c20de9fb9b28e3cc67eb459f122873dd
name: gen-env-file
resources: {}
volumeMounts:
- mountPath: /env-params
name: envparams
workingDir: /env-params
- command:
- s2i
- build
- $(params.PATH_CONTEXT)
- image-registry.openshift-image-registry.svc:5000/openshift/java:$(params.VERSION)
- --image-scripts-url
- image:///usr/local/s2i
- --as-dockerfile
- /gen-source/Dockerfile.gen
- --environment-file
- /env-params/env-file
env:
- name: HOME
value: /tekton/home
image: registry.redhat.io/ocp-tools-4-tech-preview/source-to-image-rhel8@sha256:98d8cb3a255641ca6a1bce854e5e2460c20de9fb9b28e3cc67eb459f122873dd
name: generate
resources: {}
volumeMounts:
- mountPath: /gen-source
name: gen-source
- mountPath: /env-params
name: envparams
workingDir: $(workspaces.source.path)
- image: $(params.BUILDER_IMAGE)
name: build-and-push
resources: {}
script: |
buildah bud --storage-driver=vfs --tls-verify=$(params.TLSVERIFY) \
--layers -f /gen-source/Dockerfile.gen -t $(params.IMAGE) .
[[ "$(params.SKIP_PUSH)" == "true" ]] && echo "Push skipped" && exit 0
buildah push --storage-driver=vfs --tls-verify=$(params.TLSVERIFY) \
--digestfile $(workspaces.source.path)/image-digest $(params.IMAGE) \
docker://$(params.IMAGE)
cat $(workspaces.source.path)/image-digest | tee /tekton/results/IMAGE_DIGEST
securityContext:
capabilities:
add:
- SETFCAP
volumeMounts:
- mountPath: /var/lib/containers
name: varlibcontainers
- mountPath: /gen-source
name: gen-source
workingDir: /gen-source
- env:
- name: HOME
value: /tekton/home
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
name: update-image-stream
resources: {}
script: |
#!/usr/bin/env bash
oc tag --source=docker $(params.IMAGE) $(params.IMAGESTREAM):$(params.IMAGESTREAMTAG) --insecure
securityContext:
capabilities:
add:
- SETFCAP
volumes:
- emptyDir: {}
name: varlibcontainers
- emptyDir: {}
name: gen-source
- emptyDir: {}
name: envparams
workspaces:
- mountPath: /workspace/source
name: source