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 merging of fleet.yml. Add --staging to enroll cmd. #20026

Merged
merged 4 commits into from
Jul 17, 2020

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Jul 17, 2020

What does this PR do?

Fixes an issue where the elastic-agent.yml and fleet.yml configurations where being merged, but the merged config was not being used in the Unpack call.

Adds a --staging f32a4a89 option to ./elastic-agent enroll. This allows users that are testing staging builds to be able to pull artifacts from that staging build.

Why is it important?

So elastic-agent.yml and fleet.yml are merged and used correctly. To simplify testing of staging builds.

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

 ./elastic_agent enroll --insecure http://localhost:5601 Q1JfZVhITUJsUURwelBhQVB2WVQ6NmlFSVNwZVVSU0tlcVI5dXZNNUtFZw --staging f32a4a89

Related issues

@blakerouse blakerouse self-assigned this Jul 17, 2020
@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 Jul 17, 2020
@blakerouse blakerouse marked this pull request as ready for review July 17, 2020 13:42
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

LGTM


cfg, err := configuration.NewFromConfig(config)
cfg, err := configuration.NewFromConfig(rawConfig)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a good catch

@@ -67,6 +68,13 @@ func enroll(streams *cli.IOStreams, cmd *cobra.Command, flags *globalFlags, args
errors.M(errors.MetaKeyPath, pathConfigFile))
}

staging, _ := cmd.Flags().GetString("staging")
if staging != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

could be a single line if

@EricDavisX
Copy link
Contributor

@blakerouse this is great! can you elaborate for the sake of over communicating on this:
./elastic_agent enroll --insecure http://localhost:5601 Q1JfZVhITUJsUURwelBhQVB2WVQ6NmlFSVNwZVVSU0tlcVI5dXZNNUtFZw --staging f32a4a89

where does the f32a4a89 come from... I assume this is a hash of the build artifacts, like this:
pulling '33ee764c' from https://staging.elastic.co/7.9.0-33ee764c/summary-7.9.0.html

@blakerouse
Copy link
Contributor Author

@EricDavisX Correct, it comes from the HTML page of the build.

@EricDavisX
Copy link
Contributor

thanks. this is so great!

@EricDavisX
Copy link
Contributor

EricDavisX commented Jul 17, 2020

@blakerouse Also, does this PR fix the problem of Linux Agent not ‘finding’ Endpoint even when its on disk (manually copied there with the SHA 512 file)? Not sure if we need a new bug or not.
centos7-tar-gz-agent-endpoint-integration-problem

linux-file-for-endpoint-exist-but-not-found

@blakerouse blakerouse merged commit cfbd81b into elastic:master Jul 17, 2020
@blakerouse blakerouse deleted the agent-enroll-cmd-staging branch July 17, 2020 15:57
blakerouse added a commit to blakerouse/beats that referenced this pull request Jul 17, 2020
elastic#20026)

* Fix usage of merged elastic-agent.yml and fleet.yml. Add --staging command line option to enroll.

* Add to docs.

* Add changelog.

* Fix import sorting.

(cherry picked from commit cfbd81b)
blakerouse added a commit to blakerouse/beats that referenced this pull request Jul 17, 2020
elastic#20026)

* Fix usage of merged elastic-agent.yml and fleet.yml. Add --staging command line option to enroll.

* Add to docs.

* Add changelog.

* Fix import sorting.

(cherry picked from commit cfbd81b)
@EricDavisX
Copy link
Contributor

FYI - we found the bug on my side and it was a personal script problem, not in the code - yay. we're good to go!

blakerouse added a commit that referenced this pull request Jul 17, 2020
#20026) (#20032)

* Fix usage of merged elastic-agent.yml and fleet.yml. Add --staging command line option to enroll.

* Add to docs.

* Add changelog.

* Fix import sorting.

(cherry picked from commit cfbd81b)
blakerouse added a commit that referenced this pull request Jul 17, 2020
#20026) (#20031)

* Fix usage of merged elastic-agent.yml and fleet.yml. Add --staging command line option to enroll.

* Add to docs.

* Add changelog.

* Fix import sorting.

(cherry picked from commit cfbd81b)
v1v added a commit to v1v/beats that referenced this pull request Jul 20, 2020
…ngs-archive

* upstream/master: (274 commits)
  Test export commands in all Beats (elastic#20016)
  [Ingest Manager] Allow using drop path for agent build (elastic#20019)
  [DOCS] Remove include for deleted file in monitoring docs (elastic#20038)
  Removing xpack.monitoring.* settings (elastic#18608)
  [Heartbeat] Add service_name option for APM integration (elastic#19932)
  [Elastic Agent] Fix merging of fleet.yml. Add --staging to enroll cmd. (elastic#20026)
  Stricter stalebot configuration for PRs (elastic#20004)
  [ci] Favor direct mage invocation on CI (elastic#19960)
  Add cloudwatch input into Filebeat configure inputs documentation (elastic#19973)
  [Filebeat] remove delimiter \n from log line in s3 input (elastic#19972)
  [Metricbeat] Update MySQL dashboard (elastic#19913)
  Packetbeat process monitor: Ignore missing /proc/net/tcp6 (elastic#19945)
  [CI] fix MODULE variable cornercases (elastic#19985)
  Ignore timestamp in fortinet/clientendpoint and netscout/sightline (elastic#19998)
  add 7.9 to .backportrc.json (elastic#19952)
  Update internal links to external (elastic#19947)
  Remove Dynamic Script Compilations warning in Cisco module (elastic#19840)
  [Elastic Agent] Fix RPM and DEB packaging for Elastic Agent (elastic#19959)
  [Ingest Manager] Do not compare err with custom type (elastic#19980)
  Fix nanocore sum for non default intervals on Kubernetes Overview Dashboard (elastic#19675)
  ...
v1v added a commit to v1v/beats that referenced this pull request Jul 20, 2020
…nly-mod

* upstream/master: (75 commits)
  Test export commands in all Beats (elastic#20016)
  [Ingest Manager] Allow using drop path for agent build (elastic#20019)
  [DOCS] Remove include for deleted file in monitoring docs (elastic#20038)
  Removing xpack.monitoring.* settings (elastic#18608)
  [Heartbeat] Add service_name option for APM integration (elastic#19932)
  [Elastic Agent] Fix merging of fleet.yml. Add --staging to enroll cmd. (elastic#20026)
  Stricter stalebot configuration for PRs (elastic#20004)
  [ci] Favor direct mage invocation on CI (elastic#19960)
  Add cloudwatch input into Filebeat configure inputs documentation (elastic#19973)
  [Filebeat] remove delimiter \n from log line in s3 input (elastic#19972)
  [Metricbeat] Update MySQL dashboard (elastic#19913)
  Packetbeat process monitor: Ignore missing /proc/net/tcp6 (elastic#19945)
  [CI] fix MODULE variable cornercases (elastic#19985)
  Ignore timestamp in fortinet/clientendpoint and netscout/sightline (elastic#19998)
  add 7.9 to .backportrc.json (elastic#19952)
  Update internal links to external (elastic#19947)
  Remove Dynamic Script Compilations warning in Cisco module (elastic#19840)
  [Elastic Agent] Fix RPM and DEB packaging for Elastic Agent (elastic#19959)
  [Ingest Manager] Do not compare err with custom type (elastic#19980)
  Fix nanocore sum for non default intervals on Kubernetes Overview Dashboard (elastic#19675)
  ...
@EricDavisX
Copy link
Contributor

note - this works great, tested with BC3 - we're in business!

melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
elastic#20026)

* Fix usage of merged elastic-agent.yml and fleet.yml. Add --staging command line option to enroll.

* Add to docs.

* Add changelog.

* Fix import sorting.
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
elastic#20026) (elastic#20032)

* Fix usage of merged elastic-agent.yml and fleet.yml. Add --staging command line option to enroll.

* Add to docs.

* Add changelog.

* Fix import sorting.

(cherry picked from commit c84dd9e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants