Skip to content

Conversation

@mrodm
Copy link
Contributor

@mrodm mrodm commented Aug 21, 2024

Relates #539

This PR adds 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.

For the time being, it is not available docker/docker-compose commands in those MacOS ARM VMs.

@mrodm mrodm self-assigned this Aug 21, 2024
@mrodm mrodm force-pushed the add-some-more-steps-arm branch from 933fe0c to 3694852 Compare August 21, 2024 14:16
@mrodm mrodm force-pushed the add-some-more-steps-arm branch from a4cc1fb to 735c1aa Compare August 21, 2024 16:18
@mrodm
Copy link
Contributor Author

mrodm commented Aug 21, 2024

/test

@mrodm mrodm marked this pull request as ready for review August 21, 2024 17:31
@mrodm mrodm requested a review from a team as a code owner August 21, 2024 17:31
Comment on lines 140 to 143
# 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-build-zip-skip-install"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could it be interesting to add this step in the CI pipeline ? WDYT ?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, yes.

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

LGTM, but added suggestion about having a test script that just builds the zip.

Comment on lines 140 to 143
# 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-build-zip-skip-install"
Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, yes.


if [[ "${SKIP_INSTALL}" == 1 ]]; then
exit 0
fi
Copy link
Member

Choose a reason for hiding this comment

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

Nit. Instead of having this if and the ones in with_docker and with_docker_compose, maybe we can add a new script that just builds the zip and doesn't call to with_docker and with_docker_compose. Even if we have some duplication between the scripts, it would be more explicit. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll do that. It is going to be better to have that script with less "ifs"

if [[ "${platform_type_lowercase}" == "darwin" ]]; then
echo "Skip. Not supported in Darwin."
return
fi
Copy link
Member

Choose a reason for hiding this comment

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

This is not needed now, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is still needed. These function (with_docker and with_docker_compose) are called from the script .buildkite/scripts/integrations_tests.sh. This script is used for all the steps that could run with Linux containers or Linux VMs, so it is needed to keep these safeguards/checks.

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

Copy link
Member

Choose a reason for hiding this comment

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

Maybe I am missing something, but do we want these scripts to continue if docker installation cannot be performed?

This script is used for all the steps that could run with Linux containers or Linux VMs, so it is needed to keep these safeguards/checks.

Is it run in darwin?

Copy link
Member

Choose a reason for hiding this comment

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

This script is used for all the steps that could run with Linux containers or Linux VMs, so it is needed to keep these safeguards/checks.

Is it run in darwin?

Ok, I see it is run with -t test-just-build-zip, could we avoid calling with_docker and with_docker_compose_plugin when the target is test-just-build-zip? The same way as we are avoiding it when running for serverless.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, for now just Macos ARM is used for that specific make target.
It could be added as you mentioned that condition to not call those functions if that target is the one to be executed.

I'll give it a try 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied the suggestion here 2e7220d

if ! command -v docker &> /dev/null ; then
echo "Skip. Docker is not installed by default"
return
fi
Copy link
Member

Choose a reason for hiding this comment

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

Or this.

Copy link
Contributor Author

@mrodm mrodm Aug 26, 2024

Choose a reason for hiding this comment

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

As mentioned here, I would keep this condition too.
In this case, if there is no docker there is no need to install docker-compose.

@mrodm
Copy link
Contributor Author

mrodm commented Aug 26, 2024

/test

@mrodm mrodm changed the title [CI] Add some more steps arm [CI] Add some more steps to test on Macos ARM Aug 27, 2024
@mrodm
Copy link
Contributor Author

mrodm commented Aug 27, 2024

/test

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm requested a review from jsoriano August 27, 2024 10:05
Comment on lines 109 to 110
test-build-zip:
./scripts/test-build-zip.sh
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

@mrodm mrodm merged commit 8ca8a80 into elastic:main Sep 3, 2024
@mrodm mrodm deleted the add-some-more-steps-arm branch September 3, 2024 10:08
@mrodm mrodm mentioned this pull request Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants