1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-04-11 11:41:53 +02:00
sap-jenkins-library/documentation/docs/steps/transportRequestUploadCTS.md
Roland Stengel 05301b6974
TransportRequestUploadFile migration to Go - Documentation (#3102)
* UploadFile Documentation
- migrate documentation to GO steps
- adjust UploadFile references
2021-09-27 15:14:35 +02:00

6.1 KiB

${docGenStepName}

${docGenDescription}

Prerequisites

  • You have installed the SAP component SAP_UI 7.53 or higher on your ABAP system.
  • You have enabled the OData Service to load data to the SAPUI5 ABAP repository.
  • You have the S_DEVELOP authorization to perform operations in your SAPUI5 ABAP repository.
  • You have created a transport request on the ABAP system, which is the target container of the SAPUI5 application for your upload.

Setting Up an Upload Client

The step transportRequestUploadCTS uses the Node.js-based SAP Fiori tools to upload your SAPUI5 application to the UI5 repository service of your ABAP back-end infrastructure. It performs the deployment command Fiori deploy on a Docker image.

By default, a plain node.js Docker image is pulled and equipped with the SAPUI5 toolset during runtime of the pipeline. Alternatively, you can provide your own, fully equipped Docker image. This speeds up the upload process, but requires you to maintain and provision the image on a Docker registry.

Creating a Fully Equipped Docker Image

To create an own Docker image with the SAP Fiori tools, proceed as follows:

  1. Create a node.js based Docker image with the SAP Fiori tools installed:

    FROM node
    USER root
    RUN npm install -global @ui5/cli @sap/ux-ui5-tooling @ui5/logger @ui5/fs
    USER node
    
    docker build -t my/fiori-node .
    
  2. Push your image to your private Docker Hub registry:

    docker push my/fiori-node  
    
  3. Add the following content to your config.yml file:

    steps:
      transportRequestUploadCTS:
        dockerImage: 'my/fiori-node'
        deployToolDependencies: []
    

Building an SAPUI5 Application

Build your SAPUI5 application with the build command of the SAPUI5 toolset and use the step npmExecuteScripts to run the build command. Proceed as follows to do so:

  1. Configure the steps in the package.json file of your project as follows:

    {
       ...
       "scripts": {
          "start": "ui5 serve",
          "test": "npm run lint",
          "build": "ui5 build --clean-dest",
          ...
       },
       "dependencies": {},
       "devDependencies": {
          "@ui5/cli": "^2.11.2",
          ...
       }
    }
    
  2. Configure the execution step in the pipeline as follows:

    stage('Build') {
       npmExecuteScripts(script: this, runScripts: ['build'])
    }
    

Note: Do not use the mtaBuild step. The MTA Build Tool mta is dedicated to the SAP Business Technology Platform. It does neither create the expected dist folder nor the compliant content.

Uploading an SAPUI5 Application

The Fiori toolset uses the ODATA service to upload your UI5 application to the SAPUI5 ABAP repository. It controls access by Basic Authentication (user/password based authentication).

Note: Do not upload your application to SAP Business Technology Platform. The SAP BTP does not support Basic Authentication.

Note: Use an HTTPS endpoint to ensure the encryption of your credentials.

Specifying the Transport Request

The target of the upload is a transport request, identified by an identifier (ID).

The step transportRequestUploadCTS allows you to set the ID by parameter.

Alternatively, you can pass the ID through the parameter commonPipelineEnvironment. For example, by performing a step that generates the ID or obtains it differently. For more information, see transportRequestReqIDFromGit.

Adding a Parameter

A parameterized pipeline allows you to specify the ID with the launch of each build instead of entering it statically into the pipeline.

transportRequestUploadCTS(
    script: this,
    transportRequestId: ${TRANSPORT_REQUEST_ID},
    ...
)

The Jenkins pipeline input step allows you to specify the ID at runtime of the pipeline.

def ids = input( message: "Upload?",
    parameters: [
        string(name: 'TRANSPORT_REQUEST_ID',description: 'Transport Request ID')
    ]
)

transportRequestUploadCTS(
    script:this,
    transportRequestId: ids['TRANSPORT_REQUEST_ID'],
    ...
)

Common Pipeline Environment

Use the step transportRequestReqIDFromGit to obtain the transportRequestId value from your Git commit messages.

This step extracts the ID from the commit messages of your project repository and enters it into the commonPipelineEnvironment. In turn, the upload step transportRequestUploadCTS picks it up from there.

transportRequestReqIDFromGit( script: this )
transportRequestUploadCTS( script: this, ... )

${docGenParameters}

${docGenConfiguration}

${docJenkinsPluginDependencies}

Example

# config.yaml
steps:
  transportRequestUploadCTS:
    changeManagement:
      credentialsId: 'CTS_CREDENTIALS_ID'
      endpoint: 'https://example.org'
      client: '001'
    abapPackage: 'PACK'
    applicationName: 'APP'
// pipeline script
   stage('Init') {
      transportRequestReqIDFromGit( script: this )
   }
   stage('Build') {
      npmExecuteScripts( script: this, runScripts: ['build'])
   }
   stage('Upload') {
      transportRequestUploadCTS( script: this)
   }