You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constrequestify=require('requestify');constKestra=require('@kestra-io/libs');functionGetDockerImageDownloads(imageName){// Queries the Docker Hub API to get the number of downloads for a specific Docker image.varurl=`https://hub.docker.com/v2/repositories/${imageName}/`console.log(url)requestify.get(url).then(function(response){result=JSON.parse(response.body);Kestra.outputs({"pull_count": result['pull_count']})returnresult['pull_count'];}).catch(function(error){console.log(error);})}GetDockerImageDownloads("kestra/kestra")
id: outputs_nodejsnamespace: company.teamdescription: This flow will install the npm package in a Docker container, and use kestra's NodeJS Commands task to run the script.tasks:
- id: run_nodejs_commandstype: io.kestra.plugin.scripts.node.CommandsnamespaceFiles:
enabled: truetaskRunner:
type: io.kestra.plugin.scripts.runner.docker.DockercontainerImage: node:slimwarningOnStdErr: falsebeforeCommands:
- npm install requestify
- npm install @kestra-io/libscommands:
- node outputs_nodejs.js
- id: log_downloadstype: io.kestra.plugin.core.log.Logmessage: "Number of downloads: {{ outputs.run_nodejs_commands.vars.pull_count }}"
Description
https://kestra.io/docs/how-to-guides/javascript#variable-output
Error:
The text was updated successfully, but these errors were encountered: