Update magefile

This commit is contained in:
Blerim Sheqa 2021-09-23 12:16:35 +02:00
parent cbeed36768
commit 158b0d684e
1 changed files with 14 additions and 7 deletions

View File

@ -7,20 +7,20 @@ import (
"time"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
devtools "github.com/elastic/beats/v7/dev-tools/mage"
"github.com/elastic/beats/v7/dev-tools/mage/target/build"
"github.com/elastic/beats/v7/dev-tools/mage/target/common"
"github.com/elastic/beats/v7/dev-tools/mage/target/pkg"
"github.com/elastic/beats/v7/dev-tools/mage/target/unittest"
"github.com/elastic/beats/v7/dev-tools/mage/target/update"
)
func init() {
devtools.SetBuildVariableSources(devtools.DefaultBeatBuildVariableSources)
devtools.BeatDescription = "Icingabeat fetches data from the Icinga 2 API and forwards it to Elasticsearch or Logstash."
devtools.BeatVendor = "{full_name}"
devtools.BeatVendor = "Icinga GmbH"
devtools.BeatProjectType = devtools.CommunityProject
devtools.CrossBuildMountModcache = true
}
@ -34,21 +34,28 @@ func Package() {
devtools.UseCommunityBeatPackaging()
mg.Deps(update.Update)
mg.Deps(Update)
mg.Deps(build.CrossBuild, build.CrossBuildGoDaemon)
mg.SerialDeps(devtools.Package, pkg.PackageTest)
}
// Config generates both the short/reference/docker configs.
func Config() error {
return devtools.Config(devtools.AllConfigTypes, devtools.ConfigFileParams{}, ".")
// Update updates the generated files (aka make update).
func Update() error {
return sh.Run("make", "update")
}
//Fields generates a fields.yml for the Beat.
// Fields generates a fields.yml for the Beat.
func Fields() error {
return devtools.GenerateFieldsYAML()
}
// Config generates both the short/reference/docker configs.
func Config() error {
p := devtools.DefaultConfigFileParams()
p.Templates = append(p.Templates, "_meta/config/*.tmpl")
return devtools.Config(devtools.AllConfigTypes, p, ".")
}
// Clean cleans all generated files and build artifacts.
func Clean() error {
return devtools.Clean()