In this exercise, you will extend your job in SAP Continuous Integration and Delivery with the Additional Unit Tests and Release stages.
- In the Jobs tab in SAP Continuous Integration and Delivery, choose the job you created in Exercise 1.
- Choose Edit.
- In the Stages tab of your job details, switch on Additional Unit Tests using the toggle.
- In the npm Script text box, enter
test
.
To enable the Release stage in your SAP Continuous Integration and Delivery job, you need the name of the node for the upload to SAP Cloud Transport Management as well as a service key to authenticate your pipeline against it. We will provide these values to you.
- In the Release stage in your job details, switch on Upload to Cloud Transport Management using the toggle.
- Enter the name of the node for the upload to SAP Cloud Transport Management, which in this case is
DEV
. - For Service Key, click on the drop-down arrow and then choose Create Credentials. As a result, the Create Credentials window pops up.
- In another browser window, open the SAP BTP cockpit and navigate to the subaccount in which you’ve created an instance for SAP Cloud Transport Management.
- From the navigation area, choose Spaces and select the space in which you’ve created the Cloud Transport Management instance.
- From the navigation area, choose Services → Instances.
- Choose the name of your service instance.
- From the navigation area, choose Service Keys.
- Next to the name of your service key, click on the three dots ... and then choose View.
- Choose Copy JSON to copy the entire service key.
- Back in SAP Continuous Integration and Delivery, paste the copied service key into the Service Key text box of the Create Credentials pop-up window.
- Enter a name for the service key, for example
tms-service-key
, then choose Create. - Choose Save.
- In the Jobs tab in SAP Continuous Integration and Delivery, choose your job and trigger it by choosing Run in the top-right corner.
- After a few seconds, a new tile appears in the Builds view of your job. You should see that the build has failed in the Additional Unit Tests stage. Choose the respective build tile to view its detailed log.
In the previous run of your pipeline, Additional Unit Tests are failing because one of the unit tests is trying to access a file that doesn't exist. To fix this issue, provide the correct manifest file type and commit the changes to GitHub. Proceed as follows:
- In your GitHub repository, go to the
HTML5Module/webapp/Component.js
file. - Choose the pencil icon to edit the file.
- In line 11, change
xml
tojson
.
- Replace
Update Component.js
in the text box with a meaningful commit message, for example,Replace xml with json
. - Choose Commit changes to save the changes.
- Return to your job in SAP Continuous Integration and Delivery.
- If you created a webhook in Exercise 1, a build of your connected job is triggered automatically after committing the code changes in GitHub. If you didn't create a webhook, choose Run to start your job.
As a result, a build is triggered and a new build tile appears in the Builds section of your job. Your job should now be successful, and not only run unit tests, but also perform an upload to SAP Cloud Transport Management.
Congratulations! You've extended your CI/CD job with the Additional Unit Tests and Release stages.
Continue to Exercise 4 - Perform imports with SAP Cloud Transport Management.