How to configure the Azure DevOps pipeline with Artifactory to work with the NPM packages [Build, publish, and promote]

ARTIFACTORY: How to configure the Azure DevOps pipeline with Artifactory to work with the NPM packages [Build, publish, and promote]

AuthorFullName__c
Shivani Budhodi
articleNumber
000005930
ft:sourceType
Salesforce
FirstPublishedDate
2023-12-06T20:57:22Z
lastModifiedDate
2024-08-12
VersionNumber
5
1. Install the JFrog extension to set up the Azure pipeline for integration with Artifactory.

User-added image

2. Configure the service connection inside the project settings by adding the JFrog details.

User-added image

User-added image

User-added image


3. Click on verify and should be successful.

4. You can initiate the pipeline setup by navigating to "Pipelines" and choosing the location where your code is stored. Then, select the repository you intend to work on.

User-added image

User-added image

5. Select the starter pipeline option.

User-added image

6. Now add the NPM task by selecting JFrog NPM and add all the details. You may also create your custom task by selecting the custom under the JFrog npm task.

Below screenshot for the reference:

User-added image

User-added image

User-added image


Pipelines.yaml
pool:
 vmImage: 'ubuntu-20.04'
steps:
- task: JFrogNpm@1
 inputs:
   command: 'pack and publish'
   artifactoryConnection: 'shivani'
   targetRepo: 'shivani-npm-local'
   workingFolder: 'npm3/'
   collectBuildInfo: true
   buildName: '$(Build.DefinitionName)'
   buildNumber: '$(Build.BuildNumber)'
- task: JFrogPublishBuildInfo@1
 inputs:
   artifactoryConnection: 'shivani'
   buildName: '$(Build.DefinitionName)'
   buildNumber: '$(Build.BuildNumber)'
- task: JFrogBuildPromotion@1
 inputs:
   artifactoryConnection: 'shivani'
   buildName: '$(Build.DefinitionName)'
   buildNumber: '$(Build.BuildNumber)'
   targetRepo: 'shivani-promotion-local'
   status: 'Released'
   comment: 'Released'
   sourceRepo: 'shivani-npm-local'
   includeDependencies: false
   copy: true
   dryRun: false

7. Click on save and run.

User-added image

8. Once the build is successful you could navigate to the Artifactory UI to confirm if the packages have been published and promoted to the repository.

User-added image