setup-node

JFrog Pipelines Documentation

ft:sourceType
Paligo

This Pipelines Task installs and sets up NodeJS programming language.

Note

This version is not supported on Windows operating systems.

Prerequisites

None.

Usage

Basic:

- task: jfrog/setup-node@v0.1.0  
  input:
    version: "18.0.0"  

You can use an Artifactory integration and local generic repository to cache the NodeJS installer. The first run of the task will download the installer from the internet and upload it to Artifactory. Following runs will download the installer from Artifactory instead.

- task: jfrog/setup-node@v0.1.0
  input:
    version: "18.0.0"
    cacheIntegration: "my_artifactory"
    cacheRepository: "pipelines_cache_local" 
Input Variables

Name

Required

Default

Description

version

true

NodeJS version to be installed

cacheIntegration

false

Any Artifactory integration available

Artifactory integration to be used to cache the installer

cacheRepository

false

Artifactory repository to be used to cache the installer

Output Variables

Name

Description

nodePath

Path to NodeJS directory

nodeBin

Path to NodeJS binary

- task: jfrog/setup-node@v0.1.0
  id: setup_node
  input:
    version: "18.0.0"
    cacheRepository: "example-repo-local"
    cacheIntegration: "artifactory"

- echo "Node path $OUT_setup_node_nodePath"
- echo "Node bin $OUT_setup_node_nodeBin"
Exported Environment Variables

Name

Description

NODEJS_HOME

Location where NodeJS is installed

PATH

$NODEJS_HOME/bin appended to PATH

How does it work?

To have NodeJS installed, the task performs the following steps:

  • Downloads NodeJS archive from https://nodejs.org/dist

  • Uploads archive to Artifactory if cache is enabled (Following runs will download from Artifactory)

  • Extracts the installer archive contents to the step workspace

  • Set up NodeJS environment variables

License

This project is licensed under Apache 2.0 license.