1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Streamline implementation githubPublishRelease (#1191)

This commit is contained in:
Oliver Nocon 2020-02-19 09:05:53 +01:00 committed by GitHub
parent 1b6781c1e9
commit fd76f721ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -18,10 +18,6 @@ spec:
- name: githubTokenCredentialsId - name: githubTokenCredentialsId
description: Jenkins 'Secret text' credentials ID containing token to authenticate to GitHub. description: Jenkins 'Secret text' credentials ID containing token to authenticate to GitHub.
type: jenkins type: jenkins
resources:
- name: commonPipelineEnvironment
resourceSpec:
type: piperEnvironment
params: params:
- name: addClosedIssues - name: addClosedIssues
description: 'If set to `true`, closed issues and merged pull-requests since the last release will added below the `releaseBodyHeader`' description: 'If set to `true`, closed issues and merged pull-requests since the last release will added below the `releaseBodyHeader`'

View File

@ -61,6 +61,6 @@ class GithubPublishReleaseTest extends BasePiperTest {
// asserts // asserts
assertThat(writeFileRule.files['metadata/githubrelease.yaml'], containsString('name: githubPublishRelease')) assertThat(writeFileRule.files['metadata/githubrelease.yaml'], containsString('name: githubPublishRelease'))
assertThat(withEnvArgs[0], allOf(startsWith('PIPER_parametersJSON'), containsString('"testParam":"This is test content"'))) assertThat(withEnvArgs[0], allOf(startsWith('PIPER_parametersJSON'), containsString('"testParam":"This is test content"')))
assertThat(shellCallRule.shell[1], is('./piper githubPublishRelease --token thisIsATestToken')) assertThat(shellCallRule.shell[1], is('./piper githubPublishRelease'))
} }
} }

View File

@ -34,8 +34,8 @@ void call(Map parameters = [:]) {
config = readJSON (text: sh(returnStdout: true, script: "./piper getConfig --contextConfig --stepMetadata '${METADATA_FILE}'")) config = readJSON (text: sh(returnStdout: true, script: "./piper getConfig --contextConfig --stepMetadata '${METADATA_FILE}'"))
// execute step // execute step
withCredentials([string(credentialsId: config.githubTokenCredentialsId, variable: 'TOKEN')]) { withCredentials([string(credentialsId: config.githubTokenCredentialsId, variable: 'PIPER_token')]) {
sh "./piper githubPublishRelease --token ${TOKEN}" sh './piper githubPublishRelease'
} }
} }
} }