-
Notifications
You must be signed in to change notification settings - Fork 597
Expand file tree
/
Copy pathskopeo-copy.yaml
More file actions
74 lines (72 loc) · 2.58 KB
/
skopeo-copy.yaml
File metadata and controls
74 lines (72 loc) · 2.58 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
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: skopeo-copy
labels:
app.kubernetes.io/version: "0.3"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: CLI
tekton.dev/tags: cli
tekton.dev/displayName: "skopeo copy"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
spec:
description: >-
Skopeo is a command line tool for working with remote image registries.
Skopeo doesn’t require a daemon to be running while performing its operations.
In particular, the handy skopeo command called copy will ease the whole image
copy operation. The copy command will take care of copying the image from
internal.registry to production.registry. If your production registry requires
credentials to login in order to push the image, skopeo can handle that as well.
workspaces:
- name: images-url
params:
- name: srcImageURL
description: URL of the image to be copied to the destination registry
type: string
default: ""
- name: destImageURL
description: URL of the image where the image from source should be copied to
type: string
default: ""
- name: srcTLSverify
description: Verify the TLS on the src registry endpoint
type: string
default: "true"
- name: destTLSverify
description: Verify the TLS on the dest registry endpoint
type: string
default: "true"
steps:
- name: skopeo-copy
env:
- name: HOME
value: /tekton/home
image: quay.io/skopeo/stable:v1.9.0
imagePullPolicy: IfNotPresent
script: |
# Function to copy multiple images.
#
copyimages() {
filename="$(workspaces.images-url.path)/url.txt"
while read -r line || [ -n "$line" ]
do
(
set -x
skopeo copy $line --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
)
done < "$filename"
}
#
# If single image is to be copied then, it can be passed through
# params in the taskrun.
if [ "$(params.srcImageURL)" != "" ] && [ "$(params.destImageURL)" != "" ] ; then
skopeo copy "$(params.srcImageURL)" "$(params.destImageURL)" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
else
# If file is provided as a configmap in the workspace then multiple images can be copied.
#
copyimages
fi
securityContext:
runAsNonRoot: true
runAsUser: 65532