Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
38e398b
Add more collapsed sections in CI output
mrodm Jun 5, 2025
3c71322
Update collapsed section titles
mrodm Jun 5, 2025
5f91789
Avoid running stack dump and down if stack is not started
mrodm Jun 6, 2025
c774108
Test failure
mrodm Jun 6, 2025
18e885f
Ensure failed group is opened - Buildkite output
mrodm Jun 6, 2025
2c8c36f
Run stack down command in any case to shutdown all containers
mrodm Jun 6, 2025
269a449
Run dump and ensure it does not exit build to continue cleanup process
mrodm Jun 6, 2025
75831b4
Rephrase group title
mrodm Jun 6, 2025
a5ca34a
Remove set x flag in build zip scripts
mrodm Jun 10, 2025
7bf29af
Change to uppercase
mrodm Jul 22, 2025
df812de
yq is not required in Serverless builds
mrodm Jul 22, 2025
93e4ff1
Add comment
mrodm Jul 22, 2025
a314998
Install elastic-package just once in Serverless
mrodm Jul 22, 2025
569ca1c
Show just one message to upload safe logs
mrodm Jul 23, 2025
5ba8b0f
Fix lint error
mrodm Jul 23, 2025
dce92ea
Ensure all steps in pre-exit are executed
mrodm Jul 23, 2025
2bfa9d8
Move definition of SERVERLESS variable to pipeline
mrodm Jul 23, 2025
823cc6f
Fix condition pre-exit hook
mrodm Jul 23, 2025
2a241b5
Run dump and stack down commands if stack has been created
mrodm Jul 23, 2025
c5d81fa
Remove debug in pre-exit
mrodm Jul 23, 2025
85a83ca
Add check about serverless and targets
mrodm Jul 23, 2025
9a048e1
Revert refactor upload safe logs
mrodm Jul 23, 2025
192ba69
Test with set -x flag
mrodm Jul 24, 2025
91303e9
Test adding a subshell for testtype func
mrodm Jul 24, 2025
7174187
Use subshell and add more collapsed groups in build-install scripts
mrodm Jul 24, 2025
9b035ed
Ignore errors dumping logs in cleanup
mrodm Jul 24, 2025
de15917
Add set +x in a subshell to get stack arguments
mrodm Jul 24, 2025
c990503
Add collapsed groups
mrodm Jul 24, 2025
6e33bd7
Move set flags
mrodm Jul 24, 2025
80b23a6
Apply missing set +x to get test type
mrodm Jul 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add more collapsed sections in CI output
  • Loading branch information
mrodm committed Jul 22, 2025
commit 38e398b8dc652d6cb57b524422fd5265bdd67c3c
83 changes: 48 additions & 35 deletions .buildkite/scripts/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,44 @@ while getopts ":t:p:sh" o; do
esac
done


upload_package_test_logs() {
local retry_count=0
local package_folder=""

retry_count=${BUILDKITE_RETRY_COUNT:-"0"}
package_folder="${PACKAGE}"

if [[ "${ELASTIC_PACKAGE_TEST_ENABLE_INDEPENDENT_AGENT:-""}" == "false" ]]; then
package_folder="${package_folder}-stack_agent"
fi

if [[ "${ELASTIC_PACKAGE_FIELD_VALIDATION_TEST_METHOD:-""}" != "" ]]; then
package_folder="${package_folder}-${ELASTIC_PACKAGE_FIELD_VALIDATION_TEST_METHOD}"
fi

if [[ "${retry_count}" -ne 0 ]]; then
package_folder="${package_folder}_retry_${retry_count}"
fi

upload_safe_logs \
"${JOB_GCS_BUCKET_INTERNAL}" \
"build/elastic-stack-dump/check-${PACKAGE}/logs/elastic-agent-internal/*.*" \
"insecure-logs/${package_folder}/elastic-agent-logs/"

# required for <8.6.0
upload_safe_logs \
"${JOB_GCS_BUCKET_INTERNAL}" \
"build/elastic-stack-dump/check-${PACKAGE}/logs/elastic-agent-internal/default/*" \
"insecure-logs/${package_folder}/elastic-agent-logs/default/"

upload_safe_logs \
"${JOB_GCS_BUCKET_INTERNAL}" \
"build/container-logs/*.log" \
"insecure-logs/${package_folder}/container-logs/"

}

if [[ "${TARGET}" == "" ]]; then
echo "Missing target"
usage
Expand Down Expand Up @@ -88,56 +126,31 @@ label="${TARGET}"
if [ -n "${PACKAGE}" ]; then
label="${label} - ${PACKAGE}"
fi

echo "--- Install elastic-package"
make install

echo "--- Run integration test ${label}"
if [[ "${TARGET}" == "${PARALLEL_TARGET}" ]] || [[ "${TARGET}" == "${FALSE_POSITIVES_TARGET}" ]]; then
make install

# allow to fail this command, to be able to upload safe logs
set +e
make SERVERLESS="${SERVERLESS}" PACKAGE_UNDER_TEST="${PACKAGE}" "${TARGET}"
testReturnCode=$?
set -e

retry_count=${BUILDKITE_RETRY_COUNT:-"0"}

if [[ "${UPLOAD_SAFE_LOGS}" -eq 1 ]] ; then
package_folder="${PACKAGE}"
if [[ "${ELASTIC_PACKAGE_TEST_ENABLE_INDEPENDENT_AGENT:-""}" == "false" ]]; then
package_folder="${package_folder}-stack_agent"
fi

if [[ "${ELASTIC_PACKAGE_FIELD_VALIDATION_TEST_METHOD:-""}" != "" ]]; then
package_folder="${package_folder}-${ELASTIC_PACKAGE_FIELD_VALIDATION_TEST_METHOD}"
fi

if [[ "${retry_count}" -ne 0 ]]; then
package_folder="${package_folder}_retry_${retry_count}"
fi

upload_safe_logs \
"${JOB_GCS_BUCKET_INTERNAL}" \
"build/elastic-stack-dump/check-${PACKAGE}/logs/elastic-agent-internal/*.*" \
"insecure-logs/${package_folder}/elastic-agent-logs/"

# required for <8.6.0
upload_safe_logs \
"${JOB_GCS_BUCKET_INTERNAL}" \
"build/elastic-stack-dump/check-${PACKAGE}/logs/elastic-agent-internal/default/*" \
"insecure-logs/${package_folder}/elastic-agent-logs/default/"

upload_safe_logs \
"${JOB_GCS_BUCKET_INTERNAL}" \
"build/container-logs/*.log" \
"insecure-logs/${package_folder}/container-logs/"
upload_package_test_logs
fi

if [ $testReturnCode != 0 ]; then
echo "make SERVERLESS=${SERVERLESS} PACKAGE_UNDER_TEST=${PACKAGE} ${TARGET} failed with ${testReturnCode}"
exit ${testReturnCode}
fi

make check-git-clean
exit 0
else
make "${TARGET}"
fi

make install "${TARGET}" check-git-clean
echo "--- Check git clean"
make check-git-clean
exit 0
4 changes: 4 additions & 0 deletions scripts/test-check-false-positives.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -euxo pipefail

function cleanup() {
r=$?
echo "--- Cleanup"

# Dump stack logs
elastic-package stack dump -v --output "build/elastic-stack-dump/check-${PACKAGE_UNDER_TEST:-${PACKAGE_TEST_TYPE:-*}}"
Expand Down Expand Up @@ -94,6 +95,7 @@ export ELASTIC_PACKAGE_LINKS_FILE_PATH

stack_args=$(stack_version_args) # --version <version>

echo "--- Prepare Elastic stack"
# Update the stack
elastic-package stack update -v ${stack_args}

Expand All @@ -108,6 +110,8 @@ elastic-package stack status

# Run package tests
for d in test/packages/${PACKAGE_TEST_TYPE:-false_positives}/${PACKAGE_UNDER_TEST:-*}/; do
echo "--- Check build output: ${d}"
check_build_output "$d"
echo "--- Check expected errors: ${d}"
check_expected_errors "$d"
done
14 changes: 14 additions & 0 deletions scripts/test-check-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -euxo pipefail

cleanup() {
r=$?
echo "--- Cleaning up"

# Dump stack logs
elastic-package stack dump -v \
Expand Down Expand Up @@ -54,10 +55,13 @@ export SERVERLESS=${SERVERLESS:-"false"}

# Build/check packages
for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do
echo "--- Checking package ${d}"
elastic-package check -C "$d" -v
done

if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ]; then
echo "--- Create logstash profile"

# Create a logstash profile and use it
elastic-package profiles create logstash -v
elastic-package profiles use logstash
Expand All @@ -73,6 +77,7 @@ fi
# started to test all packages. In our CI, this Elastic serverless stack is started
# at the beginning of the pipeline and must be running for all packages.
if [[ "${SERVERLESS}" != "true" ]]; then
echo "--- Prepare Elastic stack"
stack_args=$(stack_version_args) # --version <version>

# Update the stack
Expand All @@ -90,6 +95,7 @@ fi

if [ "${PACKAGE_TEST_TYPE:-other}" == "with-kind" ]; then
# Boot up the kind cluster
echo "--- Create kind cluster"
kind create cluster --config "$PWD/scripts/kind-config.yaml" --image "kindest/node:${K8S_VERSION}"
fi

Expand All @@ -100,6 +106,8 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do
if [ "${PACKAGE_TEST_TYPE:-other}" == "benchmarks" ]; then
# It is not used PACKAGE_UNDER_TEST, so all benchmark packages are run in the same loop
if [ "${package_to_test}" == "pipeline_benchmark" ]; then
echo "--- Run pipeline benchmarks and report for package ${package_to_test}"

rm -rf "${PWD}/build/benchmark-results"
elastic-package benchmark pipeline -C "$d" -v --report-format xUnit --report-output file --fail-on-missing

Expand All @@ -114,12 +122,16 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do
--threshold 1 --report-output-path="${PWD}/build/benchreport"
fi
if [ "${package_to_test}" == "system_benchmark" ]; then
echo "--- Run system benchmarks and report for package ${package_to_test}"

elastic-package benchmark system -C "$d" --benchmark logs-benchmark -v --defer-cleanup 1s
fi
elif [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ] && [ "${package_to_test}" == "system_benchmark" ]; then
echo "--- Run system benchmarks and report for package ${package_to_test}"
elastic-package benchmark system -C "$d" --benchmark logs-benchmark -v --defer-cleanup 1s
else
if [[ "${SERVERLESS}" == "true" ]]; then
echo "--- Run tests for package ${d} in Serverless mode"
# skip system tests
elastic-package test asset -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic
elastic-package test static -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic
Expand All @@ -129,6 +141,8 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do

continue
fi

echo "--- Run tests for package ${d}"
# Run all tests
# defer-cleanup is set to a short period to verify that the option is available
elastic-package test -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic
Expand Down
2 changes: 2 additions & 0 deletions scripts/test-system-test-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ cleanup() {
local container_id=""
local agent_ids

echo "--- Cleanup"

# Dump stack logs
elastic-package stack dump -v --output build/elastic-stack-dump/system-test-flags

Expand Down