Add force flag to ignore commit check
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
52703cb28f
commit
0ca7c11a23
2 changed files with 5 additions and 2 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AppSettings struct {
|
type AppSettings struct {
|
||||||
|
Force bool
|
||||||
GrafanaURL string
|
GrafanaURL string
|
||||||
GrafanaToken string
|
GrafanaToken string
|
||||||
GitBranch string
|
GitBranch string
|
||||||
|
@ -19,13 +20,14 @@ type AppSettings struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var cliStruct struct {
|
var cliStruct struct {
|
||||||
|
Force bool `name:"force" short:"f" help:"Force git commits / ignore existence check."`
|
||||||
GrafanaURL string `name:"grafana-url" env:"GRAFANA_URL" help:"Grafana URL to access the API"`
|
GrafanaURL string `name:"grafana-url" env:"GRAFANA_URL" help:"Grafana URL to access the API"`
|
||||||
GrafanaToken string `name:"grafana-auth-token" env:"GRAFANA_AUTH_TOKEN" help:"Grafana auth token to access the API"`
|
GrafanaToken string `name:"grafana-auth-token" env:"GRAFANA_AUTH_TOKEN" help:"Grafana auth token to access the API"`
|
||||||
GitBranch string `name:"git-branch" env:"GIT_BRANCH" help:"Git branch name" default:"${default_git_branch}"`
|
GitBranch string `name:"git-branch" env:"GIT_BRANCH" help:"Git branch name" default:"${default_git_branch}"`
|
||||||
GitRepoURL string `name:"git-repo-url" env:"GIT_REPO_URL" help:"Complete Git repository URL"`
|
GitRepoURL string `name:"git-repo-url" env:"GIT_REPO_URL" help:"Complete Git repository URL"`
|
||||||
GitUser string `name:"git-user" env:"GIT_USER" help:"Git username"`
|
GitUser string `name:"git-user" env:"GIT_USER" help:"Git username"`
|
||||||
GitEmail string `name:"git-email" env:"GIT_EMAIL" help:"Git email address"`
|
GitEmail string `name:"git-email" env:"GIT_EMAIL" help:"Git email address"`
|
||||||
GitPass string `name:"git-pass" env:"GIT_PASS" help:"Git password"`
|
GitPass string `name:"git-pass" env:"GIT_PASS" help:"Git user password"`
|
||||||
GPGKey string `name:"signing-key" env:"GIT_SIGNING_KEY" help:"GPG signing key"`
|
GPGKey string `name:"signing-key" env:"GIT_SIGNING_KEY" help:"GPG signing key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +44,7 @@ func Parse() *AppSettings {
|
||||||
|
|
||||||
validateFlags(ctx)
|
validateFlags(ctx)
|
||||||
settings := &AppSettings{
|
settings := &AppSettings{
|
||||||
|
Force: cliStruct.Force,
|
||||||
GrafanaURL: cliStruct.GrafanaURL,
|
GrafanaURL: cliStruct.GrafanaURL,
|
||||||
GrafanaToken: cliStruct.GrafanaToken,
|
GrafanaToken: cliStruct.GrafanaToken,
|
||||||
GitBranch: cliStruct.GitBranch,
|
GitBranch: cliStruct.GitBranch,
|
||||||
|
|
2
main.go
2
main.go
|
@ -52,7 +52,7 @@ func main() {
|
||||||
for _, version := range versions {
|
for _, version := range versions {
|
||||||
gitdata.UpdateVersion(version)
|
gitdata.UpdateVersion(version)
|
||||||
|
|
||||||
if gitdata.IsVersionCommitted(appSettings.GitBranch) {
|
if !appSettings.Force && gitdata.IsVersionCommitted(appSettings.GitBranch) {
|
||||||
fmt.Printf("%s/%s - %s: %s -> already committed\n", dashboardInfo.FolderTitle, dashboard.Title, version.CreatedBy, version.Message)
|
fmt.Printf("%s/%s - %s: %s -> already committed\n", dashboardInfo.FolderTitle, dashboard.Title, version.CreatedBy, version.Message)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue