-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Packetbeat's magefile.go (#9662)
Enhance Packetbeat's magefile.go to be responsible for all aspects of the `update` target (fields.yml, fields.go, config, include/list.go, and field docs). This introduces a fields.go file for each protocol in Packetbeat. The include/fields.go file contains the libbeat fields and the common fields from Packetbeat.
- Loading branch information
1 parent
2a859fb
commit eb1739e
Showing
32 changed files
with
1,104 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package mage | ||
|
||
import ( | ||
"log" | ||
"path/filepath" | ||
|
||
"github.com/magefile/mage/sh" | ||
) | ||
|
||
type docsBuilder struct{} | ||
|
||
// Docs holds the utilities for building documentation. | ||
var Docs = docsBuilder{} | ||
|
||
// FieldDocs generates docs/fields.asciidoc from the specified fields.yml file. | ||
func (b docsBuilder) FieldDocs(fieldsYML string) error { | ||
// Run the docs_collector.py script. | ||
ve, err := PythonVirtualenv() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
python, err := LookVirtualenvPath(ve, "python") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
esBeats, err := ElasticBeatsDir() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
log.Println(">> Generating docs/fields.asciidoc for", BeatName) | ||
return sh.Run(python, LibbeatDir("scripts/generate_fields_docs.py"), | ||
filepath.Dir(fieldsYML), // Path to dir containing fields.yml. | ||
BeatName, // Beat title. | ||
esBeats, // Path to general beats folder. | ||
"--output_path", OSSBeatDir()) // It writes to {output_path}/docs/fields.asciidoc. | ||
} |
Oops, something went wrong.