Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .buildkite/pipeline.trigger.integration.tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ for package in $(find . -maxdepth 1 -mindepth 1 -type d) ; do
echo " - build/test-results/*.xml"
echo " - build/test-coverage/coverage-*.xml" # these files should not be used to compute the final coverage of elastic-package
done

popd > /dev/null
popd > /dev/null

pushd test/packages/parallel > /dev/null
for independent_agent in false true; do
Expand Down Expand Up @@ -127,7 +126,6 @@ for package in $(find . -maxdepth 1 -mindepth 1 -type d) ; do
echo " - build/test-coverage/coverage-*.xml" # these files should not be used to compute the final coverage of elastic-package
done
done

popd > /dev/null

echo " - label: \":go: Integration test: build-zip\""
Expand All @@ -139,6 +137,17 @@ echo " artifact_paths:"
echo " - build/elastic-stack-dump/build-zip/logs/*.log"
echo " - build/packages/*.sig"

# TODO: Missing docker & docker-compose in MACOS ARM agent image, skip installation of packages in the meantime.
# If docker and docker-compose are available for this platform/architecture, it could be added a step to test the stack commands (or even replace this one).
echo " - label: \":macos: :go: Integration test: build-zip\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-just-build-zip"
echo " agents:"
echo " provider: \"orka\""
echo " imagePrefix: \"${MACOS_ARM_AGENT_IMAGE}\""
echo " artifact_paths:"
echo " - build/elastic-stack-dump/build-zip/logs/*.log"
echo " - build/packages/*.sig"

echo " - label: \":go: Integration test: install-zip\""
echo " command: ./.buildkite/scripts/integration_tests.sh -t test-install-zip"
echo " agents:"
Expand Down
13 changes: 9 additions & 4 deletions .buildkite/scripts/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ PARALLEL_TARGET="test-check-packages-parallel"
FALSE_POSITIVES_TARGET="test-check-packages-false-positives"
KIND_TARGET="test-check-packages-with-kind"
SYSTEM_TEST_FLAGS_TARGET="test-system-test-flags"
TEST_JUST_BUILD_ZIP_TARGET="test-just-build-zip"

GOOGLE_CREDENTIALS_FILENAME="google-cloud-credentials.json"

REPO_NAME=$(repo_name "${BUILDKITE_REPO}")
Expand Down Expand Up @@ -80,11 +82,14 @@ if [[ "$SERVERLESS" == "false" ]]; then
echo "--- install go"
with_go

echo "--- install docker"
with_docker
if [[ "${TARGET}" != "${TEST_JUST_BUILD_ZIP_TARGET}" ]]; then
# Not supported in Macos ARM
echo "--- install docker"
with_docker

echo "--- install docker-compose plugin"
with_docker_compose_plugin
echo "--- install docker-compose plugin"
with_docker_compose_plugin
fi
fi

if [[ "${TARGET}" == "${FALSE_POSITIVES_TARGET}" ]]; then
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ test-check-packages-with-custom-agent:
test-build-zip:
./scripts/test-build-zip.sh
Comment on lines 109 to 110
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this apart of just building the zip? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script builds the packages and then installs them (without the zip file). It would be briefly like:

elastic-package stack up -v -d # for each package elastic-package build -v --zip --sign elastic-package install -v elastic-package stack down -v

Then, there is another script that builds the packages and installs them using the zip file (scripts/test-install-zip.sh):

elastic-package stack up -v -d # for each package elastic-package build -v --zip --sign elastic-package install -v --zip <zip_file_path> # check via curl that it is installed elastic-package stack down -v

And there is another script file, that just builds the zip file. Used specially for testing in Macos ARM:

elastic-package stack up -v -d # for each package elastic-package build -v --zip --sign elastic-package stack down -v

Probably, they could be renamed so it is clear what they do. What about rename them as this? @jsoriano

  • scripts/test-build.zip.sh: scripts/test-build-install.sh
    • Package build and installed from the working copy
  • scripts/test-install.zip.sh: scripts/test-build-install-zip-file.sh
    • Package built and installed using the zip file
  • scripts/test-just-build-zip.sh: scripts/test-build.zip.sh
    • Package built

If so, I could create a follow-up PR to rename those files as well as Makefile and buildkite scripts accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, these scripts are a bit confusing. Let's rename them in a follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created PR to rename test scripts: #2072


test-just-build-zip:
./scripts/test-just-build-zip.sh

test-install-zip:
./scripts/test-install-zip.sh

Expand Down
4 changes: 1 addition & 3 deletions scripts/test-install-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ installAndVerifyPackage() {
}

usage() {
echo "${0} [-s] [-h]"
echo "${0} [-s] [-v <stack_version>] [-h]"
echo "Run test-install-zip suite"
echo -e "\t-s: Use elastic-package stack shellinit to export environment variablles. By default, they should be exported manually."
echo -e "\t-v <stack_version>: Speciy which Elastic Stack version to use. If not specified it will use the default version in elastic-package."
echo -e "\t-h: Show this message"
}


USE_SHELLINIT=0
STACK_VERSION="default"
while getopts ":sv:h" o; do
Expand Down Expand Up @@ -81,7 +80,6 @@ while getopts ":sv:h" o; do
esac
done


ARG_VERSION=""
if [ "${STACK_VERSION}" != "default" ]; then
ARG_VERSION="--version ${STACK_VERSION}"
Expand Down
41 changes: 41 additions & 0 deletions scripts/test-just-build-zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

set -euxo pipefail

cleanup() {
r=$?

# Clean used resources
for d in test/packages/*/*/; do
elastic-package clean -C "$d" -v
done

exit $r
}

testype() {
basename "$(dirname "$1")"
}

trap cleanup EXIT

OLDPWD=$PWD
# Build packages
export ELASTIC_PACKAGE_SIGNER_PRIVATE_KEYFILE="$OLDPWD/scripts/gpg-private.asc"
ELASTIC_PACKAGE_SIGNER_PASSPHRASE=$(cat "$OLDPWD/scripts/gpg-pass.txt")
export ELASTIC_PACKAGE_SIGNER_PASSPHRASE
ELASTIC_PACKAGE_LINKS_FILE_PATH="$(pwd)/scripts/links_table.yml"
export ELASTIC_PACKAGE_LINKS_FILE_PATH

go run ./scripts/gpgkey

for d in test/packages/*/*/; do
# Packages in false_positives can have issues.
if [ "$(testype $d)" == "false_positives" ]; then
continue
fi
elastic-package build -C "$d" --zip --sign -v
done

# Remove unzipped built packages, leave .zip files
rm -r build/packages/*/