November's Paddleball Marathon
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@tideflowio/tideflow-agent

0.7.0 • Public • Published

Tideflow's Self-hosted Runner

With Tideflow's Self-hosted Runner, you can run workflow's task in your own server via TideFlow

For more information, visit TideFlow.io

Usage

npx @tideflowio/tideflow-agent -t [token] -u tideflow.example.com
$ tideflow-agent --help
Usage: index [options]

Options:
  -v, --version                       output the version number
  -c, --concurrency [concurrency]     Max number of jobs the agent should process concurrently
  -t, --token [token]                 Authentication token
  -u, --url [url]                     Tideflow url
  --noupdate                          Opt-out of update version check
  -h, --help                          output usage information

Examples:
  $ tideflow-agent --help
  $ tideflow-agent -h

Environment variables

# Specify authentication token. 
# Optional. Having the authentication token stored as an environment 
# variable allows users to run the agent without passing the -t parameter. 
# Example: d2a04f78-ff8a-4eb4-a12c-57fb7abf03a7 
TIDEFLOWIO_AGENT_TOKEN

How to process data from previous tasks

Each of the predecesor tasks results is represented as an array element with two root properties:

  • type: an string that defines the kind of data retuned by the previous step (object, array, file, etc)
  • data: an object containing the task's result.

Command actions

The result from previous tasks are sent to the agent commands via the parameter --tf_previous.

For example, if the command to run is meow, the agent will execute it as meow --tf_previous <previous-tasks-output>

The previous task's output is an stringified representation of the following JSON array format:

[ 
  { 
    "data": {
      "firstName": "Jose",
      "lastName": "Samantino",
    },
    "files": [
      {
        "fieldname": "file",
        "url": "https://...?token=....",
        "filename": "CV.pdf",
        "mimetype": "application/pdf"
      }
    ],
    "links": []
  }
]

NodeJS SFC actions

The result from previous tasks are stored in a file. You can get the absolute path to this file in a environment variable called TF_PREVIOUS_FILE. This is an example on how you can retrieve the previous actions results:

// Include the FileSystem package to access file system files.
const fs = require('fs')
 
// Grab the full path of the file that contents previous actions results
const filePath = process.env.TF_PREVIOUS_FILE
 
// Read the file contents
const fileContents = fs.readFileSync(filePath, 'utf8')
 
// Conver the previous actions results to Javascript object
const previousResults = JSON.parse(fileContents)

Contributing

If you would like to contribute to Tideflow, check out the Contributing Guide.

License

GNU AFFERO GENERAL PUBLIC LICENSE

Developer Resources

Install

npm i @tideflowio/tideflow-agent

DownloadsWeekly Downloads

1

Version

0.7.0

License

MIT

Unpacked Size

65.4 kB

Total Files

16

Last publish

Collaborators

  • avatar