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

Improve version checking for 8.0.0-alpha1 #610

Merged
merged 2 commits into from
Aug 2, 2021

Conversation

blakerouse
Copy link
Contributor

What does this PR do?

This updates the user-agent version checking to remove anything after the version - and ignores it.

Why is it important?

8.0.0-alpha1 is a testing release of the stack and this causes issue with the version constraint checks in Fleet Server.

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

Related issues

@blakerouse blakerouse added Team:Elastic-Agent Label for the Agent team v7.15.0 labels Aug 2, 2021
@blakerouse blakerouse self-assigned this Aug 2, 2021
@elasticmachine
Copy link
Contributor

elasticmachine commented Aug 2, 2021

💚 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: 2021-08-02T18:31:18.851+0000

  • Duration: 8 min 46 sec

  • Commit: 92285c1

Test stats 🧪

Test Results
Failed 0
Passed 206
Skipped 0
Total 206

Trends 🧪

Image of Build Times

Image of Tests

@@ -66,8 +66,8 @@ func validateUserAgent(r *http.Request, verConst version.Constraints) error {
if !strings.HasPrefix(userAgent, userAgentPrefix) {
return ErrInvalidUserAgent
}
verStr := strings.TrimSpace(strings.TrimSuffix(strings.TrimPrefix(userAgent, userAgentPrefix), "-snapshot"))
ver, err := version.NewVersion(verStr)
verSep := strings.Split(strings.TrimPrefix(userAgent, userAgentPrefix), "-")

Choose a reason for hiding this comment

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

Is ok for now. Prefer to see this logic centralized and better commented.
@aleksmaus has a PR that conflicts so can be fixed up then.

@EricDavisX
Copy link
Contributor

Thanks for reviewing Sean. As approved, I'm pushing this in since it prevents Fleet usage in 8.0 - we'll see if we rebuild the 8.0 Alpha BC or not.

@EricDavisX EricDavisX merged commit 4b6f72d into elastic:master Aug 2, 2021
mergify bot added a commit that referenced this pull request Aug 2, 2021
* Improve version checking.

(cherry picked from commit f99312d)

* Fix alpha check on elasticsearch version.

(cherry picked from commit 92285c1)

Co-authored-by: Blake Rouse <[email protected]>
@blakerouse blakerouse deleted the fix-8-alpha-check branch August 3, 2021 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent Label for the Agent team v7.15.0
Projects
None yet
4 participants