Skip to content

Commit 00c25a3

Browse files
committed
Handle conditional build args better
(cherry picked from commit 65aa80d)
1 parent 2297439 commit 00c25a3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

.buildkite/dra.sh

+7-8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ set -euo pipefail
44

55
DRA_WORKFLOW=${DRA_WORKFLOW:-snapshot}
66

7-
if [[ "$BUILDKITE_BRANCH" == *.x && "$DRA_WORKFLOW" == "staging" ]]; then
8-
exit 0
7+
if [[ "$BUILDKITE_BRANCH" == *.x && "$DRA_WORKFLOW" == "staging" ]]; then exit 0
98
fi
109

1110
echo --- Creating distribution
@@ -15,11 +14,11 @@ HADOOP_VERSION=$(grep eshadoop buildSrc/esh-version.properties | sed "s/eshadoop
1514
BASE_VERSION="$HADOOP_VERSION"
1615

1716
VERSION_SUFFIX=""
18-
BUILD_ARGS="-Dbuild.snapshot=false"
19-
QUALIFIER_BUILD_ARGS=""
17+
declare -a BUILD_ARGS
18+
BUILD_ARGS[0]="-Dbuild.snapshot=false"
2019
if [[ "$DRA_WORKFLOW" == "snapshot" ]]; then
2120
VERSION_SUFFIX="-SNAPSHOT"
22-
BUILD_ARGS="-Dbuild.snapshot=true"
21+
BUILD_ARGS[0]="-Dbuild.snapshot=true"
2322
fi
2423

2524
RM_BRANCH="$BUILDKITE_BRANCH"
@@ -28,15 +27,15 @@ if [[ "$BUILDKITE_BRANCH" == "main" ]]; then
2827
fi
2928

3029
if [[ -n "${VERSION_QUALIFIER:-}" ]]; then
31-
QUALIFIER_BUILD_ARGS="-Dbuild.version_qualifier=$VERSION_QUALIFIER"
30+
BUILD_ARGS+=("-Dbuild.version_qualifier=$VERSION_QUALIFIER")
3231
HADOOP_VERSION="${HADOOP_VERSION}-${VERSION_QUALIFIER}"
3332
fi
3433

3534
echo "DRA_WORKFLOW=$DRA_WORKFLOW"
3635
echo "HADOOP_VERSION=$HADOOP_VERSION"
3736
echo "RM_BRANCH=$RM_BRANCH"
3837
echo "VERSION_SUFFIX=$VERSION_SUFFIX"
39-
echo "BUILD_ARGS=$BUILD_ARGS"
38+
echo "BUILD_ARGS=${BUILD_ARGS[@]}"
4039

4140
ES_BUILD_ID=$(curl -sS "https://artifacts-$DRA_WORKFLOW.elastic.co/elasticsearch/latest/${RM_BRANCH}.json" | jq -r '.build_id')
4241
echo "ES_BUILD_ID=$ES_BUILD_ID"
@@ -45,7 +44,7 @@ mkdir localRepo
4544
wget --quiet "https://artifacts-$DRA_WORKFLOW.elastic.co/elasticsearch/${ES_BUILD_ID}/maven/org/elasticsearch/gradle/build-tools/${HADOOP_VERSION}${VERSION_SUFFIX}/build-tools-${HADOOP_VERSION}${VERSION_SUFFIX}.jar" \
4645
-O "localRepo/build-tools-${HADOOP_VERSION}${VERSION_SUFFIX}.jar"
4746

48-
./gradlew -S -PlocalRepo=true "${BUILD_ARGS}" "${QUALIFIER_BUILD_ARGS}" -Dorg.gradle.warning.mode=summary -Dcsv="$WORKSPACE/build/distributions/dependencies-${HADOOP_VERSION}${VERSION_SUFFIX}.csv" :dist:generateDependenciesReport distribution
47+
./gradlew -S -PlocalRepo=true "${BUILD_ARGS[@]}" -Dorg.gradle.warning.mode=summary -Dcsv="$WORKSPACE/build/distributions/dependencies-${HADOOP_VERSION}${VERSION_SUFFIX}.csv" :dist:generateDependenciesReport distribution
4948

5049
# Allow other users access to read the artifacts so they are readable in the container
5150
find "$WORKSPACE" -type f -path "*/build/distributions/*" -exec chmod a+r {} \;

0 commit comments

Comments
 (0)