With SAP Continuous Integration and Delivery, we strive for simplicity: Our service on SAP BTP offers ready-made pipelines for various SAP-specific development scenarios. With them, we want to help you implement CI/CD quickly and without having to care about the underlying infrastructure. Simplicity, however, shouldn’t mean inflexibility. That’s why we’ve added additional configuration options to our pipelines to make sure they work for your purposes.
In different stages of your CI/CD pipelines, you can now add additional credentials and variables. This lets you, for example, access a private repository when building your application or set a DEBUG flag when running your tests.
Have a look at the following example to see how our new feature works:
Use Private npm Packages in Your CI/CD Job
Add an access token to the
Build stage of your SAP Continuous Integration and Delivery job to access private npm packages during its execution.
Procedure
- In your source code repository, create a custom .npmrc file with the following content:
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Note:
You specify a literal value of ${NPM_TOKEN}. The npm CLI will replace this value with the contents of the NPM_TOKEN environment variable. Do not put a token in this file.
- Check in your .npmrc file.
- In SAP Continuous Integration and Delivery, create a new or edit an existing SAP Cloud Application Programming Model job.
- In the Build stage, choose + (Add credentials variable) next to Additional Credentials.
As a result, the Add Credentials Variable pop-up window opens.
- For Name, enter NPM_TOKEN.
- Open the Credentials Name drop-down list and choose Create Credentials.
As a result, the Create Credentials pop-up window opens.
- For Credentials Name, enter mynpmtoken.
- From the Type drop-down list, choose Secret Text.
- In the Secret text field, enter your token.
- Choose Create.
As a result, your newly created credential is used for Credentials Name.
- Choose OK.
- Create and run your job.
Result
You can now use private npm packages with your SAP Continuous Integration and Delivery job.
That’s cool, isn’t it? Have a look at our documentation and try it out yourself:
Adding Environment Variables to Stages | SAP Help Portal
We’re also working on adding even more flexibility to our pipelines. Stay tuned!