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" "time"
"github.com/magefile/mage/mg" "github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
devtools "github.com/elastic/beats/v7/dev-tools/mage" 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/build"
"github.com/elastic/beats/v7/dev-tools/mage/target/common" "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/pkg"
"github.com/elastic/beats/v7/dev-tools/mage/target/unittest" "github.com/elastic/beats/v7/dev-tools/mage/target/unittest"
"github.com/elastic/beats/v7/dev-tools/mage/target/update"
) )
func init() { func init() {
devtools.SetBuildVariableSources(devtools.DefaultBeatBuildVariableSources) devtools.SetBuildVariableSources(devtools.DefaultBeatBuildVariableSources)
devtools.BeatDescription = "Icingabeat fetches data from the Icinga 2 API and forwards it to Elasticsearch or Logstash." 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.BeatProjectType = devtools.CommunityProject
devtools.CrossBuildMountModcache = true devtools.CrossBuildMountModcache = true
} }
@ -34,14 +34,14 @@ func Package() {
devtools.UseCommunityBeatPackaging() devtools.UseCommunityBeatPackaging()
mg.Deps(update.Update) mg.Deps(Update)
mg.Deps(build.CrossBuild, build.CrossBuildGoDaemon) mg.Deps(build.CrossBuild, build.CrossBuildGoDaemon)
mg.SerialDeps(devtools.Package, pkg.PackageTest) mg.SerialDeps(devtools.Package, pkg.PackageTest)
} }
// Config generates both the short/reference/docker configs. // Update updates the generated files (aka make update).
func Config() error { func Update() error {
return devtools.Config(devtools.AllConfigTypes, devtools.ConfigFileParams{}, ".") return sh.Run("make", "update")
} }
// Fields generates a fields.yml for the Beat. // Fields generates a fields.yml for the Beat.
@ -49,6 +49,13 @@ func Fields() error {
return devtools.GenerateFieldsYAML() 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. // Clean cleans all generated files and build artifacts.
func Clean() error { func Clean() error {
return devtools.Clean() return devtools.Clean()