Skip to content

[CI] Add support to test packages with basic subscription #13377

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

Merged
merged 54 commits into from
Apr 9, 2025

Conversation

mrodm
Copy link
Collaborator

@mrodm mrodm commented Apr 1, 2025

Proposed commit message

Update CI scripts and tools (ReportFailedTests) to allow run Elastic stack with other subscriptions.
Currently, it is just supported "basic" and "trial".

Added new mage targets to get the subscription set in the package:

 $ mage -l 
Targets:
  check                       
  clean                       
  importBeats                 
  isSubscriptionCompatible    checks whether or not the package in the current directory allows to run with the given subscription (ELASTIC_SUBSCRIPTION env var).
  mergeCoverage               
  modTidy                     
  reportFailedTests     

Author's Checklist

How to test this PR locally

# test some package
cd packages/<package>
elastic-package stack up -v -d -U stack.elastic_subscription=basic
elastic-package test -v
elastic-package stack down -v

# test creation of scripts
DRY_RUN=true CI_MAX_TESTS_REPORTED=1 BUILDKITE_BUILD_URL=https://buildkite.com/elastic/integrations/builds/20643 SERVERLESS=false STACK_VERSION=9.0.0-SNAPSHOT ELASTIC_SUBSCRIPTION=basic VERBOSE_MODE_ENABLED=true  mage -v ReportFailedTests build/test-results

Related issues

@elastic-vault-github-plugin-prod
Copy link

elastic-vault-github-plugin-prod bot commented Apr 1, 2025

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@mrodm mrodm mentioned this pull request Apr 3, 2025
2 tasks
@mrodm mrodm force-pushed the test_packages_basic_subscription branch from d87ae20 to fcfc90a Compare April 8, 2025 16:21
@@ -1,12 +1,17 @@
{{ if ne .stackVersion "" -}}
- Stack version: {{ .stackVersion }}
{{ else -}}
- Stack version: Same as in Pull Request builds
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This value could be changed in the follow-up PR to include LogsDB too.

@mrodm mrodm self-assigned this Apr 8, 2025
@mrodm mrodm changed the title [CI] Test packages basic subscription - WIP [CI] Test packages basic subscription Apr 8, 2025
@mrodm mrodm changed the title [CI] Test packages basic subscription [CI] Add support to test packages with basic subscription Apr 8, 2025
Comment on lines +682 to +686
if ! reason=$(mage -d "${WORKSPACE}" -w . isSubscriptionCompatible) ; then
return 1
fi
echo "${reason}"
return 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would return failure if there is any failure (e.g. failed to read YAML file), and success in any other case (zero value).
When it returns success, the message echoed will show whether or not it is compatible (true or false).

Comment on lines +720 to +727
if ! compatible=$(is_subscription_compatible); then
echo "${FATAL_ERROR}"
return 1
fi
if [[ "${compatible}" == "false" ]]; then
echo "[${package}] PR is not affected: subscription not compatible with ${ELASTIC_SUBSCRIPTION}"
return 1
fi
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For both cases, this function will return failure (code 1). Depending on the message echoed, the caller method should take one or other action.

@elasticmachine
Copy link

elasticmachine commented Apr 9, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @mrodm

@mrodm mrodm mentioned this pull request Apr 9, 2025
1 task
@mrodm mrodm marked this pull request as ready for review April 9, 2025 09:44
@mrodm mrodm requested a review from a team as a code owner April 9, 2025 09:44
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@mrodm mrodm merged commit 1953421 into elastic:main Apr 9, 2025
7 checks passed
@mrodm mrodm deleted the test_packages_basic_subscription branch April 9, 2025 12:56
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.

4 participants