SFPowerscripts is an Azure Pipelines Extension that converts Azure Pipelines into a CI/CD platform for Salesforce. The extension features the following tasks. You can read the documenation at sfpowerscripts website.
Please note this extension only works with the newer source format based repositories only and works with both Hosted Linux and Windows Agents
Service Connection to Salesforce Org using Username/Password/Security Token which can be utilized across any of the below tasks
Install SFDX CLI along with SFPowerkit Plugin
Authenticate an Org using JWT or Username/Password/Security Token
Validate a Unlocked package for metadata coverage
Install all package dependencies of an unlocked package
Run apex code analysis using PMD
Export the full metadata in an org for backup
Deployment Related Tasks
Checkout a source based artifact from git server (using PAT against HTTP) or Azure DevOps supported Git Providers using Service Credential
Deploy a delta (diff between two git commit id's )
Deploy a source format based repo to an org (scratch org/sandbox/prod)
Deploy an unlocked package to an org
Deploy destructive manifest to an org
Packaging Related Tasks
Increment Project Version Number similar to npm version patch, which can be utilized before an unlocked / source based packaging
Create an unlocked package
Create a build artifact for unlocked/source based packaging, which can be utilized in Release Pipelines
Testing Related Tasks
Trigger Apex Test
Validate Apex Test Coverge of an org
What is it?
The extension is designed with tasks which are granular, which means all the above tasks has to be orchestrated in a valid order required to reach the required objective. This allows one to utilise other commands or extensions between the tasks and be highly effective rather than getting tied to a single task. This ensures maximum flexiblity while building the pipeline.
For eg: a Pull Request validation for an unlocked package should feature the tasks in this order
Install the SFDX CLI
Validate the unlocked package for metadata coverage
Create a Scratch Org
Install Package Dependencies in the target scratch org
Deploy source to the target scratch org
Delete the scratch org ( optional : Utilize post action on create scratch org task )
Most of the tasks are very thin wrappers aroud the equivalent sfdx cli commands or the open source sfpowerkit (SFDX CLI extension). Almost all parameters that are requred during a CI run is exposed. If you feel that is not enough for the task at hand, one can quickly fall back to command line parameterized just for the task
Though the tasks can all be utilized fully in build pipeline. It is recommended to utilize the Release Pipeline to deploy the artifact to make the full use of Azure Pipelines Capability.
Checkout SFPowerscripts documentation here on how to Get Started with these tasks. The repo also features sample pipelines that demonstrate the usage of pipelines.
What if there is an issue with the extension?
Please create an issue using the methods listed here.