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

[Elastic Agent] Fix composed.Verifier so files are removed when invalid #30281

Merged
merged 2 commits into from
Feb 10, 2022

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Feb 8, 2022

What does this PR do?

Fixes an issue in the composed.Verifier. Without this change if any verifier failed before the final verifier it would not remove the files and the last verifier in the chain would never be called to remove the files. This fixes the issue to always have each verifier have the ability to remove the files when it fails to verify.

Why is it important?

Without this change when a downloaded artifact gets corrupted, the Elastic Agent will keep trying to verify the same file, instead of removing it and re-downloading it from artifacts.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@blakerouse blakerouse added backport-v8.0.0 Automated backport with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-v8.1.0 Automated backport with mergify backport-7.17 Automated backport to the 7.17 branch with mergify labels Feb 8, 2022
@blakerouse blakerouse self-assigned this Feb 8, 2022
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Feb 8, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 8, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-02-08T21:01:17.309+0000

  • Duration: 102 min 38 sec

Test stats 🧪

Test Results
Failed 0
Passed 7232
Skipped 16
Total 7248

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@blakerouse blakerouse marked this pull request as ready for review February 8, 2022 21:01
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@jlind23 jlind23 requested a review from a team February 9, 2022 10:11
Copy link
Contributor

@lykkin lykkin left a comment

Choose a reason for hiding this comment

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

LGTM

@ph ph self-requested a review February 10, 2022 14:29
@ph
Copy link
Contributor

ph commented Feb 10, 2022

@blakerouse I would prefer we don't target 8.1/8.0, we are working to stabilize that release and we still don't know the other issue root cause. I find it risky to introduce it late.

@blakerouse
Copy link
Contributor Author

I was able to test this with docker locally to confirm that it fixes the behavior:

  1. First ran this once:
docker run -it -v $(pwd)/state:/state -e STATE_PATH=/state docker.elastic.co/beats/elastic-agent:8.2.0
# let it run for a bit
^c
  1. Performed:
echo "baddata" >> state/data/downloads/filebeat-8.2.0-linux-x86_64.tar.gz
  1. Ran it again:
docker run -it -v $(pwd)/state:/state -e STATE_PATH=/state docker.elastic.co/beats/elastic-agent:8.2.0
  1. Resulted in the tar.gz and the .tar.gz.sha512 to be deleted and then it tried to download from the artifacts.

@blakerouse
Copy link
Contributor Author

@ph I think this will mask the issue in 8.1.0, ultimately solving the corruption issue. But you are correct that it doesn't answer how it gets that way.

@blakerouse blakerouse removed backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify backport-7.17 Automated backport to the 7.17 branch with mergify labels Feb 10, 2022
@mergify
Copy link
Contributor

mergify bot commented Feb 10, 2022

This pull request does not have a backport label. Could you fix it @blakerouse? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Feb 10, 2022
@blakerouse
Copy link
Contributor Author

/package

@ph
Copy link
Contributor

ph commented Feb 10, 2022

@blakerouse Yes, I think this is the problem we would mask the issues, and add traffic to the cloud deployment. :(

@blakerouse blakerouse merged commit e6c1950 into elastic:main Feb 10, 2022
@blakerouse blakerouse deleted the fix-30280 branch February 10, 2022 20:44
@ph ph added backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify labels Feb 21, 2022
mergify bot pushed a commit that referenced this pull request Feb 21, 2022
…id (#30281)

* Fix composed.Verifier.

* Add tests and changelog.

(cherry picked from commit e6c1950)
@ph
Copy link
Contributor

ph commented Feb 21, 2022

Added backport to other version, lets see if mergify pick them up.

mergify bot pushed a commit that referenced this pull request Feb 21, 2022
…id (#30281)

* Fix composed.Verifier.

* Add tests and changelog.

(cherry picked from commit e6c1950)
blakerouse added a commit that referenced this pull request Mar 8, 2022
…id (#30281) (#30497)

* Fix composed.Verifier.

* Add tests and changelog.

(cherry picked from commit e6c1950)

Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
blakerouse added a commit that referenced this pull request Mar 15, 2022
…id (#30281) (#30498)

* Fix composed.Verifier.

* Add tests and changelog.

(cherry picked from commit e6c1950)

Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-skip Skip notification from the automated backport with mergify backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Elastic Agent] Composed Verifier does not always remove files
4 participants