Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiArch param to Skopeo task #1281

Closed
wants to merge 0 commits into from
Closed

Conversation

Joshua-Beha
Copy link
Contributor

@Joshua-Beha Joshua-Beha commented Jun 17, 2024

Changes

Add a multiArch param to the skopeo copy task. From issue #1280
/kind feature

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • [x ] Follows the authoring recommendations
  • [ x] Includes docs (if user facing)
  • [x ] Includes tests (for new tasks or changed functionality)
  • [ x] Meets the Tekton contributor standards (including functionality, content, code)
  • [x ] Commit messages follow commit message best practices
  • [ x] Has a kind label. You can add one by adding a comment on this PR that
    contains /kind <type>. Valid types are bug, cleanup, design, documentation,
    feature, flake, misc, question, tep
  • [ x] Complies with Catalog Organization TEP, see example. Note An issue has been filed to automate this validation
    • [ x] File path follows <kind>/<name>/<version>/name.yaml

    • [ x] Has README.md at <kind>/<name>/<version>/README.md

    • [ x] Has mandatory metadata.labels - app.kubernetes.io/version the same as the <version> of the resource

    • [ x] Has mandatory metadata.annotations tekton.dev/pipelines.minVersion

    • [ x] mandatory spec.description follows the convention

        ```
      
        spec:
          description: >-
            one line summary of the resource
      
            Paragraph(s) to describe the resource.
        ```
      

See the contribution guide for more details.

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 17, 2024
Copy link

linux-foundation-easycla bot commented Jun 17, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@tekton-robot tekton-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 17, 2024
@tekton-robot
Copy link

Hi @Joshua-Beha. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 17, 2024
@tekton-robot
Copy link

Diff between version 0.3 and 0.4
diff --git a/task/skopeo-copy/0.3/README.md b/task/skopeo-copy/0.4/README.md
index d71fab0..d5ee4c9 100644
--- a/task/skopeo-copy/0.3/README.md
+++ b/task/skopeo-copy/0.4/README.md
@@ -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.3/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.4/raw
 ```
 
 ## Parameters
@@ -48,6 +48,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/
 - **destImageURL**: The URL of the image where the image from `source` should be copied to.
 - **srcTLSverify**: Verify the TLS on the src registry endpoint
 - **destTLSverify**: Verify the TLS on the dest registry endpoint
+- **multiArch**: How to handle multi-architecture images (system, all, or index-only)
 
 ## Workspace
 
@@ -58,7 +59,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.3/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
+  [This](../0.4/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
 
 ## Platforms
 
@@ -84,9 +85,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.3/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
+[This](../0.4/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
 
-See [here](../0.3/samples/run.yaml) for example of `TaskRun`.
+See [here](../0.4/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.
diff --git a/task/skopeo-copy/0.3/skopeo-copy.yaml b/task/skopeo-copy/0.4/skopeo-copy.yaml
index 2df0693..cea9c68 100644
--- a/task/skopeo-copy/0.3/skopeo-copy.yaml
+++ b/task/skopeo-copy/0.4/skopeo-copy.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: skopeo-copy
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: CLI
@@ -39,6 +39,10 @@ spec:
       description: Verify the TLS on the dest registry endpoint
       type: string
       default: "true"
+    - name: multiArch
+      description: How to handle multi-architecture images (system, all, or index-only)
+      type: string
+      default: "system"
   steps:
     - name: skopeo-copy
       env:
@@ -50,6 +54,7 @@ spec:
         #
         copyimages() {
           filename="$(workspaces.images-url.path)/url.txt"
+          if ! [[ "$(params.multiArch)" =~ ^(system|all|index-only)$ ]]; then exit 1 ; fi
           while IFS= read -r line || [ -n "$line" ]
           do
             cmd=""
@@ -60,7 +65,7 @@ spec:
                   $url"
             done
             read -ra sourceDest <<<"${cmd}"
-            skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
+            skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
             echo "$cmd"
           done < "$filename"
         }
@@ -68,7 +73,7 @@ spec:
         # 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)"
+          skopeo copy --multi-arch="$(params.multiArch)" "$(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.
           #
diff --git a/task/skopeo-copy/0.3/tests/run.yaml b/task/skopeo-copy/0.4/tests/run.yaml
index 2d7fc02..0cafdb7 100644
--- a/task/skopeo-copy/0.3/tests/run.yaml
+++ b/task/skopeo-copy/0.4/tests/run.yaml
@@ -10,6 +10,8 @@ spec:
       value: docker://localhost:5000/kube:latest
     - name: destTLSverify
       value: "false"
+    - name: multiArch
+      value: "system"
   taskRef:
     name: skopeo-copy
   workspaces:

@tekton-robot
Copy link

Catlin Output
FILE: task/skopeo-copy/0.4/skopeo-copy.yaml
WARN : Step "skopeo-copy" references "$(params.multiArch)" directly from its script block. For reliability and security, consider putting the param into an environment variable of the Step and accessing that environment variable in your script instead.
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 6:
  if ! [[ "$(params.multiArch)" =~ ^(system|all|index-only)$ ]]; then exit 1 ; fi
       ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In skopeo-copy-skopeo-copy line 16:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 17:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3010 -- In POSIX sh, [[ ]] is undefined.
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 6: syntax error: unexpected "(" (expecting "then")

@tekton-robot
Copy link

Diff between version 0.3 and 0.4
diff --git a/task/skopeo-copy/0.3/README.md b/task/skopeo-copy/0.4/README.md
index d71fab0..d5ee4c9 100644
--- a/task/skopeo-copy/0.3/README.md
+++ b/task/skopeo-copy/0.4/README.md
@@ -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.3/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.4/raw
 ```
 
 ## Parameters
@@ -48,6 +48,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/
 - **destImageURL**: The URL of the image where the image from `source` should be copied to.
 - **srcTLSverify**: Verify the TLS on the src registry endpoint
 - **destTLSverify**: Verify the TLS on the dest registry endpoint
+- **multiArch**: How to handle multi-architecture images (system, all, or index-only)
 
 ## Workspace
 
@@ -58,7 +59,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.3/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
+  [This](../0.4/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
 
 ## Platforms
 
@@ -84,9 +85,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.3/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
+[This](../0.4/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
 
-See [here](../0.3/samples/run.yaml) for example of `TaskRun`.
+See [here](../0.4/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.
diff --git a/task/skopeo-copy/0.3/skopeo-copy.yaml b/task/skopeo-copy/0.4/skopeo-copy.yaml
index 2df0693..205a51a 100644
--- a/task/skopeo-copy/0.3/skopeo-copy.yaml
+++ b/task/skopeo-copy/0.4/skopeo-copy.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: skopeo-copy
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: CLI
@@ -39,6 +39,10 @@ spec:
       description: Verify the TLS on the dest registry endpoint
       type: string
       default: "true"
+    - name: multiArch
+      description: How to handle multi-architecture images (system, all, or index-only)
+      type: string
+      default: "system"
   steps:
     - name: skopeo-copy
       env:
@@ -50,6 +54,12 @@ spec:
         #
         copyimages() {
           filename="$(workspaces.images-url.path)/url.txt"
+          case "$(params.multiArch)" in all|system|index-only) 
+            ;;
+          *)
+            echo "Unrecognized multiArch choice: $(params.multiArch)"
+            exit 1;;
+          esac
           while IFS= read -r line || [ -n "$line" ]
           do
             cmd=""
@@ -60,7 +70,7 @@ spec:
                   $url"
             done
             read -ra sourceDest <<<"${cmd}"
-            skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
+            skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
             echo "$cmd"
           done < "$filename"
         }
@@ -68,7 +78,7 @@ spec:
         # 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)"
+          skopeo copy --multi-arch="$(params.multiArch)" "$(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.
           #
diff --git a/task/skopeo-copy/0.3/tests/run.yaml b/task/skopeo-copy/0.4/tests/run.yaml
index 2d7fc02..0cafdb7 100644
--- a/task/skopeo-copy/0.3/tests/run.yaml
+++ b/task/skopeo-copy/0.4/tests/run.yaml
@@ -10,6 +10,8 @@ spec:
       value: docker://localhost:5000/kube:latest
     - name: destTLSverify
       value: "false"
+    - name: multiArch
+      value: "system"
   taskRef:
     name: skopeo-copy
   workspaces:

@tekton-robot
Copy link

Catlin Output
FILE: task/skopeo-copy/0.4/skopeo-copy.yaml
WARN : Step "skopeo-copy" references "$(params.multiArch)" directly from its script block. For reliability and security, consider putting the param into an environment variable of the Step and accessing that environment variable in your script instead.
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 21:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 22:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.
  https://www.shellcheck.net/wiki/SC3054 -- In POSIX sh, array references are...

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 21: syntax error: unexpected redirection

@tekton-robot
Copy link

Diff between version 0.3 and 0.4
diff --git a/task/skopeo-copy/0.3/README.md b/task/skopeo-copy/0.4/README.md
index d71fab0..d5ee4c9 100644
--- a/task/skopeo-copy/0.3/README.md
+++ b/task/skopeo-copy/0.4/README.md
@@ -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.3/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.4/raw
 ```
 
 ## Parameters
@@ -48,6 +48,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/
 - **destImageURL**: The URL of the image where the image from `source` should be copied to.
 - **srcTLSverify**: Verify the TLS on the src registry endpoint
 - **destTLSverify**: Verify the TLS on the dest registry endpoint
+- **multiArch**: How to handle multi-architecture images (system, all, or index-only)
 
 ## Workspace
 
@@ -58,7 +59,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.3/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
+  [This](../0.4/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
 
 ## Platforms
 
@@ -84,9 +85,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.3/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
+[This](../0.4/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
 
-See [here](../0.3/samples/run.yaml) for example of `TaskRun`.
+See [here](../0.4/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.
diff --git a/task/skopeo-copy/0.3/skopeo-copy.yaml b/task/skopeo-copy/0.4/skopeo-copy.yaml
index 2df0693..141179c 100644
--- a/task/skopeo-copy/0.3/skopeo-copy.yaml
+++ b/task/skopeo-copy/0.4/skopeo-copy.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: skopeo-copy
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: CLI
@@ -39,6 +39,10 @@ spec:
       description: Verify the TLS on the dest registry endpoint
       type: string
       default: "true"
+    - name: multiArch
+      description: How to handle multi-architecture images (system, all, or index-only)
+      type: string
+      default: "system"
   steps:
     - name: skopeo-copy
       env:
@@ -60,15 +64,22 @@ spec:
                   $url"
             done
             read -ra sourceDest <<<"${cmd}"
-            skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
+            skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
             echo "$cmd"
           done < "$filename"
         }
         #
         # If single image is to be copied then, it can be passed through
         # params in the taskrun.
+        #
+        case "$(params.multiArch)" in all|system|index-only)
+            ;;
+          *)
+            echo "Unrecognized multiArch choice: $(params.multiArch)"
+            exit 1;;
+        esac
         if [ "$(params.srcImageURL)" != "" ] && [ "$(params.destImageURL)" != "" ] ; then
-          skopeo copy "$(params.srcImageURL)" "$(params.destImageURL)" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
+          skopeo copy --multi-arch="$(params.multiArch)" "$(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.
           #
diff --git a/task/skopeo-copy/0.3/tests/run.yaml b/task/skopeo-copy/0.4/tests/run.yaml
index 2d7fc02..0cafdb7 100644
--- a/task/skopeo-copy/0.3/tests/run.yaml
+++ b/task/skopeo-copy/0.4/tests/run.yaml
@@ -10,6 +10,8 @@ spec:
       value: docker://localhost:5000/kube:latest
     - name: destTLSverify
       value: "false"
+    - name: multiArch
+      value: "system"
   taskRef:
     name: skopeo-copy
   workspaces:

@tekton-robot
Copy link

Catlin Output
FILE: task/skopeo-copy/0.4/skopeo-copy.yaml
WARN : Step "skopeo-copy" references "$(params.multiArch)" directly from its script block. For reliability and security, consider putting the param into an environment variable of the Step and accessing that environment variable in your script instead.
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 15:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 16:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.
  https://www.shellcheck.net/wiki/SC3054 -- In POSIX sh, array references are...

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 15: syntax error: unexpected redirection

@tekton-robot
Copy link

Diff between version 0.3 and 0.4
diff --git a/task/skopeo-copy/0.4/.skopeo-copy.yaml.swp b/task/skopeo-copy/0.4/.skopeo-copy.yaml.swp
new file mode 100644
index 0000000..0680f88
Binary files /dev/null and b/task/skopeo-copy/0.4/.skopeo-copy.yaml.swp differ
diff --git a/task/skopeo-copy/0.3/README.md b/task/skopeo-copy/0.4/README.md
index d71fab0..d5ee4c9 100644
--- a/task/skopeo-copy/0.3/README.md
+++ b/task/skopeo-copy/0.4/README.md
@@ -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.3/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.4/raw
 ```
 
 ## Parameters
@@ -48,6 +48,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/
 - **destImageURL**: The URL of the image where the image from `source` should be copied to.
 - **srcTLSverify**: Verify the TLS on the src registry endpoint
 - **destTLSverify**: Verify the TLS on the dest registry endpoint
+- **multiArch**: How to handle multi-architecture images (system, all, or index-only)
 
 ## Workspace
 
@@ -58,7 +59,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.3/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
+  [This](../0.4/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
 
 ## Platforms
 
@@ -84,9 +85,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.3/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
+[This](../0.4/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
 
-See [here](../0.3/samples/run.yaml) for example of `TaskRun`.
+See [here](../0.4/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.
diff --git a/task/skopeo-copy/0.3/skopeo-copy.yaml b/task/skopeo-copy/0.4/skopeo-copy.yaml
index 2df0693..7a0e542 100644
--- a/task/skopeo-copy/0.3/skopeo-copy.yaml
+++ b/task/skopeo-copy/0.4/skopeo-copy.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: skopeo-copy
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: CLI
@@ -39,6 +39,10 @@ spec:
       description: Verify the TLS on the dest registry endpoint
       type: string
       default: "true"
+    - name: multiArch
+      description: How to handle multi-architecture images (system, all, or index-only)
+      type: string
+      default: "system"
   steps:
     - name: skopeo-copy
       env:
@@ -60,15 +64,24 @@ spec:
                   $url"
             done
             read -ra sourceDest <<<"${cmd}"
-            skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
+            skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
             echo "$cmd"
           done < "$filename"
         }
+        # Check that the multiArch parm is one of the supported methods
+        #
+        case "$(params.multiArch)" in all|system|index-only)
+            ;;
+          *)
+            echo "Unrecognized multiArch choice: $(params.multiArch)"
+            exit 1;;
+        esac
         #
         # 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)"
+          skopeo copy --multi-arch="$(params.multiArch)" "$(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.
           #
diff --git a/task/skopeo-copy/0.3/tests/run.yaml b/task/skopeo-copy/0.4/tests/run.yaml
index 2d7fc02..0cafdb7 100644
--- a/task/skopeo-copy/0.3/tests/run.yaml
+++ b/task/skopeo-copy/0.4/tests/run.yaml
@@ -10,6 +10,8 @@ spec:
       value: docker://localhost:5000/kube:latest
     - name: destTLSverify
       value: "false"
+    - name: multiArch
+      value: "system"
   taskRef:
     name: skopeo-copy
   workspaces:

@tekton-robot
Copy link

Catlin Output
FILE: task/skopeo-copy/0.4/skopeo-copy.yaml
WARN : Step "skopeo-copy" references "$(params.multiArch)" directly from its script block. For reliability and security, consider putting the param into an environment variable of the Step and accessing that environment variable in your script instead.
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 15:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 16:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.
  https://www.shellcheck.net/wiki/SC3054 -- In POSIX sh, array references are...

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 15: syntax error: unexpected redirection

@vinamra28
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 21, 2024
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • .skopeo-copy.yaml.swp needs to be removed
  • can you squash your commits ?

Other than this, LGTM 👍🏼

@tekton-robot
Copy link

Diff between version 0.3 and 0.4
diff --git a/task/skopeo-copy/0.3/README.md b/task/skopeo-copy/0.4/README.md
index d71fab0..d5ee4c9 100644
--- a/task/skopeo-copy/0.3/README.md
+++ b/task/skopeo-copy/0.4/README.md
@@ -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.3/raw
+kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/0.4/raw
 ```
 
 ## Parameters
@@ -48,6 +48,7 @@ kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/skopeo-copy/
 - **destImageURL**: The URL of the image where the image from `source` should be copied to.
 - **srcTLSverify**: Verify the TLS on the src registry endpoint
 - **destTLSverify**: Verify the TLS on the dest registry endpoint
+- **multiArch**: How to handle multi-architecture images (system, all, or index-only)
 
 ## Workspace
 
@@ -58,7 +59,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.3/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
+  [This](../0.4/samples/quay-secret.yaml) example can help to use secrets for providing credentials of image registries.
 
 ## Platforms
 
@@ -84,9 +85,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.3/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
+[This](../0.4/samples/serviceaccount.yaml) will guide the user to use service account for authorization to image registries.
 
-See [here](../0.3/samples/run.yaml) for example of `TaskRun`.
+See [here](../0.4/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.
diff --git a/task/skopeo-copy/0.3/skopeo-copy.yaml b/task/skopeo-copy/0.4/skopeo-copy.yaml
index 2df0693..7a0e542 100644
--- a/task/skopeo-copy/0.3/skopeo-copy.yaml
+++ b/task/skopeo-copy/0.4/skopeo-copy.yaml
@@ -3,7 +3,7 @@ kind: Task
 metadata:
   name: skopeo-copy
   labels:
-    app.kubernetes.io/version: "0.3"
+    app.kubernetes.io/version: "0.4"
   annotations:
     tekton.dev/pipelines.minVersion: "0.12.1"
     tekton.dev/categories: CLI
@@ -39,6 +39,10 @@ spec:
       description: Verify the TLS on the dest registry endpoint
       type: string
       default: "true"
+    - name: multiArch
+      description: How to handle multi-architecture images (system, all, or index-only)
+      type: string
+      default: "system"
   steps:
     - name: skopeo-copy
       env:
@@ -60,15 +64,24 @@ spec:
                   $url"
             done
             read -ra sourceDest <<<"${cmd}"
-            skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
+            skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
             echo "$cmd"
           done < "$filename"
         }
+        # Check that the multiArch parm is one of the supported methods
+        #
+        case "$(params.multiArch)" in all|system|index-only)
+            ;;
+          *)
+            echo "Unrecognized multiArch choice: $(params.multiArch)"
+            exit 1;;
+        esac
         #
         # 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)"
+          skopeo copy --multi-arch="$(params.multiArch)" "$(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.
           #
diff --git a/task/skopeo-copy/0.3/tests/run.yaml b/task/skopeo-copy/0.4/tests/run.yaml
index 2d7fc02..0cafdb7 100644
--- a/task/skopeo-copy/0.3/tests/run.yaml
+++ b/task/skopeo-copy/0.4/tests/run.yaml
@@ -10,6 +10,8 @@ spec:
       value: docker://localhost:5000/kube:latest
     - name: destTLSverify
       value: "false"
+    - name: multiArch
+      value: "system"
   taskRef:
     name: skopeo-copy
   workspaces:

@tekton-robot
Copy link

Catlin Output
FILE: task/python-boto3-aws/0.1/python-boto3-aws.yaml
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 15:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 16:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.
  https://www.shellcheck.net/wiki/SC3054 -- In POSIX sh, array references are...

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 15: syntax error: unexpected redirection

1 similar comment
@tekton-robot
Copy link

Catlin Output
FILE: task/python-boto3-aws/0.1/python-boto3-aws.yaml
Catlin script lint Output
ERROR: /usr/bin/shellcheck, [-s sh] failed:

In skopeo-copy-skopeo-copy line 15:
    read -ra sourceDest <<<"${cmd}"
         ^-^ SC3045 (warning): In POSIX sh, read -a is undefined.
                        ^-^ SC3011 (warning): In POSIX sh, here-strings are undefined.


In skopeo-copy-skopeo-copy line 16:
    skopeo copy --multi-arch="$(params.multiArch)" "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)"
                                                    ^--------------^ SC3054 (warning): In POSIX sh, array references are undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3011 -- In POSIX sh, here-strings are und...
  https://www.shellcheck.net/wiki/SC3045 -- In POSIX sh, read -a is undefined.
  https://www.shellcheck.net/wiki/SC3054 -- In POSIX sh, array references are...

ERROR: /bin/sh, [-n] failed:
skopeo-copy-skopeo-copy: line 15: syntax error: unexpected redirection

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 3, 2024
@Joshua-Beha Joshua-Beha mentioned this pull request Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants