### Script Constructor Example Source: https://github.com/sap/jenkins-library/blob/master/template/script.md Example of how to instantiate the script with its constructor. Ensure all required parameters are provided. ```groovy new Script() ``` -------------------------------- ### Example Step Usage Source: https://github.com/sap/jenkins-library/blob/master/template/step.md This is a placeholder for an example of how to use the step. It should demonstrate typical invocation and parameter passing. ```groovy ``` -------------------------------- ### Simple npmExecuteTests Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/npmExecuteTests.md This example demonstrates a basic usage of the npmExecuteTests step to run wdi5 tests with a specified baseUrl. ```yaml stages: - name: Test steps: - name: npmExecuteTests type: npmExecuteTests params: baseUrl: "http://example.com/index.html" ``` -------------------------------- ### neoDeploy Configuration Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/neoDeploy.md An example configuration for the neoDeploy step, specifying the deployment mode and Neo connection details. ```yaml steps: <...> neoDeploy: deployMode: mta neo: account: host: hana.example.org ``` -------------------------------- ### Publish Stage Configuration Example (config.yml) Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/publish.md This example shows how to configure the Publish stage in the `config.yml` file, including credentials and the add-on descriptor file name. It also specifies the target vector scope for the publish action. ```yaml general: abapAddonAssemblyKitCredentialsId: 'TechUserAAKaaS' addonDescriptorFileName: 'addon.yml' stages: Publish: targetVectorScope: 'P' ``` -------------------------------- ### Full Example Configuration Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadSOLMAN.md A comprehensive example demonstrating the configuration of transportRequestUploadSOLMAN with various parameters including endpoint, credentials, IDs, file path, and client options. ```groovy transportRequestUploadSOLMAN( script: this, endpoint: 'https://example.org/cm/solman/endpoint' applicationId: 'ABC', uploadCredentialsId: "SOLMAN_CRED_ID" changeDocumentId: '1000001234', transportRequestId: 'ABCD10005E', filePath: '/path/file.ext', cmClientOpts: '-Dkey=value' ) ``` -------------------------------- ### Example Piper Project Configuration Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/configuration.md An example `.pipeline/config.yml` file demonstrating general settings like `gitSshKeyCredentialsId` and step-specific configurations for `cloudFoundryDeploy` and `newmanExecute`. ```yaml general: gitSshKeyCredentialsId: GitHub_Test_SSH steps: cloudFoundryDeploy: deployTool: 'cf_native' cloudFoundry: org: 'testOrg' space: 'testSpace' credentialsId: 'MY_CF_CREDENTIALSID_IN_JENKINS' newmanExecute: newmanCollection: 'myNewmanCollection.file' newmanEnvironment: 'myNewmanEnvironment' newmanGlobals: 'myNewmanGlobals' ``` -------------------------------- ### Complete ABAP Environment Build Configuration Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentBuild.md A comprehensive example of the config.yml configuration for the abapEnvironmentBuild step, including optional parameters like certificate names, phase, values, download/publish filenames, subdirectory, prefix, error handling, runtime, and polling interval. ```yaml stages: MyPhase: abapCredentialsId: 'abapCredentialsId' host: 'https://myABAPendpoint.com' certificateNames: ['myCert.cer'] phase: 'MyPhase' values: '[{"value_id":"ID1","value":"Value1"},{"value_id":"ID2","value":"Value2"}]' downloadResultFilenames: ['File1','File2'] publishResultFilenames: ['File2'] subDirectoryForDownload: 'MyDir' filenamePrefixForDownload: 'MyPrefix' treatWarningsAsError: true maxRuntimeInMinutes: 360 pollingIntervallInSeconds: 15 ``` -------------------------------- ### Example Configuration for Change Management Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/checkChangeInDevelopment.md This YAML snippet shows an example configuration for the 'general/changeManagement' section, which is shared across related steps. It includes settings for change document labels, client options, credentials, endpoint, and Git parameters. ```yaml general: changeManagement: changeDocumentLabel: 'ChangeDocument\s?:' cmClientOpts: '-Djavax.net.ssl.trustStore=' credentialsId: 'CM' endpoint: 'https://example.org/cm' git: from: 'HEAD~1' to: 'HEAD' format: '%b' ``` -------------------------------- ### Basic Maven Execute Usage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/mavenExecute.md Demonstrates the basic usage of the `mavenExecute` step with 'clean' and 'install' goals. ```groovy mavenExecute script: this, goals: ['clean', 'install'] ``` -------------------------------- ### Per-Step Configuration Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadFile.md Shows how to configure 'transportRequestUploadFile' step-specific parameters, overriding general settings. ```yaml [...] steps: transportRequestUploadFile: applicationId: 'FOO' changeManagement: type: 'SOLMAN' endpoint: 'https://example.org/cm' [...] ``` -------------------------------- ### Example Configuration for Change Management Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestCreate.md Example content for the `myConfig.yml` file, defining general change management properties. These properties can be shared across multiple steps. ```yaml general: changeManagement: changeDocumentLabel: 'ChangeDocument\s?:' cmClientOpts: '-Djavax.net.ssl.trustStore=' credentialsId: 'CM' type: 'SOLMAN' endpoint: 'https://example.org/cm' git: from: 'HEAD~1' to: 'HEAD' format: '%b' ``` -------------------------------- ### RFC Upload Configuration Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadRFC.md Example configuration for the `transportRequestUploadRFC` step, including change management credentials, endpoint, ABAP package, application details, and Docker image. ```yaml # config.yaml steps: transportRequestUploadRFC: changeManagement: credentialsId: 'RFC_CREDENTIALS_ID' endpoint: 'https://example.org/cm/rfc/endpoint' instance: '00' client: '001' abapPackage: 'PACK' applicationDescription: 'Lorem ipsum' applicationName: 'APP' dockerImage: 'my/rfc-client' ``` -------------------------------- ### Example Configuration for Change Management Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/isChangeInDevelopment.md This YAML configuration sets up credentials and endpoints for change management, including the `isChangeInDevelopment` step. ```yaml # config.yaml general: changeManagement: credentialsId: 'SOLMAN_CRED_ID' endpoint: 'https://example.org/cm/solman/endpoint' steps: isChangeInDevelopment: dockerImage: 'ppiper/cm-client:3.0.0.0' transportRequestUploadSOLMAN: dockerImage: 'ppiper/cm-client:3.0.0.0' applicationId: 'APPID', filePath: '/path/file.ext', ``` -------------------------------- ### Advanced npmExecuteTests with Custom Scripts and Vault Credentials Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/npmExecuteTests.md This example shows how to use npmExecuteTests with custom install and run commands, integrating with Vault for secure credential management. It supports multiple URLs from secrets, setting environment variables for each test run. ```yaml stages: - name: Test steps: - name: npmExecuteTests type: npmExecuteTests params: installCommand: "npm install" runCommand: "npm run custom-e2e-test" usernameEnvVar: "e2e_username" passwordEnvVar: "e2e_password" baseUrl: "http://example.com/index.html" urlOptionPrefix: "--base-url=" ``` ```json { "URLs": [ { "url": "http://one.example.com/index.html", "username": "some-username1", "password": "some-password1" }, { "url": "http://two.example.com/index.html", "username": "some-username2", "password": "some-password2" } ], "username": "base-url-username", "password": "base-url-password" } ``` ```shell npm run custom-e2e-test --base-url=http://one.example.com/index.html ``` ```shell e2e_username=some-username1 e2e_password=some-password1 ``` -------------------------------- ### Configuration Example: config.yml Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/build.md Defines general and stage-specific configurations for the build process, including credentials and service details. ```yaml general: abapAddonAssemblyKitCredentialsId: 'TechUserAAKaaS' addonDescriptorFileName: 'addon.yml' cfApiEndpoint: 'https://api.cf.sap.hana.ondemand.com' cfOrg: 'myOrgBld' cfSpace: 'mySpaceBld' cfCredentialsId: 'cfAuthentification' cfServiceInstance: 'bld_system' cfServiceKeyName: 'JENKINS_SAP_COM_0948' stages: Build: cfServiceKeyName: 'JENKINS_SAP_COM_0582' cfServiceKeyConfig: 'sap_com_0582.json' ``` -------------------------------- ### Script Method Example Source: https://github.com/sap/jenkins-library/blob/master/template/script.md Example of calling a specific method within the script. This method has no return value and no side effects. ```groovy script.() ``` -------------------------------- ### Basic Jenkinsfile Setup Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/stages/examples.md This is the minimal required code for a Jenkinsfile when using the piper-lib library. ```groovy @Library('piper-lib') _ piperPipeline script: this ``` -------------------------------- ### Configuration File Update Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadFile.md Illustrates the transition from old 'rfc.docker' parameters to the new 'steps.transportRequestUploadRFC.dockerImage' in the configuration file. ```yaml general: changeManagement: type: 'RFC' # old rfc: docker: image: 'my/rfc-client' #new steps: transportRequestUploadRFC: dockerImage: 'my/rfc-client' ``` -------------------------------- ### Setup Common Pipeline Environment Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/setupCommonPipelineEnvironment.md Call this step to initialize the common pipeline environment. It utilizes a configuration file for default property values. ```groovy setupCommonPipelineEnvironment script: this ``` -------------------------------- ### Basic ATC System Configuration JSON Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentPushATCSystemConfig.md A standard `atcSystemConfig.json` file example for creating or updating an ATC system configuration. Ensure this file is located in the same Git repository folder as your Jenkinsfile. ```json { "conf_name": "myATCSystemConfigurationName", "checkvariant": "SAP_CLOUD_PLATFORM_ATC_DEFAULT", "block_findings": "0", "inform_findings": "1" } ``` -------------------------------- ### YAML Configuration for integrationArtifactGetServiceEndpoint Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/integrationArtifactGetServiceEndpoint.md Shows an example of configuring the integrationArtifactGetServiceEndpoint step in a YAML file, specifying credentials and integration flow ID. ```yaml steps: <...> integrationArtifactGetServiceEndpoint: cpiApiServiceKeyCredentialsId: 'MY_API_SERVICE_KEY' integrationFlowId: 'MY_INTEGRATION_FLOW_ID' ``` -------------------------------- ### xsDeploy Configuration in Jenkinsfile Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/xsDeploy.md Example of configuring the xsDeploy step within the 'steps' section of a Jenkinsfile. ```yaml steps: <...> xsDeploy: mtaPath: path/to/archiveFile.mtar credentialsId: my-credentials-id apiUrl: https://example.org/xs space: mySpace org: myOrg ``` -------------------------------- ### ATC System Configuration JSON Example with Priority Change Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentPushATCSystemConfig.md Example of an `atcSystemConfig.json` file used to create or update an ATC system configuration, including a specific priority change for a test. This file should be stored in the same Git folder as the Jenkinsfile. ```json { "conf_name": "myATCSystemConfigurationName", "checkvariant": "SAP_CLOUD_PLATFORM_ATC_DEFAULT", "block_findings": "0", "inform_findings": "1", "_priorities": [ { "test": "CL_CI_TEST_AMDP_HDB_MIGRATION", "message_id": "FAIL_ABAP", "priority": 2 } ] } ``` -------------------------------- ### Basic Kaniko Execute Usage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/kanikoExecute.md A simple example of how to execute the kanikoExecute step in a Jenkins pipeline. ```groovy kanikoExecute script:this ``` -------------------------------- ### Configure AUnit Stage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/test.md Example `config.yml` for the AUnit stage. This configuration specifies the general pipeline parameters and the path to the AUnit configuration file. ```yaml general: cfApiEndpoint: 'https://api.cf.sap.hana.ondemand.com' cfOrg: 'myOrg' cfSpace: 'mySpace' cfCredentialsId: 'cfAuthentification' cfServiceInstance: 'abap_system' stages: AUnit: aUnitConfig: 'aUnitConfig.yml' ``` -------------------------------- ### Example Configuration in config.yaml Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadCTS.md This YAML configuration specifies the necessary details for the transportRequestUploadCTS step, including CTS credentials, endpoint, client, ABAP package, and application name. ```yaml # config.yaml steps: transportRequestUploadCTS: changeManagement: credentialsId: 'CTS_CREDENTIALS_ID' endpoint: 'https://example.org' client: '001' abapPackage: 'PACK' applicationName: 'APP' ``` -------------------------------- ### YAML Configuration for Integration Artifact Deploy Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/integrationArtifactDeploy.md Example of how to configure the integration artifact deploy step in a YAML file, such as .pipeline/config.yaml. Specify credentials and the integration flow ID. ```yaml steps: <...> integrationArtifactDeploy: cpiApiServiceKeyCredentialsId: 'MY_API_SERVICE_KEY' integrationFlowId: 'MY_INTEGRATION_FLOW_NAME' ``` -------------------------------- ### Service Key Configuration Example: sap_com_0582.json Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/build.md Provides the configuration details for the SAP_COM_0582 service scenario, specifying the scenario ID and type. ```json { "scenario_id": "SAP_COM_0582", "type": "basic" } ``` -------------------------------- ### Configuration Example: config.yml Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/cloneRepositories.md Defines general Cloud Foundry settings and activates the 'Clone Repositories' stage, specifying the path to the repositories configuration file and the clone strategy. ```yaml general: cfApiEndpoint: 'https://api.cf.sap.hana.ondemand.com' cfOrg: 'myOrg' cfSpace: 'mySpace' cfCredentialsId: 'cfAuthentification' cfServiceInstance: 'abap_system' stages: Clone Repositories: repositories: 'repositories.yml' strategy: 'Clone' ``` -------------------------------- ### Example repositories.yml structure Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentPullGitRepo.md Defines the structure for a `repositories.yml` file, specifying Git repository names, branches, and optionally commit IDs or tags for the `abapEnvironmentPullGitRepo` step. ```yaml repositories: - name: '/DMO/GIT_REPOSITORY' branch: 'main' - name: '/DMO/GIT_REPO_COMMIT' branch: 'feature' commitID: 'cd87a3cac2bc946b7629580e58598c3db56a26f8' - name: '/DMO/GIT_REPO_TAG' branch: 'realease' tag: 'myTag' ``` -------------------------------- ### Configure ATC System Configuration via config.yml Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentPushATCSystemConfig.md Example configuration for `config.yml` to set up ATC system configuration, providing direct ABAP endpoint details. ```yaml steps: abapEnvironmentPushATCSystemConfig: abapCredentialsId: 'abapCredentialsId' host: 'https://myABAPendpoint.com' atcSystemConfigFilePath: 'atcSystemConfig.json' ``` -------------------------------- ### Specify Git Commit Range with Custom Start Commit Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestReqIDFromGit.md Configure the Git commit range for searching the transport request ID. This example sets the starting commit to '4378bb4', allowing retrieval of IDs from a specific point in the main branch history. ```yaml steps: transportRequestReqIDFromGit: gitFrom: '4378bb4' ``` -------------------------------- ### Jenkinsfile Configuration for gctsExecuteABAPUnitTests Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/gctsExecuteABAPUnitTests.md Example configuration for using the gctsExecuteABAPUnitTests step within a Jenkinsfile. Ensure Git Plugin and Warnings-Next-Generation Plugin are installed. ```groovy gctsExecuteABAPUnitTests( script: this, host: 'https://abap.server.com:port', client: '000', abapCredentialsId: 'ABAPUserPasswordCredentialsId', repository: 'myrepo', scope: 'remoteChangedObjects', commit: "${env.GIT_COMMIT}", workspace: "${WORKSPACE}", queryparameters: [saml2: 'disabled'] ) ``` -------------------------------- ### Configuration Example for Post Stage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/post.md This YAML configuration demonstrates how to set up the Post stage, including general Cloud Foundry details and specific parameters like `confirmDeletion` and `cfDeleteServiceKeys`. ```yaml general: cfApiEndpoint: 'https://api.cf.sap.hana.ondemand.com' cfOrg: 'myOrg' cfSpace: 'mySpace' cfCredentialsId: 'cfAuthentification' cfServiceInstance: 'abap_system' stages: Post: confirmDeletion: true cfDeleteServiceKeys: true ``` -------------------------------- ### Configure Git Commit Range (gitFrom) Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestDocIDFromGit.md Example of how to configure the `gitFrom` parameter in `steps` to specify a starting commit for the Git log scan. This is useful if previous change document IDs exist in the history. ```yaml steps: transportRequestDocIDFromGit: gitFrom: '4378bb4' ``` -------------------------------- ### Define Modified Ready-Made Pipeline Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/extensibility.md Adapt a centrally maintained Jenkins pipeline for individual project needs by copying and modifying its structure. This example shows the basic setup for a Jenkinsfile that loads and calls a shared library pipeline. ```groovy @Library(/* Shared library definition, see below */) _ call script: this void call(parameters) { // Your pipeline code based on our ready-made pipelines } ``` -------------------------------- ### Execute Selenium Tests with Git and npm Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/seleniumExecuteTests.md This snippet shows how to execute Selenium tests by cloning a Git repository and running npm install followed by the test script. ```groovy seleniumExecuteTests (script: this) { git url: 'https://github.com/xxxxx/WebDriverIOTest.git' sh '''npm install node index.js''' } ``` -------------------------------- ### Full Pipeline Script Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadCTS.md A complete Jenkins pipeline script demonstrating the initialization of transport request ID from Git, building the application, and uploading it using transportRequestUploadCTS. ```groovy // pipeline script stage('Init') { transportRequestReqIDFromGit( script: this ) } stage('Build') { npmExecuteScripts( script: this, runScripts: ['build']) } stage('Upload') { transportRequestUploadCTS( script: this) } ``` -------------------------------- ### Add-on Descriptor Example: addon.yml Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/build.md Specifies the add-on product, version, and component repositories, including branches and commit IDs. Use the long commit ID for accuracy. ```yaml --- addonProduct: /NAMESPC/PRODUCTX addonVersion: 1.2.0 repositories: - name: /NAMESPC/COMPONENTA branch: v1.2.0 version: 1.2.0 commitID: 7d4516e9 - name: /NAMESPC/COMPONENTB branch: v2.0.0 version: 2.0.0 commitID: 9f102ffb ``` -------------------------------- ### Configuration Example for Prepare System Stage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/prepareSystem.md This YAML configuration defines parameters for the 'Prepare System' stage, including Cloud Foundry details and ABAP system specific settings. Ensure the `config.yml` file is correctly structured for stage activation. ```yaml general: cfApiEndpoint: 'https://api.cf.sap.hana.ondemand.com' cfOrg: 'myOrg' cfSpace: 'mySpace' cfCredentialsId: 'cfAuthentification' cfServiceInstance: 'abap_system' stages: Prepare System: cfService: 'abap' cfServicePlan: 'standard' abapSystemAdminEmail: 'user@example.com' abapSystemDescription: 'ABAP Environment Q System' abapSystemIsDevelopmentAllowed: false abapSystemID: 'H02' abapSystemSizeOfPersistence: 4 abapSystemSizeOfRuntime: 1 ``` -------------------------------- ### Install Log4brains Source: https://github.com/sap/jenkins-library/blob/master/documentation/adr/README.md Install the Log4brains tool globally using npm. This is required for local development and management of ADRs. ```bash npm install -g log4brains ``` -------------------------------- ### Transport Request Release Example (CTS) Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestRelease.md Example of invoking the transportRequestRelease step for CTS change management. Requires 'transportRequestId'. ```groovy // CTS transportRequestRelease script:this, transportRequestId: '001', changeManagement: [ type: 'CTS' endpoint: 'https://example.org/cm' ] ``` -------------------------------- ### cnbBuild with User Provided Buildpacks Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/cnbBuild.md Illustrates how to provide a list of specific buildpacks to be used during the image build process. ```groovy cnbBuild( script: this, dockerConfigJsonCredentialsId: 'DOCKER_REGISTRY_CREDS', containerImageName: 'images/example', containerImageTag: 'v0.0.1', containerRegistryUrl: 'gcr.io', buildpacks: ['docker.io/paketobuildpacks/nodejs', 'paketo-community/build-plan'] ) ``` -------------------------------- ### Transport Request Release Example (SOLMAN) Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestRelease.md Example of invoking the transportRequestRelease step for SOLMAN change management. Requires 'changeDocumentId' and 'transportRequestId'. ```groovy // SOLMAN transportRequestRelease script:this, changeDocumentId: '001', transportRequestId: '001', changeManagement: [ type: 'SOLMAN' endpoint: 'https://example.org/cm' ] ``` -------------------------------- ### cnbBuild with Build Environment Variables Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/cnbBuild.md Demonstrates how to set environment variables that will be available during the build process. ```groovy cnbBuild( script: this, dockerConfigJsonCredentialsId: 'DOCKER_REGISTRY_CREDS', containerImageName: 'images/example', containerImageTag: 'v0.0.1', containerRegistryUrl: 'gcr.io', buildEnvVars: [ "FOO": "BAR" ] ) ``` -------------------------------- ### Verify Piper CLI Version Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/cli/index.md Check the installed version of the Piper CLI by running the 'version' command. This helps confirm a successful installation. ```bash piper version ``` -------------------------------- ### Slack Send Notification Pipeline Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/slackSendNotification.md Example of using the slackSendNotification step within a Jenkins pipeline's post-build actions to send a notification. ```groovy pipeline { agent any stages { stage('Build') { steps { echo "do something" } } } post { always { slackSendNotification script: this } } } ``` -------------------------------- ### Initialize CAP Project Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/scenarios/CAP_Scenario.md Use the `cds-dk` to generate a new CAP project with specified extensions like Java, MTA, and SAP HANA. ```bash cds init bookshop --add java,mta,samples,hana ``` -------------------------------- ### Example Git Commit Message Format Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestDocIDFromGit.md This is an example of how a Git commit message should be formatted to include the change document ID. The `ChangeDocument` label is used by default. ```text Upload - define the change document ID ChangeDocument: 1000001234 ``` -------------------------------- ### Add-on Descriptor File Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/scenarios/abapEnvironmentAddons.md Defines the add-on product and its contained software component versions for a build. Ensure the `addonVersion` follows the leading software component's versioning. ```YAML --- addonProduct: "/NAMESPC/PRODUCTX" addonVersion: "1.2.0" repositories: - name: "/NAMESPC/COMPONENTA" branch: "v1.2.0" version: "1.2.0" commitID: "7d4516e9" languages: - DE - EN - name: "/NAMESPC/COMPONENTB" branch: "v2.0.0" version: "2.0.0" commitID: "9f102ffb" languages: - DE - EN - FR ``` -------------------------------- ### Logging with Logrus Source: https://github.com/sap/jenkins-library/blob/master/documentation/DEVELOPMENT.md Demonstrates how to import and use the sirupsen/logrus framework for logging within a step. ```golang import ( "github.com/SAP/jenkins-library/pkg/log" ) func myStep ... ... log.Entry().Info("This is my info.") ... } ``` -------------------------------- ### Basic Usage of cfManifestSubstituteVariables Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/cfManifestSubstituteVariables.md Demonstrates the basic usage of the step with default parameters for manifest and variable files. ```groovy cfManifestSubstituteVariables ( script: this, manifestFile: "path/to/manifest.yml", //optional, default: manifest.yml manifestVariablesFiles: ["path/to/manifest-variables.yml"] //optional, default: ['manifest-variables.yml'] manifestVariables: [[key : value], [key : value]] //optional, default: [] ) ``` -------------------------------- ### Vault Secret Resource Reference Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/developer_hints/VaultResourceReference.md Example of a parameter configuration using `vaultSecret` to reference a secret from HashiCorp Vault. This configuration specifies the secret type, the paths to search in Vault, and the expected secret field name. ```yaml - name: token type: string description: "Token used to authenticate with the Sonar Server." scope: - PARAMETERS secret: true resourceRef: - type: vaultSecret paths: - $(vaultBasePath)/$(vaultPipelineName)/sonar - $(vaultBasePath)/__group/sonar ``` -------------------------------- ### Simple cnbBuild Usage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/cnbBuild.md Demonstrates the basic usage of the cnbBuild step with essential parameters for building a container image. ```groovy cnbBuild( script: this, dockerConfigJsonCredentialsId: 'DOCKER_REGISTRY_CREDS', containerImageName: 'images/example', containerImageTag: 'v0.0.1', containerRegistryUrl: 'gcr.io' ) ``` -------------------------------- ### Addon Descriptor File Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapLandscapePortalUpdateAddOnProduct.md This YAML file specifies the add-on product and version details required for the update process. Ensure this file is correctly named and located as per your configuration. ```yaml addonProduct: some-addon-product addonVersion: some-addon-version ``` -------------------------------- ### Transport Request Upload Examples (SOLMAN and CTS) Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestUploadFile.md Provides examples for uploading files using `transportRequestUploadFile` for both SOLMAN and CTS change management types. Note that `changeDocumentId` and `applicationId` are typically provided via git commit history for SOLMAN. ```groovy // SOLMAN transportRequestUploadFile( script: this, changeDocumentId: '001', // typically provided via git commit history transportRequestId: '001', // typically provided via git commit history applicationId: '001', filePath: '/path', changeManagement: [ type: 'SOLMAN' endpoint: 'https://example.org/cm' ] ) // CTS transportRequestUploadFile( script: this, transportRequestId: '001', // typically provided via git commit history changeManagement: [ type: 'CTS' endpoint: 'https://example.org/cm', client: '099', ], applicationName: 'myApp', abapPackage: 'MYPACKAGE', ) ``` -------------------------------- ### Specify Git Commit Range with Custom Start and End Commits Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/transportRequestReqIDFromGit.md Define a specific Git commit range by setting both the starting ('gitFrom') and ending ('gitTo') commits. This is useful when parallel merges might introduce additional transport request IDs. ```yaml steps: transportRequestReqIDFromGit: gitFrom: '4378bb4' gitTo: 'd99fbf7' ``` -------------------------------- ### Opting In to Docker Build (Replacing kanikoExecute) Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/dockerBuild.md Switch to using the dockerBuild step by setting it to true and kanikoExecute to false. ```yaml stages: Build: dockerBuild: true kanikoExecute: false ``` -------------------------------- ### Example Console Output for Step Errors Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/handlePipelineStepErrors.md This example demonstrates the detailed console output generated when an error occurs within a pipeline step managed by handlePipelineStepErrors, provided `echoDetails` is true. It includes step information, parameters, the error message, and helpful links. ```log ---------------------------------------------------------- --- An error occurred in the library step: ${stepName} ---------------------------------------------------------- The following parameters were available to the step: *** ${stepParameters} *** The error was: *** ${err} *** Further information: * Documentation of step ${stepName}: .../${stepName}/ * Pipeline documentation: https://... * GitHub repository for pipeline steps: https://... ---------------------------------------------------------- ``` -------------------------------- ### Configuration Example for Integration Tests Stage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/stages/integrationTest.md This configuration defines parameters for the Integration Tests stage, including Cloud Foundry details, ABAP system settings, and add-on inclusion. ```yaml general: addonDescriptorFileName: 'addon.yml' cfApiEndpoint: 'https://api.cf.sap.hana.ondemand.com' cfCredentialsId: 'cfAuthentification' stages: Integration Tests: cfOrg: 'myOrgAti' cfSpace: 'mySpaceAti' cfServiceInstance: 'ati_system' cfService: 'abap' cfServicePlan: 'saas_oem' abapSystemAdminEmail: 'user@example.com' abapSystemDescription: 'Add-on Installation Test System' abapSystemIsDevelopmentAllowed: false abapSystemID: 'ATI' abapSystemSizeOfPersistence: 4 abapSystemSizeOfRuntime: 1 includeAddon: true confirmDeletion: true ``` -------------------------------- ### Example Commit Message for Change Document Integration Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/scenarios/changeManagement.md This is an example of a Git commit message format that includes a change document ID, which is used by the pipeline to link code changes to specific change documents in SAP Solution Manager. A blank line between the message header and description is mandatory. ```text Fix terminology in documentation Terminology must be consistent with official channels. ChangeDocument: ``` -------------------------------- ### Prepare Default Values with Shared Library Configuration Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/checkChangeInDevelopment.md This Groovy script demonstrates how to prepare default values using a shared library, referencing an external configuration file. ```groovy @Library('piper-lib-os@master') _ // the shared lib containing the additional configuration // needs to be configured in Jenkins @Library('foo@master') __ // inside the shared lib denoted by 'foo' the additional configuration file // needs to be located under 'resources' ('resoures/myConfig.yml') prepareDefaultValues script: this, customDefaults: 'myConfig.yml' ``` -------------------------------- ### Custom Environment Variables and PATH Configuration Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/npmExecuteTests.md This example illustrates how to configure custom environment variables and add directories to the system's PATH for the npmExecuteTests step. This is useful for setting up specific testing environments, such as for uiVeri5. ```yaml stages: - name: Test steps: - name: npmExecuteTests type: npmExecuteTests params: envs: - "MY_ENV_VAR=value" paths: - "/path/to/add" ``` ```yaml stages: - name: Test steps: - name: npmExecuteTests type: npmExecuteTests params: runCommand: "/home/node/.npm-global/bin/uiveri5" installCommand: "npm install @ui5/uiveri5 --global --quiet" runOptions: ["--seleniumAddress=http://localhost:4444/wd/hub"] usernameEnvVar: "PIPER_SELENIUM_HUB_USER" passwordEnvVar: "PIPER_SELENIUM_HUB_PASSWORD" envs: - "NPM_CONFIG_PREFIX=~/.npm-global" paths: - "~/.npm-global/bin" ``` -------------------------------- ### Cloud Foundry Create Service with Variable Substitution Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/cloudFoundryCreateService.md This example demonstrates how to create a Cloud Foundry service with variable substitution using a list of key-value pairs. The values for variable substitution must follow the pattern key=value. ```groovy cloudFoundryCreateService( cfApiEndpoint : 'https://test.server.com', cfOrg : 'cfOrg', cfSpace: 'cfSpace', cfCredentialsId: 'cfCredentialsId', serviceManifest: 'manifest.yml', manifestVariables: ["name1=test1","name2=test2", "name3=test3"], script: this, ) ``` -------------------------------- ### Basic .pipeline/config.yml for TMS Upload Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/scenarios/TMS_Extension.md This configuration example sets up the TMS upload step, including credentials, target node, MTA path, and optional extension descriptor mapping. It's located in the .pipeline/config.yml file. ```yaml steps: tmsUpload: credentialsId: tms-secret-key nodeName: PRE-PROD mtaPath: com.piper.example.tms.mtar customDescription: Custom-Transport-Description # uploading MTA extension descriptors, optional step mtaVersion: 1.0.0 nodeExtDescriptorMapping: PRE-PROD: 'scv_x_preprod.mtaext' PROD: 'scv_x_prod.mtaext' stages: Release: tmsUpload: true ``` -------------------------------- ### AUnit Config File with Options for Software Component Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentRunAUnitTest.md This example demonstrates an AUnit configuration file (`aUnitConfig.yml`) that includes various options for testing a specific software component. Options cover measurements, scope, risk level, and duration. ```yaml title: My AUnit run context: My unit tests options: measurements: none scope: ownTests: true foreignTests: true riskLevel: harmless: true dangerous: true critical: true duration: short: true medium: true long: true objectset: softwarecomponents: - name: Z_TESTSC ``` -------------------------------- ### Initialize Beans with Java Syntax Source: https://github.com/sap/jenkins-library/blob/master/documentation/DEVELOPMENT.md Initialize beans using Java syntax instead of named parameters, as named parameters are not supported by Jenkins. ```groovy Version javaVersion = new Version(1, 8) ``` -------------------------------- ### YAML Configuration for gctsExecuteABAPUnitTests Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/gctsExecuteABAPUnitTests.md Example configuration for the gctsExecuteABAPUnitTests step in a YAML config file. This format is suitable for pipeline configurations. ```yaml steps: <...> gctsExecuteABAPUnitTests: host: 'https://abap.server.com:port' client: '000' abapCredentialsId: 'ABAPUserPasswordCredentialsId' repository: 'myrepo' scope: 'remoteChangedObjects' commit: '38abb4814ae46b98e8e6c3e718cf1782afa9ca90' workspace: '/var/jenkins_home/workspace/myFirstPipeline' ``` -------------------------------- ### Basic Jenkinsfile Usage Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentCheckoutBranch.md The simplest way to call the step in a Jenkinsfile, assuming configuration is handled elsewhere. ```groovy abapEnvironmentCheckoutBranch script: this ``` -------------------------------- ### Substitute Variables with Default File Paths Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/cfManifestSubstituteVariables.md Shows how to use the step when manifest and variable files are in the default locations. ```groovy cfManifestSubstituteVariables ( script: this, manifestFile: "manifest.yml", manifestVariablesFiles: ["manifest-variables.yml"] ) ``` -------------------------------- ### YAML Configuration for Repository or Packages Scope Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/gctsExecuteABAPUnitTests.md Configuration example for gctsExecuteABAPUnitTests when the scope is set to 'repository' or 'packages'. A commit is not required for these scopes. ```yaml steps: <...> gctsExecuteABAPUnitTests: host: 'https://abap.server.com:port' client: '000' abapCredentialsId: 'ABAPUserPasswordCredentialsId' repository: 'myrepo' scope: 'repository' workspace: '/var/jenkins_home/workspace/myFirstPipeline' ``` -------------------------------- ### Basic Kubernetes Deployment Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/kubernetesDeploy.md Executes a basic Kubernetes deployment using the default configuration. ```groovy kubernetesDeploy script: this ``` -------------------------------- ### Publish Python Results with Pylint Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/checksPublishResults.md Publish Python results from Pylint. This example specifies a custom pattern for the Pylint log file. ```groovy checksPublishResults archive: true, pylint: [pattern: '**/target/pylint.log'] ``` -------------------------------- ### Publish JavaScript Results with ESLint Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/checksPublishResults.md Publish JavaScript results from ESLint. This example shows how to specify a custom pattern for the result file. ```groovy checksPublishResults archive: true, eslint: [pattern: '**/result-file-with-fancy-name.xml'] ``` -------------------------------- ### config.yml Configuration with Direct Parameters Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapEnvironmentCheckoutBranch.md Configuring the step in config.yml using direct repository name, branch name, and ABAP credentials. ```yaml steps: abapEnvironmentCheckoutBranch: repositoryName: '/DMO/GIT_REPOSITORY' branchName: 'my-demo-branch' abapCredentialsId: 'abapCredentialsId' host: '1234-abcd-5678-efgh-ijk.abap.eu10.hana.ondemand.com' ``` -------------------------------- ### Pinning Shared Library to a Specific Version Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/extensibility.md Example of how to specify a particular version of a shared library in your Jenkinsfile to ensure repeatable builds. ```groovy @Library('my-shared-library@v1.0') _ ``` -------------------------------- ### Pipeline Configuration Example Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/pipelines/abapEnvironment/configuration.md Define general pipeline settings and stage configurations in the .pipeline/config.yml file. This includes Cloud Foundry endpoints, organization, space, credentials, and service instance details, as well as specific configurations for stages like 'Prepare System', 'Clone Repositories', 'ATC', 'AUnit', and 'Post'. ```yml general: cfApiEndpoint: 'https://api.cf.eu10.hana.ondemand.com' cfOrg: 'your-cf-org' cfSpace: 'yourSpace' cfCredentialsId: 'cfAuthentification' cfServiceInstance: 'abapEnvironmentPipeline' stages: Prepare System: cfService: 'abap' cfServicePlan: 'standard' abapSystemAdminEmail: 'user@example.com' abapSystemDescription: 'ABAP Environment Q System' abapSystemIsDevelopmentAllowed: false abapSystemID: 'H02' abapSystemSizeOfPersistence: 4 abapSystemSizeOfRuntime: 1 Clone Repositories: strategy: 'Clone' repositories: 'repositories.yml' ATC: # In order to be executed, the ATC stage needs at least one configuration entry # If the ATC stage should not be executed, delete the whole section execute: stage AUnit: # In order to be executed, the AUnit stage needs at least one configuration entry # If the AUnit stage should not be executed, delete the whole section execute: stage Post: cfDeleteServiceKeys: true ``` -------------------------------- ### Configuring abapAddonAssemblyKitReleasePackages in config.yml Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/abapAddonAssemblyKitReleasePackages.md This example shows how to configure the step individually in the config.yml file. It specifies the credentials to be used for accessing the ABAP Addon Assembly Kit for Cloud. Ensure these credentials are set up in Jenkins. ```yaml steps: abapAddonAssemblyKitReleasePackages: abapAddonAssemblyKitCredentialsId: 'abapAddonAssemblyKitCredentialsId' ``` -------------------------------- ### Custom Pipeline in Shared Library Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/extensibility.md Example of a minimal directory structure for a custom shared library containing a modified pipeline script. ```groovy ./vars/myCustomPipeline.groovy ./README.md ``` -------------------------------- ### Run Grafana Docker Container Source: https://github.com/sap/jenkins-library/blob/master/documentation/docs/steps/influxWriteData.md Starts a Grafana Docker container, linking it to the InfluxDB container. Sets the admin password for Grafana. ```bash docker run -d -p 3000:3000 --name grafana --restart=always --link influxdb:influxdb -e "GF_SECURITY_ADMIN_PASSWORD=adminPwd" grafana/grafana ```