Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit c10e38f

Browse files
committed
chore: add parameter in the pipeline
1 parent 8f5e203 commit c10e38f

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

.ci/build-docker-images.groovy

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,23 @@ pipeline {
2424
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
2525
quietPeriod(10)
2626
}
27+
parameters {
28+
string(name: 'branch_specifier', defaultValue: 'master', description: 'It would not be defined on the first build, see JENKINS-41929.')
29+
}
2730
triggers {
2831
cron 'H H(4-5) * * 1-5'
2932
}
3033
stages {
3134
stage('Checkout') {
35+
environment {
36+
// Parameters will be empty for the very first build, setting an environment variable
37+
// with the same name will workaround the issue. see JENKINS-41929
38+
BRANCH_SPECIFIER = "${params?.branch_specifier}"
39+
}
3240
steps {
3341
deleteDir()
3442
gitCheckout(basedir: "${BASE_DIR}",
35-
branch: "${params.BRANCH_REFERENCE}",
43+
branch: "${env.BRANCH_SPECIFIER}",
3644
repo: "https://github.com/elastic/${REPO}.git",
3745
credentialsId: "${JOB_GIT_CREDENTIALS}"
3846
)

.ci/jobs/build-docker-images.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
description: Job to pre-build docker images used in E2E tests.
66
view: Beats
77
project-type: pipeline
8-
parameters:
9-
- string:
10-
name: branch_specifier
11-
default: master
12-
description: the Git branch specifier to build
138
pipeline-scm:
149
script-path: .ci/build-docker-images.groovy
1510
scm:
@@ -22,4 +17,4 @@
2217
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
2318
reference-repo: /var/lib/jenkins/.git-references/e2e-testing.git
2419
branches:
25-
- $branch_specifier
20+
- master

0 commit comments

Comments
 (0)