Skip to content

Commit 93d3134

Browse files
authored
ci: add github token to jenkinsfile for consuming crda-java-api (#121)
Signed-off-by: Tomer Figenblat <tfigenbl@redhat.com>
1 parent 3c07934 commit 93d3134

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

Jenkinsfile

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ node('rhel7'){
1616
def isSnapshot = props['projectVersion'].contains('-SNAPSHOT')
1717
def version = isSnapshot?props['projectVersion'].replace('-SNAPSHOT', ".${env.BUILD_NUMBER}"):props['projectVersion'] + ".${env.BUILD_NUMBER}"
1818

19-
stage('Build') {
20-
sh "./gradlew assemble -PprojectVersion=${version}"
21-
}
19+
// github user and token are required for consuming the crda-java-api module from GHPR in build-time
20+
withCredentials([[$class: 'StringBinding', credentialsId: 'rhdevelopersci-github-token', variable: 'GITHUB_TOKEN']]) {
21+
stage('Build') {
22+
sh "./gradlew assemble -PprojectVersion=${version} -Pgpr.username=rhdevelopers-ci -Pgpr.token=${GITHUB_TOKEN}"
23+
}
2224

23-
stage('Package') {
24-
sh "./gradlew buildPlugin -PprojectVersion=${version}"
25-
}
25+
stage('Package') {
26+
sh "./gradlew buildPlugin -PprojectVersion=${version} -Pgpr.username=rhdevelopers-ci -Pgpr.token=${GITHUB_TOKEN}"
27+
}
28+
}
2629

2730
if(params.UPLOAD_LOCATION) {
2831
stage('Upload') {
@@ -41,9 +44,12 @@ node('rhel7'){
4144

4245
stage("Publish to Marketplace") {
4346
unstash 'zip'
44-
withCredentials([[$class: 'StringBinding', credentialsId: 'JetBrains marketplace token', variable: 'TOKEN']]) {
45-
sh "./gradlew publishPlugin -PjetBrainsToken=${TOKEN} -PprojectVersion=${version} -PjetBrainsChannel=${channel}"
46-
}
47+
// github user and token are required for consuming the crda-java-api module from GHPR in build-time
48+
withCredentials([[$class: 'StringBinding', credentialsId: 'rhdevelopersci-github-token', variable: 'GITHUB_TOKEN']]) {
49+
withCredentials([[$class: 'StringBinding', credentialsId: 'JetBrains marketplace token', variable: 'TOKEN']]) {
50+
sh "./gradlew publishPlugin -PjetBrainsToken=${TOKEN} -PprojectVersion=${version} -PjetBrainsChannel=${channel} -Pgpr.username=rhdevelopers-ci -Pgpr.token=${GITHUB_TOKEN}"
51+
}
52+
}
4753
archive includes:"**.zip"
4854

4955
if (!isSnapshot) {

0 commit comments

Comments
 (0)