DEV Community

Mehak Fatima
Mehak Fatima

Posted on

Can we pass Bitbucket Variables to js File...

Pre-Requisite:

  • How to use Bitbucket pipeline.
  • How to store Bitbucket variables.

Motivation:

As you know we can store variable inside Bitbucket repository and can use them inside the Yml file to enhance Security but can we use these variables inside js files?

let’s see…

Steps:

  • We can pass these variables to the file like this node Android.js $BITRISE_TOKEN.This command will run the Android.js with the parameter. we can extract this Parameter inside the file like this const buildArgs = process.argv.slice(2); buildArgs is the array here so we will extract value like this buildArgs[0] means value 1 buildArgs[1] means value 2.

Top comments (0)