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.
Add this stage at the end of the pipeline
Use a withCredentials block so the API key is masked in console output.
stage('Create release') {
steps {
withCredentials([string(credentialsId: 'jaws-deploy-api-key', variable: 'JAWS_API_KEY')]) {
pwsh '''
Install-Module -Name JawsDeploy -Scope CurrentUser -Force
Connect-JawsDeploy -Url "https://app.jawsdeploy.net" -ApiKey $env:JAWS_API_KEY
New-JawsDeployRelease `
-Workspace "default" `
-Project "checkout-service" `
-Version "$env:BUILD_NUMBER" `
-Packages @{ "Checkout.Web" = "$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.