File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,27 @@ export ENVIRONMENT="ci"
1616REPO=$( repo_name " ${BUILDKITE_REPO} " )
1717export REPO
1818
19- # From Jenkins
20- # BRANCH_NAME_LOWER_CASE = "${env.BRANCH_NAME.toLowerCase().replaceAll('[^a-z0-9-]', '-')}"
21- BRANCH_NAME_LOWER_CASE=$( echo " $BUILDKITE_BRANCH " | tr ' [:upper:]' ' [:lower:]' | tr ' _/\:. ' ' -' )
19+ branch_name_label () {
20+ local branch=" $1 "
21+
22+ if [[ " ${BUILDKITE_PULL_REQUEST} " != " false" ]] ; then
23+ # remove fork from branch name
24+ branch=$( echo $branch | cut -d : -f 2)
25+ fi
26+
27+ # From Jenkins
28+ # BRANCH_NAME_LOWER_CASE = "${env.BRANCH_NAME.toLowerCase().replaceAll('[^a-z0-9-]', '-')}"
29+ # to lower case and replace characters
30+ branch=$( echo " $branch " | tr ' [:upper:]' ' [:lower:]' | tr ' _/\:. ' ' -' )
31+
32+ # truncate up to 63 characters limit
33+ echo $branch | head -c 63
34+ }
35+
36+ BRANCH_NAME_LOWER_CASE=$( branch_name_label " $BUILDKITE_BRANCH " )
2237export BRANCH_NAME_LOWER_CASE
23- export BUILD_ID=" ${BUILDKITE_BUILD_ID} "
38+ # This variable contains the build number https://buildkite.com/elastic/elastic-package/<number>
39+ export BUILD_ID=" ${BUILDKITE_BUILD_NUMBER} "
2440# get current timestamp in milliseconds
2541# From Jenkins
2642# CREATED_DATE = "${new Date().getTime()}"
You can’t perform that action at this time.
0 commit comments