Skip to content

Review serverless teardown #1515

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 4 commits into from
Oct 19, 2023
Merged

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Oct 19, 2023

This PR allows to delete project even if the local docker-compose project fails.

This could happen if the elastic-package stack up --provider serverless fails while it is being initialized the project.

At that moment the local docker-compose project (local agents) has not been created. And it probably could not be connected to Kibana to create the golang struct client.

How to test

  1. Define EC_API_KEY, EC_HOST environment variables needed (and update region config if needed)
  2. Create a new serverless project
  3. While it's being initialized, press Ctrl-C. That causes:
    1. local docker-compose project is not created
    2. Elasticsearch, Kibana, Fleet could not be accessible yet
  4. Execute elastic-package stack down
    1. This command would fail, since docker-compose would fail (there is no snaphost.yml created yet)
    2. Serverless project is deleted

Example of elastic-package stack down -v output (this command fails, exit code != 0):

 $ elastic-package stack down -v 
2023/10/19 12:09:05 DEBUG Enable verbose logging
2023/10/19 12:09:05 DEBUG Distribution built without a version tag, can't determine release chronology. Please consider using official releases at https://github.com/elastic/elastic-package/releases
Take down the Elastic stack
2023/10/19 12:09:05 DEBUG Using Elastic Cloud URL: https://console.qa.cld.elstc.co/
2023/10/19 12:09:05 ERROR failed to destroy local agent: could not initialize local agent compose project
2023/10/19 12:09:05 DEBUG GET https://console.qa.cld.elstc.co/api/v1/serverless/projects/observability/d42ec313d54840a58e87e5b4e8873f19
2023/10/19 12:09:06 DEBUG Deleting project "elastic-package-test-serverless" (d42ec313d54840a58e87e5b4e8873f19)
2023/10/19 12:09:06 DEBUG DELETE https://console.qa.cld.elstc.co/api/v1/serverless/projects/observability/d42ec313d54840a58e87e5b4e8873f19
Error: tearing down the stack failed: failed to destroy local agent: could not initialize local agent compose project

@mrodm mrodm self-assigned this Oct 19, 2023
@mrodm mrodm force-pushed the review_serverless_teardown branch from 3718388 to bddd6a1 Compare October 19, 2023 08:11
@mrodm mrodm requested a review from a team October 19, 2023 10:14
@mrodm mrodm marked this pull request as ready for review October 19, 2023 10:19
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.

👍

Comment on lines 139 to 140
fleetURL := config.Parameters[paramServerlessFleetURL]
if true {
Copy link
Member

Choose a reason for hiding this comment

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

Something seems to be missing here 🙂

Suggested change
fleetURL := config.Parameters[paramServerlessFleetURL]
if true {
fleetURL, found := config.Parameters[paramServerlessFleetURL]
if !found {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! It was already like that previously.
Thanks! I'll update it.

@mrodm mrodm requested a review from jsoriano October 19, 2023 15:21
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm merged commit e739c45 into elastic:main Oct 19, 2023
@mrodm mrodm deleted the review_serverless_teardown branch October 19, 2023 17:42
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.

3 participants