apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: gzip-compress
  labels:
    dagweave.io/catalog-item: gzip-compress
  annotations:
    # The catalog semver this manifest was authored at. The dagweave app records
    # (catalog-item-id, semver) -> content-hash -> base-vN when it mints the tenant
    # cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.
    dagweave.io/catalog-version: "1.0.0"
    dagweave.io/catalog-category: "Data"
spec:
  entrypoint: compress
  templates:
    - name: compress
      inputs:
        parameters:
          # Local path of the file to compress.
          - name: source-path
          # Local path to write the gzipped output to.
          - name: dest-path
      container:
        # Pinned by digest per the catalog convention: an image rebuild can never
        # silently change the behaviour of an already-released item version.
        # busybox:1.38.0
        image: busybox@sha256:a46257e06c82ad85242d0d38077d0a52d9896389ca60a1a59d3463db586e5fa4
        command: [sh, -c]
        # Values are passed as env vars (below), never interpolated into the shell,
        # so a path containing shell metacharacters is safe; each $VAR is referenced
        # double-quoted.
        args:
          - |
            set -eu
            gzip -c "${SOURCE_PATH}" > "${DEST_PATH}"
        env:
          - name: SOURCE_PATH
            value: "{{inputs.parameters.source-path}}"
          - name: DEST_PATH
            value: "{{inputs.parameters.dest-path}}"
