{
  "name": "rest-poll-until",
  "title": "Poll a URL until a condition holds",
  "category": "HTTP",
  "tags": [
    "curl-jq",
    "http"
  ],
  "version": "1.0.2",
  "date": "2026-09-12",
  "notes": "Move to badouralix/curl-jq:ubuntu. The Alpine build this pinned carries two jq advisories on the path this item takes, and its publisher has not rebuilt it since 1 July. The ubuntu tag has neither, and fixable CRITICAL/HIGH drops from 4 to 2. It is Ubuntu 24.04 rather than Alpine, so sh is dash rather than busybox ash, curl goes back from 8.21.0 to 8.5.0 and jq from 1.8.1 to 1.7.1. A jq-condition that needs something new in jq 1.8 stops working. Still runs as root.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml",
  "entrypoint": "poll",
  "parameters": [
    {
      "name": "jq-condition",
      "title": "jq condition",
      "description": "A jq boolean filter over the JSON response. When it evaluates truthy the poll succeeds.",
      "type": "string",
      "required": true,
      "example": ".status == \"complete\""
    },
    {
      "name": "url",
      "title": "URL",
      "description": "Absolute URL to poll (GET). Its JSON response is evaluated each attempt.",
      "type": "string",
      "required": true,
      "example": "https://api.example.com/jobs/123"
    },
    {
      "name": "interval-seconds",
      "title": "Interval (seconds)",
      "description": "Seconds to wait between attempts.",
      "type": "string",
      "required": false,
      "default": "10"
    },
    {
      "name": "max-attempts",
      "title": "Max attempts",
      "description": "Maximum number of attempts before failing.",
      "type": "string",
      "required": false,
      "default": "30"
    }
  ],
  "images": [
    {
      "ref": "badouralix/curl-jq@sha256:38362e9b8ef4bd09a88c0db07941e61e0bf0f7240e9f36a3ff2c31ad75546be2",
      "repository": "badouralix/curl-jq",
      "digest": "sha256:38362e9b8ef4bd09a88c0db07941e61e0bf0f7240e9f36a3ff2c31ad75546be2"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: rest-poll-until\n  labels:\n    dagweave.io/catalog-item: rest-poll-until\n  annotations:\n    # The catalog semver this manifest was authored at. The dagweave app records\n    # (catalog-item-id, semver) -\u003e content-hash -\u003e base-vN when it mints the tenant\n    # cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.\n    dagweave.io/catalog-version: \"1.0.2\"\n    dagweave.io/catalog-category: \"HTTP\"\nspec:\n  entrypoint: poll\n  templates:\n    - name: poll\n      inputs:\n        parameters:\n          # Absolute URL to poll (GET). Its JSON response is evaluated each attempt.\n          - name: url\n          # A jq boolean filter over the JSON response. When it evaluates truthy the\n          # poll succeeds, e.g. '.status == \"complete\"'.\n          - name: jq-condition\n          # Seconds to wait between attempts.\n          - name: interval-seconds\n            default: \"10\"\n          # Maximum number of attempts before failing.\n          - name: max-attempts\n            default: \"30\"\n      container:\n        # Pinned by digest per the catalog convention: an image rebuild can never\n        # silently change the behaviour of an already-released item version.\n        # badouralix/curl-jq:ubuntu — provides sh, curl and jq.\n        image: badouralix/curl-jq@sha256:38362e9b8ef4bd09a88c0db07941e61e0bf0f7240e9f36a3ff2c31ad75546be2\n        command: [sh, -c]\n        # Values are passed as env vars (below), never interpolated into the shell.\n        # JQ_CONDITION is used as a jq program (jq -e), not spliced into the shell, so\n        # the response is polled until the condition is truthy, the attempts run out,\n        # or a request fails transiently (retried on the next tick).\n        args:\n          - |\n            set -eu\n            i=0\n            while [ \"$i\" -lt \"${MAX_ATTEMPTS}\" ]; do\n              i=$((i + 1))\n              if RESP=$(curl -sSf \"${URL}\"); then\n                if printf '%s' \"${RESP}\" | jq -e \"${JQ_CONDITION}\" \u003e/dev/null 2\u003e\u00261; then\n                  echo \"condition met on attempt ${i}\"\n                  printf '%s\\n' \"${RESP}\"\n                  exit 0\n                fi\n                echo \"attempt ${i}/${MAX_ATTEMPTS}: condition not yet met\"\n              else\n                echo \"attempt ${i}/${MAX_ATTEMPTS}: request failed, will retry\"\n              fi\n              sleep \"${INTERVAL}\"\n            done\n            echo \"timed out after ${MAX_ATTEMPTS} attempts\" \u003e\u00262\n            exit 1\n        env:\n          - name: URL\n            value: \"{{inputs.parameters.url}}\"\n          - name: JQ_CONDITION\n            value: \"{{inputs.parameters.jq-condition}}\"\n          - name: INTERVAL\n            value: \"{{inputs.parameters.interval-seconds}}\"\n          - name: MAX_ATTEMPTS\n            value: \"{{inputs.parameters.max-attempts}}\"\n",
  "templateSha256": "833c836d74146af1695f8bb3a2b18f43078f0a5de8c0fcda878a45652616f949",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/rest-poll-until",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
