2

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

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

管道执行结果

检查日志时,我看到:

[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'
}

任何想法我在生产部署中缺少什么以及如何通过脚本中的此检查进行生产部署?

问候尼尔

4

1 回答 1

1

该管道是为多分支管道构建的,在单分支管道作业中无法正常工作。在多分支管道作业中运行具有单个分支的项目没有问题。为避免混淆,我们在此处记录的最新版本中添加了对管道的检查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

亲切的问候

弗洛里安

于 2019-12-02T18:05:20.747 回答