From 39bc7b043cab9f272925157f2efa7a24473d6d7b Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Wed, 10 Apr 2019 12:26:54 +0200 Subject: [PATCH 1/4] Travis: use GHPages deploy provider (#645) * remove GHDeploy script * build MKDocs from docs folder * use GHDeploy provider --- .travis.yml | 40 +++++++++++++++------------------------- documentation/mkdocs.yml | 1 - gh-pages-deploy.sh | 16 ---------------- 3 files changed, 15 insertions(+), 42 deletions(-) delete mode 100644 gh-pages-deploy.sh diff --git a/.travis.yml b/.travis.yml index 6a278ee59..ac137ff36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ cache: # Travis Lifecycle: https://docs.travis-ci.com/user/job-lifecycle#the-job-lifecycle # Travis Stages: https://docs.travis-ci.com/user/build-stages/ # Travis Conditions: https://docs.travis-ci.com/user/conditional-builds-stages-jobs +# Travis GHPages deploy provider: https://docs.travis-ci.com/user/deployment/pages/ jobs: include: - stage: Tests @@ -28,33 +29,22 @@ jobs: after_script: - JACOCO_SOURCE_PATH="src vars test" ./cc-test-reporter format-coverage target/site/jacoco/jacoco.xml --input-type jacoco - ./cc-test-reporter upload-coverage - - name: Docs Build - if: type = pull_request - install: docker pull squidfunk/mkdocs-material:3.0.4 - script: - - | - cp -r documentation/docs documentation/docs-tmp - documentation/bin/createDocu.sh vars documentation/docs-tmp/steps - docker run --rm -it -v ${TRAVIS_BUILD_DIR}:/docs -w /docs/documentation squidfunk/mkdocs-material:3.0.4 build --clean --verbose --strict - name: Consumer Tests if: repo = "SAP/jenkins-library" && ( (type != pull_request && branch =~ /^master$|^it\/.*$/) || (type == pull_request && head_repo = "SAP/jenkins-library" && head_branch =~ /^it\/.*$/) ) script: cd consumer-test && chmod +x integrationTestController.sh && ./integrationTestController.sh - stage: Docs - name: Deploy - if: repo = "SAP/jenkins-library" AND branch = master AND NOT type = pull_request - install: - - docker pull squidfunk/mkdocs-material:3.0.4 - - | - echo "Found change on master: Deployment of documentation" - PRIVATE_KEY="cfg/id_rsa" - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in cfg/id_rsa.enc -out "${PRIVATE_KEY}" -d - chmod a+x gh-pages-deploy.sh - cp -r documentation/docs documentation/docs-tmp - documentation/bin/createDocu.sh vars documentation/docs-tmp/steps - script: docker run --rm -it --entrypoint "./gh-pages-deploy.sh" -e "TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}" -v ${TRAVIS_BUILD_DIR}:/docs -w /docs squidfunk/mkdocs-material:3.0.4 - # TODO: make use of GHPages deploy provider: https://docs.travis-ci.com/user/deployment/pages/ - -#notifications: -# slack: -# secure: UYzfd4QYLtAX39r8LzV1dYp7cKMhYRRjI/xswMEkR+RgdMWxVPPH3kcsNLwkdNGSPn1b8Aidz8YLss9JolrepWjwI283dK8EUthZAOw03+PmL5X/3nOJ7aGv0sxwYqF5ypltBrerTf6jtPUTcQdtao+0O8bgnzShc6nWWE4MLXonjOm1pZLRUo81un+0bzm8C2ABIeHC6xuZCRycXP5u1mW1nDLK3900uY1rxIDTSZKEzA0IzLQhE9uROvI1r48fW8cKJQQjMMO5PPorq+0eDl2YTE8rQr9ldvuRE7A/ubsOQR0N5F8iAv1JTZXuXGt62fw6eKDQ1h94suEk7X+baV0EwlfhsHXcI1MxRFwxNSr9k1WaVFfA4TrM8XYBAcW3JGRA51ZK3q4EcjpuxpupaA7kZDtH53W7ePzH2TIp6yknln1q+yfcsP7cGv38sSKpKwOyMgAPRElkZzcoo31kw/PLzKPXYJEovRqx/0lWzczbFSscsroNaGCavC02++bUnyUXW2W+PG4gDSBFVZjtrvTPKnZ6DpHXV97x6xC/CzyhFj/Nf+ao/J9IIfocnc4vXJojwS550KIvM7xCDJwa/+29dajj2l6dQqrcOe3UT3O5UGU9I0KkGEDMfkLOD71eRy58qiYz3y953e52DvvzWQJbvfuk8ubMO+Fmn4GyRz8= + name: Build & Deploy + install: docker pull squidfunk/mkdocs-material:3.0.4 + before_script: documentation/bin/createDocu.sh + script: docker run --rm -it -v ${TRAVIS_BUILD_DIR}/documentation:/docs squidfunk/mkdocs-material:3.0.4 build --clean --strict + deploy: + on: + branch: master + provider: pages + skip_cleanup: true + github_token: ${GITHUB_TOKEN} + name: 'Travis CI Publisher' + local_dir: 'documentation/docs' + keep_history: true + #verbose: true diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml index 6547051ee..faa7cf761 100644 --- a/documentation/mkdocs.yml +++ b/documentation/mkdocs.yml @@ -65,6 +65,5 @@ markdown_extensions: extra_css: - 'css/extra.css' edit_uri: edit/master/documentation/docs -docs_dir: docs-tmp site_dir: docs-gen repo_url: https://github.com/SAP/jenkins-library diff --git a/gh-pages-deploy.sh b/gh-pages-deploy.sh deleted file mode 100644 index 4592584b7..000000000 --- a/gh-pages-deploy.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -PRIVATE_KEY="cfg/id_rsa" - -chmod 600 "${PRIVATE_KEY}" -eval `ssh-agent -s` -ssh-add "${PRIVATE_KEY}" -mkdir ~/.ssh -chmod 700 ~/.ssh -ssh-keyscan github.com >> ~/.ssh/known_hosts -git config user.name "Travis CI Publisher" -git remote add docu "git@github.com:$TRAVIS_REPO_SLUG.git"; -git fetch docu gh-pages:gh-pages -echo "Pushing to gh-pages of repository $TRAVIS_REPO_SLUG" -cd documentation -mkdocs gh-deploy -v --clean --remote-name docu From 1195501d22287ea701ca0b3bdd60c00974d37515 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Wed, 10 Apr 2019 13:49:40 +0200 Subject: [PATCH 2/4] push correct docs folder (#654) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ac137ff36..d084c4fce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,6 @@ jobs: skip_cleanup: true github_token: ${GITHUB_TOKEN} name: 'Travis CI Publisher' - local_dir: 'documentation/docs' + local_dir: 'documentation/docs-gen' keep_history: true #verbose: true From 4c62102fa87e5d5c2f0df03a82b0db547bcd7a86 Mon Sep 17 00:00:00 2001 From: Alejandra Ferreiro Vidal Date: Thu, 28 Mar 2019 10:10:01 +0100 Subject: [PATCH 3/4] transportRequestUploadFile: generate docu --- .../docs/steps/transportRequestUploadFile.md | 40 ++--------- vars/transportRequestUploadFile.groovy | 69 ++++++++++++++++++- 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/documentation/docs/steps/transportRequestUploadFile.md b/documentation/docs/steps/transportRequestUploadFile.md index c9cb50c4e..66facda78 100644 --- a/documentation/docs/steps/transportRequestUploadFile.md +++ b/documentation/docs/steps/transportRequestUploadFile.md @@ -1,46 +1,14 @@ -# transportRequestUploadFile +# ${docGenStepName} -## Description - -Uploads a file to a Transport Request. +## ${docGenDescription} ## Prerequisites * **[Change Management Client 2.0.0 or compatible version](http://central.maven.org/maven2/com/sap/devops/cmclient/dist.cli/)** - available for download on Maven Central. -## Parameters +## ${docGenParameters} -| parameter | mandatory | default | possible values | -| -----------------|-----------|--------------------------------------------------------|--------------------| -| `script` | yes | | | -| `changeDocumentId` | `SOLMAN` only | | | -| `transportRequestId`| yes | | | -| `applicationId` | `SOLMAN` only | | | -| `filePath` | yes | | | -| `changeManagement/credentialsId` | yes | | | -| `changeManagement/endpoint` | yes | | | -| `changeManagement/git/from` | no | `origin/master` | | -| `changeManagement/git/to` | no | `HEAD` | | -| `changeManagement/changeDocumentLabel` | no | `ChangeDocument\s?:` | regex pattern | -| `changeManagement/transportRequestLabel` | no | `TransportRequest\s?:` | regex pattern | -| `changeManagement/git/format` | no | `%b` | see `git log --help` | -| `changeManagement/type` | no | `SOLMAN` | `SOLMAN`, `CTS` | - -* `script` - The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the `this` parameter, as in `script: this`. This allows the function to access the [`commonPipelineEnvironment`](commonPipelineEnvironment.md) for retrieving, for example, configuration parameters. -* `changeDocumentId` - For type `SOLMAN` only. The id of the change document related to the transport request to release. Typically provided via commit history. -* `transportRequestId` - The id of the transport request to release. Typically provided via commit history. -* `applicationId` - For type `SOLMAN` only. The id of the application. -* `filePath` - The path of the file to upload. -* `changeManagement/credentialsId` - The credentials to connect to the service endpoint (Solution Manager, ABAP System). -* `changeManagement/endpoint` - The service endpoint (Solution Manager, ABAP System). -* `changeManagement/git/from` - The starting point for retrieving the change document id and/or transport request id -* `changeManagement/git/to` - The end point for retrieving the change document id and/or transport request id -* `changeManagement/changeDocumentLabel` - For type `SOLMAN` only. A pattern used for identifying lines holding the change document id. -* `changeManagement/transportRequestLabel` - A pattern used for identifying lines holding the transport request id. -* `changeManagement/type` Where/how the transport request is created (via SAP Solution Manager, ABAP). -* `changeManagement/git/format` - Specifies what part of the commit is scanned. By default the body of the commit message is scanned. - -## Step configuration +## ${docGenConfiguration} The step is configured using a customer configuration file provided as resource in an custom shared library. diff --git a/vars/transportRequestUploadFile.groovy b/vars/transportRequestUploadFile.groovy index ef95e9d85..048ba93ab 100644 --- a/vars/transportRequestUploadFile.groovy +++ b/vars/transportRequestUploadFile.groovy @@ -3,6 +3,7 @@ import static com.sap.piper.Prerequisites.checkScript import com.sap.piper.Utils import groovy.transform.Field +import com.sap.piper.GenerateDocumentation import com.sap.piper.ConfigurationHelper import com.sap.piper.cm.ChangeManagement import com.sap.piper.cm.BackendType @@ -17,25 +18,91 @@ import static com.sap.piper.cm.StepHelpers.getBackendTypeAndLogInfoIfCMIntegrati @Field def STEP_NAME = getClass().getName() @Field Set GENERAL_CONFIG_KEYS = [ - 'changeManagement' + 'changeManagement', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'changeDocumentLabel', + /** + * Defines where the transport request is created, e.g. SAP Solution Manager, ABAP System. + * @parentConfigKey changeManagement + * @possibleValues `SOLMAN`, `CTS`, `RFC` + */ + 'type', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'clientOpts', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'credentialsId', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'endpoint', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'git/from', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'git/to', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'git/format', + /** + * @see transportRequestCreate + * @parentConfigKey changeManagement + */ + 'rfc/developmentInstance', + /** + * @see transportRequestCreate + * @parentConfigKey changeManagement + */ + 'rfc/developmentClient', + /** + * A pattern used for identifying lines holding the transport request id. + * @parentConfigKey changeManagement + */ + 'changeManagement/transportRequestLabel' ] @Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus([ 'applicationName', // RFC + /** The id of the application. Only for `SOLMAN`.*/ 'applicationId', // SOLMAN 'applicationDescription', + /** The path of the file to upload.*/ 'filePath', // SOLMAN, CTS + /** The URL where to find the UI5 package to upload to the transport request. Only for `RFC`. */ 'applicationUrl', // RFC + /** The ABAP package name of your application. */ 'abapPackage', + /** The code page of your ABAP system. E.g. UTF-8. */ 'codePage', //RFC 'acceptUnixStyleLineEndings', // RFC + /** @see transportRequestCreate */ 'verbose', // RFC ]) @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus([ + /** @see transportRequestCreate */ 'changeDocumentId', + /** The id of the transport request to upload the file.*/ 'transportRequestId']) +/** Uploads a file to a Transport Request. */ +@GenerateDocumentation void call(parameters = [:]) { handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) { From 19f9005dc518c627d167f4444d95a4f50dbd4711 Mon Sep 17 00:00:00 2001 From: Alejandra Ferreiro Vidal Date: Thu, 28 Mar 2019 10:06:40 +0100 Subject: [PATCH 4/4] transportRequestRelease: generate docu --- .../docs/steps/transportRequestRelease.md | 34 ++----------- vars/transportRequestRelease.groovy | 48 ++++++++++++++++++- 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/documentation/docs/steps/transportRequestRelease.md b/documentation/docs/steps/transportRequestRelease.md index 45c527712..48cabfd7a 100644 --- a/documentation/docs/steps/transportRequestRelease.md +++ b/documentation/docs/steps/transportRequestRelease.md @@ -1,41 +1,17 @@ -# transportRequestRelease +# ${docGenStepName} -## Description - -Releases a Transport Request. +## ${docGenDescription} ## Prerequisites * **[Change Management Client 2.0.0 or compatible version](http://central.maven.org/maven2/com/sap/devops/cmclient/dist.cli/)** - available for download on Maven Central. -## Parameters +## ${docGenParameters} -| parameter | mandatory | default | possible values | -| -----------------|-----------|--------------------------------------------------------|--------------------| -| `script` | yes | | | -| `changeDocumentId` | `SOLMAN` only | | | -| `transportRequestId`| yes | | | -| `changeManagement/changeDocumentLabel` | no | `ChangeDocument\s?:` | regex pattern | -| `changeManagment/transportRequestLabel` | no | `TransportRequest\s?:` | regex pattern | -| `changeManagement/credentialsId` | yes | | | -| `changeManagement/endpoint` | yes | | | -| `changeManagement/git/from` | no | `origin/master` | | -| `changeManagement/git/to` | no | `HEAD` | | -| `changeManagement/git/format` | no | `%b` | see `git log --help` | -| `changeManagement/type` | no | `SOLMAN` | `SOLMAN`, `CTS` | -* `script` - The common script environment of the Jenkinsfile running. Typically the reference to the script calling the pipeline step is provided with the `this` parameter, as in `script: this`. This allows the function to access the [`commonPipelineEnvironment`](commonPipelineEnvironment.md) for retrieving, for example, configuration parameters. -* `changeDocumentId` - for `SOLMAN` only. The id of the change document related to the transport request to release. -* `transportRequestId` - The id of the transport request to release. -* `changeManagement/changeDocumentLabel` - for `SOLMAN` only. A pattern used for identifying lines holding the change document id. -* `changeManagment/transportRequestLabel` - A pattern used for identifying lines holding the transport request id. -* `changeManagement/credentialsId` - The credentials to connect to the service endpoint (Solution Manager, ABAP System). -* `changeManagement/endpoint` - The service endpoint (Solution Manager, ABAP System). -* `changeManagement/git/from` - The starting point for retrieving the change document id and/or transport request id -* `changeManagement/git/to` - The end point for retrieving the change document id and/or transport request id -* `changeManagement/git/format` - Specifies what part of the commit is scanned. By default the body of the commit message is scanned. +## ${docGenConfiguration} + -## Step configuration The step is configured using a customer configuration file provided as resource in an custom shared library. diff --git a/vars/transportRequestRelease.groovy b/vars/transportRequestRelease.groovy index c7da5876a..7df08c7ee 100644 --- a/vars/transportRequestRelease.groovy +++ b/vars/transportRequestRelease.groovy @@ -3,6 +3,7 @@ import static com.sap.piper.Prerequisites.checkScript import com.sap.piper.Utils import groovy.transform.Field +import com.sap.piper.GenerateDocumentation import com.sap.piper.ConfigurationHelper import com.sap.piper.cm.BackendType import com.sap.piper.cm.ChangeManagement @@ -19,15 +20,60 @@ import static com.sap.piper.cm.StepHelpers.getBackendTypeAndLogInfoIfCMIntegrati @Field Set GENERAL_CONFIG_KEYS = STEP_CONFIG_KEYS @Field Set STEP_CONFIG_KEYS = [ - 'changeManagement' + 'changeManagement', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'clientOpts', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'credentialsId', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'endpoint', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'git/from', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'git/to', + /** + * @see checkChangeInDevelopment + * @parentConfigKey changeManagement + */ + 'git/format', + /** + * @see transportRequestCreate + * @parentConfigKey changeManagement + */ + 'rfc/developmentInstance', + /** + * @see transportRequestCreate + * @parentConfigKey changeManagement + */ + 'rfc/developmentClient', ] @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus([ + /** @see transportRequestCreate */ 'changeDocumentId', + /** The id of the transport request to release. */ 'transportRequestId', + /** @see transportRequestCreate */ 'verbose', ]) +/** Releases a Transport Request. */ +@GenerateDocumentation void call(parameters = [:]) { handlePipelineStepErrors (stepName: STEP_NAME, stepParameters: parameters) {