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

[generators] Generator assume global git config is setup #17787

Closed
andrewkroh opened this issue Apr 17, 2020 · 3 comments
Closed

[generators] Generator assume global git config is setup #17787

andrewkroh opened this issue Apr 17, 2020 · 3 comments
Labels
bug :Generator Related to code generators for building custom Beats or modules. needs_team Indicates that the issue/PR needs a Team:* label Stalled

Comments

@andrewkroh
Copy link
Member

The beat generator assumes that the global git config is setup when adding files to the newly created git repo. e.g it assumes that someone has done

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

The variables need to be set before the generator runs git add. So the generator should check if they are set. If they are not set then it can use data provided by the user creating the beat to set them on a non-global (repo level) basis. Or it could set the appropriate environment variables to pass the name and email to Git (see https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables).

The generator tests can fail because of this issue. It does run these commands, but too late.

git config user.email "[email protected]" || exit 1 ; \
git config user.name "beats-jenkins" || exit 1 ; \

These values need to be set after the repo is git init'ed and before git add, but it really can't as written since it's hard-coded to assume that the global git config is setup.

mg.Deps(setup.GitInit)
if cfg["type"] == "metricbeat" {
//This is runV because it'll ask for user input, so we need stdout.
err = sh.RunV("make", "create-metricset")
if err != nil {
return errors.Wrap(err, "error running create-metricset")
}
}
mg.Deps(setup.Update)
mg.Deps(setup.GitAdd)

@andrewkroh andrewkroh added bug :Generator Related to code generators for building custom Beats or modules. labels Apr 17, 2020
@andrewkroh
Copy link
Member Author

We're putting a work-around into CI to set the global git config. #17782

@botelastic
Copy link

botelastic bot commented Mar 20, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@botelastic botelastic bot added Stalled needs_team Indicates that the issue/PR needs a Team:* label labels Mar 20, 2021
@botelastic
Copy link

botelastic bot commented Mar 20, 2021

This issue doesn't have a Team:<team> label.

@botelastic botelastic bot closed this as completed Apr 19, 2021
@zube zube bot removed the [zube]: Done label Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug :Generator Related to code generators for building custom Beats or modules. needs_team Indicates that the issue/PR needs a Team:* label Stalled
Projects
None yet
Development

No branches or pull requests

2 participants