Dagweave catalog

Poll a URL until a condition holds

rest-poll-untilv1.0.2updated 2026-09-123 versions

Repeatedly GET a URL and evaluate a jq boolean filter over the JSON response, succeeding when the condition becomes truthy or failing after a maximum number of attempts. Useful for waiting on an async job or a resource to reach a desired state.

Install v1.0.2

Installs the template into your Argo namespace. The URL is pinned to this version.

kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml

Or with the Argo CLI:

argo template create -n argo https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml

Facts

Category
HTTP
Tags
curl-jq http
Entrypoint
poll
Template SHA-256
833c836d74146af1695f8bb3a2b18f43078f0a5de8c0fcda878a45652616f949
Source
rest-poll-until at catalog commit 67458f7
API
item document, latest template.yaml

Images and provenance

Every image is pinned by digest, so a rebuilt tag can never change what this version runs.

RepositoryTagDigest
badouralix/curl-jqnone recordedsha256:38362e9b8ef4bd09a88c0db07941e61e0bf0f7240e9f36a3ff2c31ad75546be2

Parameters

NameDescriptionDefault
jq-condition required A jq boolean filter over the JSON response. When it evaluates truthy the poll succeeds.
Example .status == "complete"
none
url required Absolute URL to poll (GET). Its JSON response is evaluated each attempt.
Example https://api.example.com/jobs/123
none
interval-seconds Seconds to wait between attempts. 10
max-attempts Maximum number of attempts before failing. 30

WorkflowTemplate

Download template.yaml

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: rest-poll-until
  labels:
    dagweave.io/catalog-item: rest-poll-until
  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.2"
    dagweave.io/catalog-category: "HTTP"
spec:
  entrypoint: poll
  templates:
    - name: poll
      inputs:
        parameters:
          # Absolute URL to poll (GET). Its JSON response is evaluated each attempt.
          - name: url
          # A jq boolean filter over the JSON response. When it evaluates truthy the
          # poll succeeds, e.g. '.status == "complete"'.
          - name: jq-condition
          # Seconds to wait between attempts.
          - name: interval-seconds
            default: "10"
          # Maximum number of attempts before failing.
          - name: max-attempts
            default: "30"
      container:
        # Pinned by digest per the catalog convention: an image rebuild can never
        # silently change the behaviour of an already-released item version.
        # badouralix/curl-jq:ubuntu — provides sh, curl and jq.
        image: badouralix/curl-jq@sha256:38362e9b8ef4bd09a88c0db07941e61e0bf0f7240e9f36a3ff2c31ad75546be2
        command: [sh, -c]
        # Values are passed as env vars (below), never interpolated into the shell.
        # JQ_CONDITION is used as a jq program (jq -e), not spliced into the shell, so
        # the response is polled until the condition is truthy, the attempts run out,
        # or a request fails transiently (retried on the next tick).
        args:
          - |
            set -eu
            i=0
            while [ "$i" -lt "${MAX_ATTEMPTS}" ]; do
              i=$((i + 1))
              if RESP=$(curl -sSf "${URL}"); then
                if printf '%s' "${RESP}" | jq -e "${JQ_CONDITION}" >/dev/null 2>&1; then
                  echo "condition met on attempt ${i}"
                  printf '%s\n' "${RESP}"
                  exit 0
                fi
                echo "attempt ${i}/${MAX_ATTEMPTS}: condition not yet met"
              else
                echo "attempt ${i}/${MAX_ATTEMPTS}: request failed, will retry"
              fi
              sleep "${INTERVAL}"
            done
            echo "timed out after ${MAX_ATTEMPTS} attempts" >&2
            exit 1
        env:
          - name: URL
            value: "{{inputs.parameters.url}}"
          - name: JQ_CONDITION
            value: "{{inputs.parameters.jq-condition}}"
          - name: INTERVAL
            value: "{{inputs.parameters.interval-seconds}}"
          - name: MAX_ATTEMPTS
            value: "{{inputs.parameters.max-attempts}}"

Version history

Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.

  1. 1.0.2 latest 2026-09-12

    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.

    kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml
    argo template create -n argo https://catalog.dagweave.com/api/v1/items/rest-poll-until/1.0.2/template.yaml

    version document, template.yaml

  2. 1.0.1 2026-08-02

    Swap the abandoned dwdraju/alpine-curl-jq, last built 2025-02-21, for badouralix/curl-jq, which is still being rebuilt. Fixable CRITICAL/HIGH drops from 19 to 1. Same Alpine base, same root user, same /bin/sh default command; curl goes 8.12.1 to 8.21.0 and jq 1.7.1 to 1.8.1.

    This release is documented, but its manifest is not vendored here, so it has no install command. Version document

  3. 1.0.0 2026-07-17

    Initial release.

    This release is documented, but its manifest is not vendored here, so it has no install command. Version document

Run it once

After installing, from the command line.

argo submit -n argo --from workflowtemplate/rest-poll-until \
  -p jq-condition='.status == "complete"' \
  -p url=https://api.example.com/jobs/123

Workflow that references it

A Workflow with the required parameters filled from the examples.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: rest-poll-until-
spec:
  workflowTemplateRef:
    name: rest-poll-until
  arguments:
    parameters:
      - name: jq-condition
        value: ".status == \"complete\""
      - name: url
        value: "https://api.example.com/jobs/123"

As a step of a larger workflow

steps:
  - - name: rest-poll-until
      templateRef:
        name: rest-poll-until
        template: poll