Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For all the following examples, you will need to add the WhiteSource Mend apiKey and a userKey to Jenkins Credential Manager, as a secret text.

...

Code Block
node {
  environment {
       WS_APIKEY = credentials('whitesourceMend-apikey')
       WS_WSS_URL = "https://saas.whitesourcesoftwareMendsoftware.com/agent"
       WS_USERKEY = credentials('whitesourceMend-serviceaccount-userkey')
       WS_PRODUCTNAME = "Your Product Name"
       WS_PROJECTNAME = "${JOB_NAME}"
   }
  stage('Download Unified Agent') {
   sh 'curl -LJO https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar'
  }
  stage('Run Unified Agent') {
    sh 'java -jar wss-unified-agent.jar' 
  }
}

...

Code Block
node {
  environment {
       WS_APIKEY = credentials('whitesourceMend-apikey')
       WS_WSS_URL = "https://saas.whitesourcesoftwareMendsoftware.com/agent"
       WS_USERKEY = credentials('whitesourceMend-serviceaccount-userkey')
       WS_PRODUCTNAME = "your-product-name"
       WS_PROJECTNAME = "${JOB_NAME}"
   }
  stage('Download Unified Agent') {
    bat 'powershell bitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar $pwd\wss-unified-agent.jar'
  }
  stage('Run Unified Agent') {
    bat 'java -jar wss-unified-agent.jar'
  }
}

...

  1. Download CURL, add it to your PATH environment variable.

  2. Restart Jenkins in order for it to load the new PATH variable.

  3. Go to Build Environment, click Use secret text(s) or file(s) and add your whitesourceMend-apikey and whitesourceMend-userkey credentials

  4. Go to Build, click on Add build step and then select Execute shell, Execute Windows batch command, or Run with timeout.

  5. Add the following commands on the new Command window:

    Code Block
    curl -LJO https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
    set WS_PRODUCTNAME=your-product-name
    set WS_PROJECTNAME=${JOB_NAME}
    set WS_WSS_URL=https://saas.whitesourcesoftwareMendsoftware.com/agent
    java -jar wss-unified-agent.jar

...

  1. Go to Build Environment, click Use secret text(s) or file(s) and add your whitesourceMend-apikey and whitesourceMend-userkey credentials.

  2. Go to Build, click on Add build step and then select Execute Windows batch command or Run with timeout.

  3. Add the following commands:

    Code Block
    powershell bitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar $pwd\wss-unified-agent.jar 
    set WS_PRODUCTNAME=your-product-name
    set WS_PROJECTNAME=${JOB_NAME}
    set WS_WSS_URL=https://saas.whitesourcesoftwareMendsoftware.com/agent
    java -jar wss-unified-agent.jar
    

...