SAP Cloud SDK Jenkins管道s4sdk-pipeline.groovy-跳过生产部署步骤

时间:2019-11-07 23:46:21

标签: jenkins-pipeline sap-cloud-sdk

我已经设置了詹金斯项目吹笛者(https://sap.github.io/jenkins-library/)。然后,我已经设置了一个基本的SAP Cloud Application Programming模型应用程序,该应用程序通过默认配置集成了SAP Cloud SDK管道,并取消了“ productionDeployment”阶段的注释,并完成了Cloud Foundry端点/组织/空间等。我已将applicatino提交给master分支在git仓库中。

管道成功执行,但正在跳过生产部署步骤。

Pipeline execution results

查看日志时,我看到:

[Pipeline] // stageenter code here
[Pipeline] stage
[Pipeline] { (Production Deployment)
Stage "Production Deployment" skipped due to when conditional

当我查看脚本(https://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/s4sdk-pipeline.groovy)时,我看到:

        stage('Production Deployment') {
        *when { expression { commonPipelineEnvironment.configuration.runStage.PRODUCTION_DEPLOYMENT }* }
        //milestone 80 is set in stageProductionDeployment
        steps { stageProductionDeployment script: this }
    }

谁能解释通过 commonPipelineEnvironment.configuration.runStage.PRODUCTION_DEPLOYMENT 检查以执行stageProductionDeployment脚本需要什么?

我的pipeline_config.yml文件(匿名)是:

###
# This file configures the SAP Cloud SDK Continuous Delivery pipeline of your project.
# For a reference of the configuration concept and available options, please have a look into its documentation.
#
# The documentation for the most recent pipeline version can always be found at:
#    https://github.com/SAP/cloud-s4-sdk-pipeline/blob/master/configuration.md
# If you are using a fixed version of the pipeline, please make sure to view the corresponding version from the tag
# list of GitHub (e.g. "v15" when you configured pipelineVersion = "v15" in the Jenkinsfile).
#
# For general information on how to get started with Continuous Delivery, visit:
#    https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery
#
# We aim to keep the pipeline configuration as stable as possible. However, major changes might also imply breaking
# changes in the configuration. Before doing an update, please check the the release notes of all intermediate releases
# and adapt this file if necessary.
#
# This is a YAML-file. YAML is a indentation-sensitive file format. Please make sure to properly indent changes to it.
###



### General project setup
general:
  productiveBranch: 'master'


### Step-specific configuration
steps:
  setupCommonPipelineEnvironment:
    collectTelemetryData: true

  cloudFoundryDeploy:
    dockerImage: 'ppiper/cf-cli'
    smokeTestStatusCode: '200'
    cloudFoundry:
      org: 'XXXXXX'
      space: 'XXXXXX'
      appName: 'MTBookshopNode'
      manifest: 'mta.yaml'
      credentialsId: 'CF_CREDENTIALSID'
      apiEndpoint: 'https://api.cf.XX10.hana.ondemand.com'

### Stage-specific configuration
stages:

  # This exclude is required for the example project to be successful in the pipeline
  # Remove it when you have added your first test
  s4SdkQualityChecks:
    jacocoExcludes:
      - '**/OrdersService.class'

#  integrationTests:
#    credentials:
#      - alias: 'mySystemAlias'
#        credentialId: 'mySystemCredentialsId'

#  s4SdkQualityChecks:
#    nonErpDestinations:
#      - 'myCustomDestination'

  productionDeployment:
    cfTargets:
      - org: 'XXXXXX'
        space: 'XXXXXX'
        apiEndpoint: 'https://api.cf.XX10.hana.ondemand.com'
        appName: 'myAppName'
        manifest: 'mta.yaml'
        credentialsId: 'CF_CREDENTIALSID'

我的Jenkins文件未更改:

#!/usr/bin/env groovy

/*
 * This file bootstraps the codified Continuous Delivery pipeline for extensions of SAP solutions, such as SAP S/4HANA.
 * The pipeline helps you to deliver software changes quickly and in a reliable manner.
 * A suitable Jenkins instance is required to run the pipeline.
 * The Jenkins can easily be bootstraped using the life-cycle script located inside the 'cx-server' directory.
 *
 * More information on getting started with Continuous Delivery can be found in the following places:
 *   - GitHub repository: https://github.com/SAP/cloud-s4-sdk-pipeline
 *   - Blog Post: https://blogs.sap.com/2017/09/20/continuous-integration-and-delivery
 */

/*
 * Set pipelineVersion to a fixed released version (e.g. "v15") when running in a productive environment.
 * To find out about available versions and release notes, visit: https://github.com/SAP/cloud-s4-sdk-pipeline/releases
 */
String pipelineVersion = "master"

node {
    deleteDir()
    sh "git clone --depth 1 https://github.com/SAP/cloud-s4-sdk-pipeline.git -b ${pipelineVersion} pipelines"
    load './pipelines/s4sdk-pipeline.groovy'
}

有什么想法可以避免生产部署中的内容以及如何通过检查生产部署中的脚本吗?

问候 尼尔

1 个答案:

答案 0 :(得分:0)

该管道是为多分支管道构建的,无法在单分支管道作业中正常工作。运行在多分支管道作业中具有单个分支的项目没有问题。为避免混淆,我们在https://blogs.sap.com/2019/11/21/new-versions-of-sap-cloud-sdk-3.8.0-for-java-1.13.1-for-javascript-and-v26-of-continuous-delivery-toolkit/#cd-toolkit

中记录了最新版本的管道检查。

亲切的问候

弗洛里安