mirror of
https://github.com/elastic/logstash.git
synced 2025-04-22 05:37:21 -04:00
Ensures the DRA build script surfaces a rake error, instead of allowing the build to continue.
This ensures that the build doesn't continue if any of the steps fails.
Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
(cherry picked from commit 17d0bb5ffb
)
63 lines
2.8 KiB
Bash
Executable file
63 lines
2.8 KiB
Bash
Executable file
#!/bin/bash -ie
|
|
#Note - ensure that the -e flag is set to properly set the $? status if any command fails
|
|
echo "####################################################################"
|
|
echo "##################### Starting $0"
|
|
echo "####################################################################"
|
|
|
|
source ./$(dirname "$0")/dra_common.sh
|
|
|
|
# WORKFLOW_TYPE is a CI externally configured environment variable that could assume "snapshot" or "staging" values
|
|
case "$WORKFLOW_TYPE" in
|
|
snapshot)
|
|
info "Building artifacts for the $WORKFLOW_TYPE workflow..."
|
|
if [ -z "$VERSION_QUALIFIER_OPT" ]; then
|
|
SKIP_DOCKER=1 rake artifact:all || error "rake artifact:all build failed."
|
|
else
|
|
# Qualifier is passed from CI as optional field and specify the version postfix
|
|
# in case of alpha or beta releases:
|
|
# e.g: 8.0.0-alpha1
|
|
VERSION_QUALIFIER="$VERSION_QUALIFIER_OPT" SKIP_DOCKER=1 rake artifact:all || error "rake artifact:all build failed."
|
|
STACK_VERSION="${STACK_VERSION}-${VERSION_QUALIFIER_OPT}"
|
|
fi
|
|
STACK_VERSION=${STACK_VERSION}-SNAPSHOT
|
|
info "Build complete, setting STACK_VERSION to $STACK_VERSION."
|
|
;;
|
|
staging)
|
|
info "Building artifacts for the $WORKFLOW_TYPE workflow..."
|
|
if [ -z "$VERSION_QUALIFIER_OPT" ]; then
|
|
RELEASE=1 SKIP_DOCKER=1 rake artifact:all || error "rake artifact:all build failed."
|
|
else
|
|
# Qualifier is passed from CI as optional field and specify the version postfix
|
|
# in case of alpha or beta releases:
|
|
# e.g: 8.0.0-alpha1
|
|
VERSION_QUALIFIER="$VERSION_QUALIFIER_OPT" RELEASE=1 SKIP_DOCKER=1 rake artifact:all || error "rake artifact:all build failed."
|
|
STACK_VERSION="${STACK_VERSION}-${VERSION_QUALIFIER_OPT}"
|
|
fi
|
|
info "Build complete, setting STACK_VERSION to $STACK_VERSION."
|
|
;;
|
|
*)
|
|
error "Workflow (WORKFLOW_TYPE variable) is not set, exiting..."
|
|
;;
|
|
esac
|
|
|
|
info "GENERATED ARTIFACTS"
|
|
for file in build/logstash-*; do shasum $file;done
|
|
|
|
info "Creating dependencies report for ${STACK_VERSION}"
|
|
mkdir -p build/distributions/dependencies-reports/
|
|
bin/dependencies-report --csv=build/distributions/dependencies-reports/logstash-${STACK_VERSION}.csv
|
|
|
|
info "GENERATED DEPENDENCIES REPORT"
|
|
shasum build/distributions/dependencies-reports/logstash-${STACK_VERSION}.csv
|
|
|
|
info "UPLOADING TO INTERMEDIATE BUCKET"
|
|
for file in build/logstash-*; do
|
|
upload_to_bucket $file ${STACK_VERSION}
|
|
done
|
|
|
|
# Upload Dependencies Report
|
|
upload_to_bucket "build/distributions/dependencies-reports/logstash-${STACK_VERSION}.csv" ${STACK_VERSION}
|
|
|
|
echo "####################################################################"
|
|
echo "##################### Finishing $0"
|
|
echo "####################################################################"
|