mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-02-20 01:29:28 +00:00
ci: use environment{} to fetch the GitHub API token
The `credentials()` function might only work in the `environment` block
in the Pipelines. At the moment, running the 'skip ci/skip/e2e label'
stage always reports 'Error: 401 Client Error: Unauthorized'.
Fixes: e0d49908
(ci: fetch GITHUB_API_TOKEN from Jenkins credential store)
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
e0d49908f8
commit
2fb4e9fd22
@ -24,14 +24,16 @@ node('cico-workspace') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('skip ci/skip/e2e label') {
|
stage('skip ci/skip/e2e label') {
|
||||||
|
environment {
|
||||||
|
// "github-api-token" is a secret text credential configured in Jenkins
|
||||||
|
GITHUB_API_TOKEN = credentials("github-api-token")
|
||||||
|
}
|
||||||
|
|
||||||
if (params.ghprbPullId == null) {
|
if (params.ghprbPullId == null) {
|
||||||
skip_e2e = 1
|
skip_e2e = 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// "github-api-token" is a secret text credential configured in Jenkins
|
|
||||||
env.GITHUB_API_TOKEN = credentials("github-api-token")
|
|
||||||
|
|
||||||
skip_e2e = sh(
|
skip_e2e = sh(
|
||||||
script: "./scripts/get_github_labels.py --id=${ghprbPullId} --has-label=ci/skip/e2e",
|
script: "./scripts/get_github_labels.py --id=${ghprbPullId} --has-label=ci/skip/e2e",
|
||||||
returnStatus: true)
|
returnStatus: true)
|
||||||
|
@ -21,14 +21,16 @@ node('cico-workspace') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('skip ci/skip/e2e label') {
|
stage('skip ci/skip/e2e label') {
|
||||||
|
environment {
|
||||||
|
// "github-api-token" is a secret text credential configured in Jenkins
|
||||||
|
GITHUB_API_TOKEN = credentials("github-api-token")
|
||||||
|
}
|
||||||
|
|
||||||
if (params.ghprbPullId == null) {
|
if (params.ghprbPullId == null) {
|
||||||
skip_e2e = 1
|
skip_e2e = 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// "github-api-token" is a secret text credential configured in Jenkins
|
|
||||||
env.GITHUB_API_TOKEN = credentials("github-api-token")
|
|
||||||
|
|
||||||
skip_e2e = sh(
|
skip_e2e = sh(
|
||||||
script: "./scripts/get_github_labels.py --id=${ghprbPullId} --has-label=ci/skip/e2e",
|
script: "./scripts/get_github_labels.py --id=${ghprbPullId} --has-label=ci/skip/e2e",
|
||||||
returnStatus: true)
|
returnStatus: true)
|
||||||
|
@ -21,14 +21,16 @@ node('cico-workspace') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('skip ci/skip/e2e label') {
|
stage('skip ci/skip/e2e label') {
|
||||||
|
environment {
|
||||||
|
// "github-api-token" is a secret text credential configured in Jenkins
|
||||||
|
GITHUB_API_TOKEN = credentials("github-api-token")
|
||||||
|
}
|
||||||
|
|
||||||
if (params.ghprbPullId == null) {
|
if (params.ghprbPullId == null) {
|
||||||
skip_e2e = 1
|
skip_e2e = 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// "github-api-token" is a secret text credential configured in Jenkins
|
|
||||||
env.GITHUB_API_TOKEN = credentials("github-api-token")
|
|
||||||
|
|
||||||
skip_e2e = sh(
|
skip_e2e = sh(
|
||||||
script: "./scripts/get_github_labels.py --id=${ghprbPullId} --has-label=ci/skip/e2e",
|
script: "./scripts/get_github_labels.py --id=${ghprbPullId} --has-label=ci/skip/e2e",
|
||||||
returnStatus: true)
|
returnStatus: true)
|
||||||
|
Loading…
Reference in New Issue
Block a user