1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00

Fix issue #1117 by using shell array and forcing word splitting

This commit is contained in:
Domenico Commisso 2022-12-15 12:17:55 +01:00 committed by tekton-robot
parent 35435fad64
commit cc481a5f26
8 changed files with 14 additions and 13 deletions

View File

@ -39,7 +39,7 @@ This `task` can be used to copy one or more than one images to-and fro various s
## Install the Task
```
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.2/raw
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.3/raw
```
## Parameters
@ -58,7 +58,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/
* `Secret` to provide the credentials of the source and destination registry where the image needs to be copied from and to.
* `ConfigMap` to provide support for copying multiple images, this contains file `url.txt` which stores images registry URL's.
[This](../0.2/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
[This](../0.3/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
## Platforms
@ -66,7 +66,7 @@ The Task can be run on `linux/amd64`, `linux/s390x`, `linux/arm64` and `linux/pp
## Usage
This task will use the `Service Account` with access to the secrets containing source and destination image registry credentials, this will authorize it to the respective image registries.
This task will use the `Service Account` with access to the secrets containing source and destination image registry credentials, this will authorize it to the respective image registries.
In case of multiple source and destination image registries that needs to be copied to and fro, a file named `url.txt` should be created containing all the source and destination image registries `URL` seperated by a space and each set of images should be written in the new line, as shown below.
@ -84,9 +84,9 @@ In case there is only one source and destination image that needs to be copied t
This will result in the image getting copied from the source registry to the destination registry.
[This](../0.2/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
[This](../0.3/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
See [here](../0.2/samples/run.yaml) for example of `TaskRun`.
See [here](../0.3/samples/run.yaml) for example of `TaskRun`.
### Note
- `Source credentials` are only required, if the source image registry needs authentication to pull the image, whereas `Destination credentials` are always required.

View File

@ -7,4 +7,4 @@ metadata:
type: kubernetes.io/basic-auth
stringData:
username: test
password: test@1
password: test@1

View File

@ -7,4 +7,4 @@ metadata:
type: kubernetes.io/basic-auth
stringData:
username: skopeotest
password: Skopeo@1
password: Skopeo@1

View File

@ -9,4 +9,4 @@ spec:
workspaces:
- name: images-url
configmap:
name: image-configmap
name: image-configmap

View File

@ -4,4 +4,4 @@ metadata:
name: secret-service-account
secrets:
- name: docker-creds
- name: quay-creds
- name: quay-creds

View File

@ -3,7 +3,7 @@ kind: Task
metadata:
name: skopeo-copy
labels:
app.kubernetes.io/version: "0.2"
app.kubernetes.io/version: "0.3"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/categories: CLI
@ -59,7 +59,8 @@ spec:
cmd="$cmd \
$url"
done
skopeo copy "$cmd" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
read -ra sourceDest <<<"${cmd}"
skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
echo "$cmd"
done < "$filename"
}

View File

@ -2,4 +2,4 @@
# Add an internal registry as sidecar to the task so we can upload it directly
# from our tests without having to go to an external registry.
add_sidecar_registry ${TMPF}
add_sidecar_registry ${TMPF}

View File

@ -14,4 +14,4 @@ spec:
name: skopeo-copy
workspaces:
- name: images-url
emptyDir: {}
emptyDir: {}