Run a Node.js script
Run a Node.js script you paste in, in a working directory of your choice, after installing any npm packages you list.
Install v1.0.0
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/node-script/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/node-script/1.0.0/template.yaml
Facts
- Category
- CI/CD
- Tags
- ci-cd node
- Entrypoint
run- Template SHA-256
8e2507adb73e6e8edccd9a6bdbf6c8c91bd659552b43bdef386d98ea4c30b4d9- Source
- node-script 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.
| Repository | Tag | Digest |
|---|---|---|
cgr.dev/chainguard/node | latest-dev | sha256:15c7b9f31bfbc87b78dca7adf6e8b518d7270ac425f8a346ed0e0be09fc60c53 |
Parameters
| Name | Description | Default |
|---|---|---|
script required |
The JavaScript source to run. Example console.log("hello") |
none |
npm-packages |
Space-separated npm packages to install first, pinned to a version. Leave blank to use only what Node ships. Example [email protected] |
empty |
work-dir |
Directory to run the script in, such as the checked-out repo root. | . |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: node-script
labels:
dagweave.io/catalog-item: node-script
annotations:
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "CI/CD"
spec:
entrypoint: run
templates:
- name: run
inputs:
parameters:
- name: script
- name: work-dir
default: "."
- name: npm-packages
default: ""
retryStrategy:
limit: "2"
retryPolicy: OnError
backoff:
duration: 10s
factor: "2"
maxDuration: 2m
container:
# cgr.dev/chainguard/node:latest-dev
image: cgr.dev/chainguard/node@sha256:15c7b9f31bfbc87b78dca7adf6e8b518d7270ac425f8a346ed0e0be09fc60c53
command: [sh, -c]
args:
- |
set -eu
export HOME=/tmp
if [ -n "${NPM_PACKAGES}" ]; then
npm install --silent --no-audit --no-fund --prefix /tmp/npm ${NPM_PACKAGES}
export NODE_PATH=/tmp/npm/node_modules
fi
printf '%s\n' "${SCRIPT}" > /tmp/script.js
cd "${WORK_DIR}"
node /tmp/script.js
env:
- name: SCRIPT
value: "{{inputs.parameters.script}}"
- name: WORK_DIR
value: "{{inputs.parameters.work-dir}}"
- name: NPM_PACKAGES
value: "{{inputs.parameters.npm-packages}}"
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 1Gi
securityContext:
runAsUser: 0
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.0.0 latest 2026-10-18
Initial release.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/node-script/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/node-script/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/node-script \
-p script='console.log("hello")'
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: node-script-
spec:
workflowTemplateRef:
name: node-script
arguments:
parameters:
- name: script
value: "console.log(\"hello\")"
As a step of a larger workflow
steps:
- - name: node-script
templateRef:
name: node-script
template: run