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

Cherry-pick #18148 to 7.x: Build config files with Go text/template #18212

Merged
merged 3 commits into from
May 5, 2020

Conversation

andrewkroh
Copy link
Member

@andrewkroh andrewkroh commented May 4, 2020

Cherry-pick of PR #18148 to 7.x branch. Original message:

What does this PR do?

Rather than relying on file concatenation followed by Go text/template we'll just
use Go text/template. This makes is easier to customize a template without having
to modify libbeat since you can just overwrite a template section (like inject your own
processors section).

This works by loading all of the templates from libbeat/_meta/config/*.tmpl followed
by templates from $mybeat/_meta/config/*.tmpl. Files loaded last take precedence
(it uses go text/template ParseGlob). Finally each template is created from
libbeat/_meta/config/default{., reference, docker}.yml.tmpl (which can be changed
if needed, see elastic-agent as an example).

Why is it important?

I need to customize the default processors in the Winlogbeat configuration file and I don't want to add some special logic to the libbeat config files (see an example in https://github.com/elastic/beats/pull/18153/files#diff-5a4f08fe070667029d82636401b2aaf9R95). So with this change a Beat can more easily tailor the config to its needs.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [x] 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.

Author's Checklist

  • Review the generate config files. The only changes should be spacing and headings.

How to test this PR locally

make update

@andrewkroh andrewkroh requested review from a team as code owners May 4, 2020 22:16
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2020
Rather than relying on file concatenation followed by Go text/template we'll just
use Go text/template. This makes is easier to customize a template without having
to modify libbeat since you can just overwrite a template section (like inject your own
processors section).

This works by loading all of the templates from `libbeat/_meta/config/*.tmpl` followed
by templates from `$mybeat/_meta/config/*.tmpl`. Files loaded last take precedence
(it uses go text/template ParseGlob). Finally each template is created from
`libbeat/_meta/config/default{., reference, docker}.yml.tmpl` (which can be changed
if needed, see elastic/agent).

(cherry picked from commit c81adcc)
@andrewkroh andrewkroh requested a review from kvch May 4, 2020 22:19
@andrewkroh andrewkroh added Team:SIEM and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 4, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

@elasticmachine
Copy link
Collaborator

elasticmachine commented May 4, 2020

💔 Build Failed

Pipeline View Test View Changes Artifacts preview stats

Expand to view the summary

Build stats

Steps errors

Expand to view the steps failures

  • Name: Make check
    • Description: make check

    • Result: FAILURE

    • Duration: 10 min 5 sec<

    • Start Time: 2020-05-05T14:49:29.886+0000

Log output

Expand to view the last 100 lines of log output

[2020-05-05T14:59:38.289Z] Stage "Packetbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.290Z] Stage "dockerlogbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.291Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.291Z] Stage "Winlogbeat Windows x-pack" skipped due to earlier failure(s)
[2020-05-05T14:59:38.292Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.293Z] Stage "Journalbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.294Z] Stage "Generators" skipped due to earlier failure(s)
[2020-05-05T14:59:38.294Z] Stage "Kubernetes" skipped due to earlier failure(s)
[2020-05-05T14:59:38.399Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.400Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-05-05T14:59:38.401Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.402Z] Stage "Metricbeat x-pack" skipped due to earlier failure(s)
[2020-05-05T14:59:38.403Z] Stage "Packetbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.404Z] Stage "dockerlogbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.405Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.405Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.406Z] Stage "Journalbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.407Z] Stage "Generators" skipped due to earlier failure(s)
[2020-05-05T14:59:38.654Z] Failed in branch Elastic Agent x-pack
[2020-05-05T14:59:38.655Z] Failed in branch Elastic Agent x-pack Windows
[2020-05-05T14:59:38.655Z] Failed in branch Elastic Agent Mac OS X
[2020-05-05T14:59:38.656Z] Failed in branch Filebeat oss
[2020-05-05T14:59:38.657Z] Failed in branch Filebeat x-pack
[2020-05-05T14:59:38.657Z] Failed in branch Filebeat Mac OS X
[2020-05-05T14:59:38.658Z] Failed in branch Filebeat Windows
[2020-05-05T14:59:38.658Z] Failed in branch Auditbeat x-pack
[2020-05-05T14:59:38.659Z] Failed in branch Libbeat x-pack
[2020-05-05T14:59:38.659Z] Failed in branch Metricbeat OSS Unit tests
[2020-05-05T14:59:38.660Z] Failed in branch Metricbeat OSS Integration tests
[2020-05-05T14:59:38.661Z] Failed in branch Metricbeat Python integration tests
[2020-05-05T14:59:38.661Z] Failed in branch Metricbeat crosscompile
[2020-05-05T14:59:38.662Z] Failed in branch Metricbeat Mac OS X
[2020-05-05T14:59:38.662Z] Failed in branch Metricbeat Windows
[2020-05-05T14:59:38.663Z] Failed in branch Winlogbeat Windows x-pack
[2020-05-05T14:59:38.663Z] Failed in branch Kubernetes
[2020-05-05T14:59:38.916Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.918Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-05-05T14:59:38.919Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.919Z] Stage "Metricbeat x-pack" skipped due to earlier failure(s)
[2020-05-05T14:59:38.920Z] Stage "Winlogbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.921Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:38.922Z] Stage "Generators" skipped due to earlier failure(s)
[2020-05-05T14:59:38.970Z] Failed in branch Packetbeat
[2020-05-05T14:59:38.971Z] Failed in branch dockerlogbeat
[2020-05-05T14:59:38.971Z] Failed in branch Journalbeat
[2020-05-05T14:59:39.165Z] Stage "Heartbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:39.167Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-05-05T14:59:39.168Z] Stage "Libbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:39.169Z] Stage "Functionbeat" skipped due to earlier failure(s)
[2020-05-05T14:59:39.170Z] Stage "Generators" skipped due to earlier failure(s)
[2020-05-05T14:59:39.199Z] Failed in branch Metricbeat x-pack
[2020-05-05T14:59:39.200Z] Failed in branch Winlogbeat
[2020-05-05T14:59:39.382Z] Failed in branch Heartbeat
[2020-05-05T14:59:39.383Z] Failed in branch Libbeat
[2020-05-05T14:59:39.383Z] Failed in branch Functionbeat
[2020-05-05T14:59:39.384Z] Stage "Auditbeat oss" skipped due to earlier failure(s)
[2020-05-05T14:59:39.385Z] Stage "Generators" skipped due to earlier failure(s)
[2020-05-05T14:59:39.475Z] Failed in branch Auditbeat oss
[2020-05-05T14:59:39.476Z] Failed in branch Generators
[2020-05-05T14:59:39.581Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18212/src/github.com/elastic/beats
[2020-05-05T14:59:39.886Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-05-05T14:59:39.899Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18212/src/github.com/elastic/beats/Lint
[2020-05-05T14:59:40.251Z] + cat
[2020-05-05T14:59:40.251Z] + /usr/local/bin/runbld ./runbld-script
[2020-05-05T14:59:40.251Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-05-05T14:59:46.828Z] runbld>>> runbld started
[2020-05-05T14:59:46.828Z] runbld>>> 1.6.11/a66728ff8f4356963772e6e6d2069392fa06acbe
[2020-05-05T14:59:48.212Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-18212' in order of occurrence in the config (last value wins).
[2020-05-05T14:59:49.587Z] runbld>>> Debug logging enabled.
[2020-05-05T14:59:49.587Z] runbld>>> Storing result
[2020-05-05T14:59:49.587Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-05-05T14:59:49.587Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200505145949-BCCCC3FF
[2020-05-05T14:59:49.587Z] runbld>>> Adding system facts.
[2020-05-05T14:59:50.524Z] runbld>>> Adding vcs info for the latest commit:  45cf933acf0f9387212e777a61158a8ffc261267
[2020-05-05T14:59:50.524Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-05-05T14:59:50.524Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-05-05T14:59:50.524Z] + echo 'Processing JUnit reports with runbld...'
[2020-05-05T14:59:50.524Z] Processing JUnit reports with runbld...
[2020-05-05T14:59:51.092Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-05-05T14:59:51.092Z] runbld>>> DURATION: 8ms
[2020-05-05T14:59:51.092Z] runbld>>> STDOUT: 40 bytes
[2020-05-05T14:59:51.092Z] runbld>>> STDERR: 49 bytes
[2020-05-05T14:59:51.092Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-05-05T14:59:51.092Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18212/src/github.com/elastic/beats
[2020-05-05T14:59:52.031Z] runbld>>> Storing build metadata: 
[2020-05-05T14:59:52.031Z] runbld>>> Adding test report.
[2020-05-05T14:59:52.031Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18212/src/github.com/elastic/beats
[2020-05-05T14:59:52.968Z] runbld>>> Found 0 test output files
[2020-05-05T14:59:52.968Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 0 Skipped: 0
[2020-05-05T14:59:52.968Z] runbld>>> Storing result
[2020-05-05T14:59:53.227Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-05-05T14:59:53.227Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200505145949-BCCCC3FF
[2020-05-05T14:59:53.227Z] runbld>>> Email notification disabled by environment variable.
[2020-05-05T14:59:53.227Z] runbld>>> Slack notification disabled by environment variable.
[2020-05-05T14:59:59.027Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18212
[2020-05-05T14:59:59.187Z] [INFO] getVaultSecret: Getting secrets
[2020-05-05T14:59:59.262Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-05-05T14:59:59.933Z] + chmod 755 generate-build-data.sh
[2020-05-05T14:59:59.933Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18212/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18212/runs/5 FAILURE 1429527
[2020-05-05T15:00:00.484Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18212/runs/5/steps/?limit=10000 -o steps-info.json

@andrewkroh
Copy link
Member Author

run tests

@andrewkroh
Copy link
Member Author

run tests

@andrewkroh andrewkroh merged commit f27cd94 into elastic:7.x May 5, 2020
@andrewkroh andrewkroh deleted the backport_18148_7.x branch January 14, 2022 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants