By Jaws Deploy team · Updated

Integrating Jenkins

Use the PowerShell SDK in a Jenkinsfile, or call the REST API directly from a sh step.

Search guides... Ctrl K

Jenkins works with Jaws Deploy through PowerShell or shell steps in a declarative or scripted Jenkinsfile. Both rely on a Jenkins credential storing the API key.

// Declarative Jenkinsfile snippet

Add this stage at the end of the pipeline

Store the service account ID and API key as a username/password credential. withCredentials exposes them as the environment variables the SDK reads and masks them in console output.

stage('Create release') {
  steps {
    withCredentials([usernamePassword(credentialsId: 'jaws-deploy-service-account',
                                      usernameVariable: 'JAWS_API_LOGIN',
                                      passwordVariable: 'JAWS_API_PASSWORD')]) {
      pwsh '''
        Import-Module ./JawsDeploySdk.psm1   # github.com/JawsDeploy/powershell-sdk
        New-JawsRelease `
            -projectId       "<project id>" `
            -version         "1.0.$env:BUILD_NUMBER" `
            -packageVersions @{ "Checkout.Web" = "1.0.$env:BUILD_NUMBER" }
      '''
    }
  }
}

Without PowerShell

If the Jenkins agents are Linux without PowerShell installed, call the REST API directly with curl from an sh step. The behaviour is identical.