Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Buildkite] Add pipeline to test with Elastic serverless daily #1807

Merged
merged 20 commits into from
May 2, 2024

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Apr 30, 2024

Closes #1656

Add a new pipeline to test elastic-package using the Elastic tack from a Serverless project (by default observability project). For that:

  • A new pipeline that is going to be executed daily for Observability project
  • Currently, this will be tested with all the packages under test/packages/parallel
    • No system tests (as in the integrations repository)
    • No coverage for pipeline tests, there are errors like:
      Error: error running package pipeline tests: could not complete test run: error calculating pipeline coverage: error fetching pipeline stats for code coverage calculations: need exactly one ES node in stats response (got 4)
      
    • Set an option to trigger this new pipeline using a comment in the Pull Request: test serverless: to be validated once this PR is merged

Example of build running Serverless step:

@mrodm mrodm self-assigned this Apr 30, 2024
@mrodm mrodm force-pushed the test_serverless_pipeline branch 2 times, most recently from 55a3292 to 0183caa Compare April 30, 2024 13:59
mrodm added 2 commits April 30, 2024 18:27
Move workspace and tmp folder vars to pre-command hook

Use path to elastic-package binary in pre-exit hook. PATH variable does
not keep the value from the pipeline step.
@mrodm mrodm force-pushed the test_serverless_pipeline branch from bf0fe3d to 96cbd80 Compare April 30, 2024 16:40
@elasticmachine
Copy link
Collaborator

Triggered serverless pipeline: https://buildkite.com/elastic/elastic-package/builds/2999

@mrodm mrodm force-pushed the test_serverless_pipeline branch from 7cb77a5 to 6469336 Compare May 2, 2024 10:28
@@ -68,13 +71,15 @@ if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ]; then
echo "stack.logstash_enabled: true" >> ~/.elastic-package/profiles/logstash/config.yml
fi

# Update the stack
elastic-package stack update -v
if [[ "${SERVERLESS}" != "true" ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When testing with Serverless, Elastic stack is just started once at the beginning of the pipeline step. That's why here it is skipped.

Copy link
Member

Choose a reason for hiding this comment

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

Could we also add a comment here mentioning this?

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe we can extract the common logic to check packages, and follow the same approach as in serverless in all targets? For a future refactor in any case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment for now in this script, here and also in the cleanup function.

Comment on lines +43 to +48
if [[ "${BUILDKITE_PULL_REQUEST}" != "false" ]]; then
echo "--- install gh cli"
with_github_cli

add_pr_comment "${BUILDKITE_PULL_REQUEST}" "${BUILDKITE_BUILD_URL}"
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add a comment in case it is triggered with a Github comment.
Example:
#1807 (comment)

@@ -78,57 +73,37 @@ if [[ "${TARGET}" == "" ]]; then
exit 1
fi

google_cloud_auth_safe_logs() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved these functions to .buildkite/scripts/tooling.sh

cpu: "8"
memory: "4G"

- label: ":go: :linux: Run unit tests"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Skipped in this pipeline windows tests. They should already be run by the PR pipeline or by the push to the main branch.

Copy link
Member

Choose a reason for hiding this comment

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

Umm, and do we need any unit tests here? 🤔 We could run only the integration tests 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.

Ok, I'll remove this too 👍
These unit tests are going to be run in each PR , so it's not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean to remove also the step related to make check-static? @jsoriano

Copy link
Member

Choose a reason for hiding this comment

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

Yep, we could also remove this step if we are not going to use them to block the execution of integration tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would keep check-static step, that will ensure that elastic-package can be compiled without errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, we could also remove this step if we are not going to use them to block the execution of integration tests.

The script that starts the Elastic serverless project already performs a make install command https://github.com/elastic/elastic-package/pull/1807/files#diff-6b482aae5cb3ce434c95fe0f9238d6c8ed14a602031d6473ae03373f78ea937fR52

If there is any error there, that script should fail. So there should not be needed to keep check-static step.

I'll remove that step too.

Comment on lines +43 to +45
"build_on_comment": true,
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:test)\\W+(?:serverless))$",
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:test)\\W+(?: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.

Allow to trigger this pipeline on demand by adding a comment in the Pull Request.

@mrodm mrodm marked this pull request as ready for review May 2, 2024 13:46
@mrodm mrodm requested a review from a team May 2, 2024 14:42
cpu: "8"
memory: "4G"

- label: ":go: :linux: Run unit tests"
Copy link
Member

Choose a reason for hiding this comment

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

Umm, and do we need any unit tests here? 🤔 We could run only the integration tests for serverless.

memory: "4G"

- wait: ~
continue_on_failure: true
Copy link
Member

Choose a reason for hiding this comment

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

Or if we keep the static and unit tests, maybe we can use them to gate if we continue with integration tests? So if static or unit tests fail, we fail fast and don't continue with the integration tests.

Suggested change
continue_on_failure: true
continue_on_failure: false

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 required to set continue_on_failure as true, in order to process the XML files from JUnit in the last step.

Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to process the junit files for unit tests without executing the step with integration tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if there would be any issue with that.
It could be added a new step to just process the junit files from those two steps.

But we would need to keep the latest step to process the junit files from the integration steps, and that would re-process those junit files.

In any case, as discussed in the other thread, both static and unit tests/steps have been removed from the pipeline.

Comment on lines 56 to 58
echo "Waiting time to avoid getaddrinfo ENOTFOUND errors..."
sleep 120
echo "Done."
Copy link
Member

Choose a reason for hiding this comment

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

Could we do some active wait here?

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 is based on the script run in the integrations repository. At least a few months ago, there were some errors even if elastic-package does an active wait to report as initialized the project.

Probably, we could try here in this pipeline to remove this sleep and check if it works. WDYT @jsoriano ?

Copy link
Member

Choose a reason for hiding this comment

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

As you prefer, we can also leave this for a future change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. so then I'll keep it for now, and we can test to remove it later.

Comment on lines 99 to 100
# Currently, if STACK_VERSION is not defined, for serverless it will be
# used as Elastic stack version (for agents) the default version in elastic-package
Copy link
Member

Choose a reason for hiding this comment

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

Nit. Move this comment closer to elastic-package stack 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.

Done.

@@ -68,13 +71,15 @@ if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ]; then
echo "stack.logstash_enabled: true" >> ~/.elastic-package/profiles/logstash/config.yml
fi

# Update the stack
elastic-package stack update -v
if [[ "${SERVERLESS}" != "true" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Could we also add a comment here mentioning this?

@@ -68,13 +71,15 @@ if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ]; then
echo "stack.logstash_enabled: true" >> ~/.elastic-package/profiles/logstash/config.yml
fi

# Update the stack
elastic-package stack update -v
if [[ "${SERVERLESS}" != "true" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Or maybe we can extract the common logic to check packages, and follow the same approach as in serverless in all targets? For a future refactor in any case.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm changed the title Add pipeline to test with serverless daily [Buildkite] Add pipeline to test with Elastic serverless daily May 2, 2024
@mrodm mrodm merged commit a9efa3e into elastic:main May 2, 2024
3 checks passed
@mrodm mrodm deleted the test_serverless_pipeline branch May 2, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Buildkite] Add tests to check elastic-package with serverless projects
3 participants