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

Update metricbeat to use mage for all scenarios along with Makefile shim #17799

Merged
merged 15 commits into from
Apr 23, 2020

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Apr 17, 2020

What does this PR do?

Update's metricbeat to use mage for all scenarios and replace Makefile with the mage Makefile shim.

Why is it important?

While working on #17656 I ran into issues with running the integration tests because the current Makefile would override the usage of docker-compose instead of using the logic that was already in the mage work.

This ensures that the same logic is used for x-pack/metricbeat and metricbeat.

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.

How to test this PR locally

cd metricbeat && mage update build test

@blakerouse blakerouse added enhancement Team:Services (Deprecated) Label for the former Integrations-Services team Team:Platforms Label for the Integrations - Platforms team labels Apr 17, 2020
@blakerouse blakerouse requested a review from a team as a code owner April 17, 2020 16:23
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@blakerouse
Copy link
Contributor Author

@andrewkroh This is probably of interest to you.

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.

I love this change, I have added some comments by now, I will try it also locally before approving.

Let's wait to have some greener builds too. Some failures in CI are fixed in master.

dev-tools/make/mage.mk Show resolved Hide resolved
metricbeat/tests/system/test_base.py Outdated Show resolved Hide resolved
metricbeat/Makefile Show resolved Hide resolved
metricbeat/Makefile Show resolved Hide resolved
metricbeat/magefile.go Show resolved Hide resolved
@blakerouse
Copy link
Contributor Author

@jsoriano I added the create-metricset back into the Makefile that calls mage createMetricset so the python environment can be setup correctly without have to use the old python-env.

I rebased with master, so hopefully it will go all green.

@jsoriano
Copy link
Member

run beats-ci/package

@blakerouse
Copy link
Contributor Author

run beats-ci/package

@blakerouse
Copy link
Contributor Author

@jsoriano Been trying since yesterday to get all green, no matter what there always seems to be something random. At least this time Travis passed completely.

The filebeat tests are un-related to any changes here.

Build and Test / Filebeat Mac OS X / test_crawler.Test.test_file_disappear
Build and Test / Filebeat Mac OS X / test_registrar.Test.test_clean_removed_with_clean_inactive
Build and Test / Filebeat Mac OS X / test_registrar.Test.test_registrar_files
Build and Test / Filebeat Mac OS X / test_registrar.Test.test_rotating_file_with_restart
Build and Test / Filebeat Mac OS X / test_registrar_upgrade.Test.test_upgrade_from_6_3_1
Build and Test / Filebeat Mac OS X / test_registrar_upgrade.Test.test_upgrade_from_faulty_6_3_1
Build and Test / Filebeat Mac OS X / test_registrar_upgrade.Test.test_upgrade_from_latest

@blakerouse
Copy link
Contributor Author

run beats-ci/package

@jsoriano
Copy link
Member

CI looks good, yes, I don't think the failures in OSX are related to this change.

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.

It LGTM, but I would like to see a second opinion. @andrewkroh could you take a quick look in case we are missing something? 😇

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

Nice improvements. Let some comments and questions. Nothing major.

Jenkinsfile Outdated Show resolved Hide resolved

.PHONY: unit-tests
unit-tests: mage
mage update unitTest
Copy link
Member

Choose a reason for hiding this comment

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

Since this is a new target, I don't think update should be required. The unitTest targets should have the appropriate dependencies wired up already. In most cases I think they do now, like requiring the Fields before running the python 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.

The diff is wierd, because this is actually just xpack.mk that was renamed to mage.mk because now its not only x-pack projects that use the file.

I will remove it but it does affect, all x-pack projects. Hopefully those do the correct thing.

@-mage -clean
endif
@true
# This is a minimal Makefile for Beats that are built with Mage. Its only
Copy link
Member

Choose a reason for hiding this comment

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

Why are you adding new targets to the file as opposed to directly invoking mage from Travis without any shim? Is it because the Travis file isn't setup to do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goes with my comment above. This is really just xpack.mk renamed to mage.mk. These targets are the same targets shared with the other x-pack beats. The travis file does use these a lot.

If we want to remove the use of a Makefile shim completely, then I think we should move that to a different PR. This is currently trying to make metricbeat just like x-pack/metricbeat.

Copy link
Member

Choose a reason for hiding this comment

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

The reason I asked was that unit-tests and system-tests were not in the former xpack.mk. But I see that this file is now being used to shim targets used from metricbeat/Makefile. So no problem. We'll be able to remove this shim makefile soon.

dev-tools/make/mage.mk Outdated Show resolved Hide resolved

# Collects all module configs
.PHONY: configs
configs: python-env
Copy link
Member

Choose a reason for hiding this comment

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

Yay. 👏

metricbeat/magefile.go Outdated Show resolved Hide resolved
metricbeat/magefile.go Outdated Show resolved Hide resolved
metricbeat/magefile.go Outdated Show resolved Hide resolved
@blakerouse
Copy link
Contributor Author

@andrewkroh Ready for another look.

@andrewkroh
Copy link
Member

andrewkroh commented Apr 22, 2020

This is an issue in the generator tests w.r.t. the dashboards target.

https://beats-ci.elastic.co/blue/organizations/jenkins/Beats%2Fbeats-beats-mbp/detail/PR-17799/12/pipeline#step-1156-log-277

It might be something I broke.

@blakerouse
Copy link
Contributor Author

@andrewkroh I fixed the generator test, the other failures are unrelated to my change.

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM.

@blakerouse blakerouse merged commit 8786d05 into elastic:master Apr 23, 2020
@blakerouse blakerouse deleted the metricbeat-mage branch April 23, 2020 18:09
blakerouse added a commit to blakerouse/beats that referenced this pull request Apr 28, 2020
…him (elastic#17799)

* Update metricbeat to use mage and the mage make targets.

* Run update and fmt.

* Remove assets.go as its no longer used.

* Split apart the metricbeat tests in travis into multiple jobs to take less time and not run over the timeline.

* Add back in create-metricset with mage.

* Re-add test_xpack_base.py.

* Add kafka to requirements.txt.

* Fix kafka to work with python 3.7.

* Remove the extra kafka-python from rebase on master.

* Fix issues from code review.

* Add back in comment from merge.

* Fix comment spacing.

* Fix update target in generate metricbeat.

* Update magefile in metricbeat generator.

* Run fmt and update.

(cherry picked from commit 8786d05)
blakerouse added a commit that referenced this pull request Apr 28, 2020
…arios along with Makefile shim (#17951)

* Update metricbeat to use mage for all scenarios along with Makefile shim (#17799)

* Update metricbeat to use mage and the mage make targets.

* Run update and fmt.

* Remove assets.go as its no longer used.

* Split apart the metricbeat tests in travis into multiple jobs to take less time and not run over the timeline.

* Add back in create-metricset with mage.

* Re-add test_xpack_base.py.

* Add kafka to requirements.txt.

* Fix kafka to work with python 3.7.

* Remove the extra kafka-python from rebase on master.

* Fix issues from code review.

* Add back in comment from merge.

* Fix comment spacing.

* Fix update target in generate metricbeat.

* Update magefile in metricbeat generator.

* Run fmt and update.

(cherry picked from commit 8786d05)

* Fix merge issue.

* Run fmt and update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Team:Platforms Label for the Integrations - Platforms team Team:Services (Deprecated) Label for the former Integrations-Services team v7.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants