Skip to content

Commit

Permalink
Fix dra workflow argument and pass license key to release staging builds
Browse files Browse the repository at this point in the history
(cherry picked from commit 7c944d6)
  • Loading branch information
mark-vieira committed Nov 17, 2022
1 parent 7e14c11 commit f559b9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions .ci/jobs.t/elastic+elasticsearch+dra-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,33 @@
RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA
- shell: |
#!/usr/local/bin/runbld --redirect-stderr
WORKFLOW="STAGING"
WORKFLOW="staging"
RM_BRANCH="%BRANCH%" && [[ "%BRANCH%" == "main" ]] && RM_BRANCH=master
ES_VERSION=$(cat build-tools-internal/version.properties \
| grep elasticsearch \
| sed "s/elasticsearch *= *//g")
VERSION_SUFFIX="" && [[ "$WORKFLOW" == "SNAPSHOT" ]] && VERSION_SUFFIX="-SNAPSHOT"
VERSION_SUFFIX="" && [[ "$WORKFLOW" == "snapshot" ]] && VERSION_SUFFIX="-SNAPSHOT"
BEATS_BUILD_ID="$(./.ci/scripts/resolve-dra-manifest.sh beats $RM_BRANCH $ES_VERSION $WORKFLOW)"
ML_CPP_BUILD_ID="$(./.ci/scripts/resolve-dra-manifest.sh ml-cpp $RM_BRANCH $ES_VERSION $WORKFLOW)"
set -euo pipefail
set +x
VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id=$VAULT_ROLE_ID secret_id=$VAULT_SECRET_ID)
LICENSE_KEY=$(mktemp -d)/license.key
export VAULT_TOKEN
vault read -field pubkey secret/elasticsearch-ci/license | base64 --decode > $LICENSE_KEY
unset VAULT_TOKEN
$WORKSPACE/.ci/scripts/run-gradle.sh -Ddra.artifacts=true \
-Ddra.artifacts.dependency.beats=${BEATS_BUILD_ID} \
-Ddra.artifacts.dependency.ml-cpp=${ML_CPP_BUILD_ID} \
-Ddra.workflow=$WORKFLOW \
-Dcsv=$WORKSPACE/build/distributions/dependencies-${ES_VERSION}${VERSION_SUFFIX}.csv \
-Dbuild.snapshot=false \
-Dlicense.key=$LICENSE_KEY
buildReleaseArtifacts \
exportCompressedDockerImages \
:distribution:generateDependenciesReport
unset VAULT_TOKEN
set -x
$WORKSPACE/x-pack/plugin/sql/connectors/tableau/package.sh asm qualifier="$VERSION_SUFFIX"
Expand Down
4 changes: 2 additions & 2 deletions .ci/jobs.t/elastic+elasticsearch+periodic+dra-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
RUNTIME_JAVA_HOME=$HOME/.java/$ES_RUNTIME_JAVA
- shell: |
#!/usr/local/bin/runbld --redirect-stderr
WORKFLOW="SNAPSHOT"
WORKFLOW="snapshot"
RM_BRANCH="%BRANCH%" && [[ "%BRANCH%" == "main" ]] && RM_BRANCH=master
ES_VERSION=$(cat build-tools-internal/version.properties \
| grep elasticsearch \
| sed "s/elasticsearch *= *//g")
VERSION_SUFFIX="" && [[ "$WORKFLOW" == "SNAPSHOT" ]] && VERSION_SUFFIX="-SNAPSHOT"
VERSION_SUFFIX="" && [[ "$WORKFLOW" == "snapshot" ]] && VERSION_SUFFIX="-SNAPSHOT"
BEATS_BUILD_ID="$(./.ci/scripts/resolve-dra-manifest.sh beats $RM_BRANCH $ES_VERSION $WORKFLOW)"
ML_CPP_BUILD_ID="$(./.ci/scripts/resolve-dra-manifest.sh ml-cpp $RM_BRANCH $ES_VERSION $WORKFLOW)"
set -euo pipefail
Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/resolve-dra-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ strip_version() {
}

fetch_build() {
curl -sS https://artifacts-$(echo $1 | awk '{print tolower($0)}').elastic.co/$2/latest/$3.json \
curl -sS https://artifacts-$1.elastic.co/$2/latest/$3.json \
| jq -r '.build_id'
}

Expand Down

0 comments on commit f559b9a

Please sign in to comment.