Skip to content

Commit

Permalink
[CI] Add some more steps to test on Macos ARM (#2030)
Browse files Browse the repository at this point in the history
Added a new step in the CI pipeline to test to build packages using
elastic-package build command in MacOS ARM VMs. Doing that allows
us to check that the at least can be executed this command in that
platform and architecture.
  • Loading branch information
mrodm authored Sep 3, 2024
1 parent ed0a6dd commit 8ca8a80
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 10 deletions.
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

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/*/

0 comments on commit 8ca8a80

Please sign in to comment.