Skip to content

Commit

Permalink
replace GitRepository flags with the new schema (#3708)
Browse files Browse the repository at this point in the history
  • Loading branch information
waleedhammam authored Dec 11, 2023
1 parent 0ca133e commit bfeadee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
12 changes: 6 additions & 6 deletions pkg/bootstrap/steps/bootstrap_flux.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ func bootstrapFlux(c *Config) error {
out, err = runner.Run("flux",
"bootstrap",
"git",
"--url", c.RepoURL,
"--branch", c.Branch,
"--path", c.RepoPath,
"--url", c.GitRepository.Url,
"--branch", c.GitRepository.Branch,
"--path", c.GitRepository.Path,
"--private-key-file", c.PrivateKeyPath,
"--password", c.PrivateKeyPassword,
"-s",
Expand All @@ -150,9 +150,9 @@ func bootstrapFlux(c *Config) error {
out, err = runner.Run("flux",
"bootstrap",
"git",
"--url", c.RepoURL,
"--branch", c.Branch,
"--path", c.RepoPath,
"--url", c.GitRepository.Url,
"--branch", c.GitRepository.Branch,
"--path", c.GitRepository.Path,
"--username", c.GitUsername,
"--password", c.GitToken,
"--token-auth", "true",
Expand Down
6 changes: 3 additions & 3 deletions pkg/bootstrap/steps/bootstrap_flux_repo_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ func TestCreateGitRepositoryConfig(t *testing.T) {
if !tt.wantErr(t, err, "createGitRepositoryConfig") {
return
}
assert.Equal(t, tt.config.RepoURL, config.RepoURL, "wrong repo url")
assert.Equal(t, tt.config.RepoPath, config.RepoPath, "wrong repo path")
assert.Equal(t, tt.config.Branch, config.Branch, "wrong repo branch")
assert.Equal(t, tt.config.GitRepository.Url, config.GitRepository.Url, "wrong repo url")
assert.Equal(t, tt.config.GitRepository.Path, config.GitRepository.Path, "wrong repo path")
assert.Equal(t, tt.config.GitRepository.Branch, config.GitRepository.Branch, "wrong repo branch")
assert.Equal(t, tt.config.GitRepository.Scheme, config.GitRepository.Scheme, "wrong git scheme")
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bootstrap/steps/bootstrap_git_repo_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func createGitRepositoryConfig(input []StepInput, c *Config) ([]StepOutput, erro

var repoURL = c.GitRepository.Url
var repoBranch = c.GitRepository.Branch
var repoPath = c.RepoPath
var repoPath = c.GitRepository.Path

for _, param := range input {
if param.Name == inRepoURL {
Expand Down
9 changes: 0 additions & 9 deletions pkg/bootstrap/steps/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@ type Config struct {

// GitRepository contains the configuration for the git repo
GitRepository GitRepositoryConfig
// Deprecated: use GitRepository.Url instead
RepoURL string
// Deprecated: use GitRepository.Branch instead
Branch string
// Deprecated: use GitRepository.Path instead
RepoPath string

AuthType string
InstallOIDC string
Expand Down Expand Up @@ -252,14 +246,11 @@ func (cb *ConfigBuilder) Build() (Config, error) {
WGEVersion: cb.wgeVersion,
ClusterUserAuth: clusterUserAuthConfig,
GitRepository: gitRepositoryConfig,
Branch: gitRepositoryConfig.Branch,
RepoPath: gitRepositoryConfig.Path,
Logger: cb.logger,
ModesConfig: ModesConfig{
Silent: cb.silent,
Export: cb.export,
},
RepoURL: cb.repoURL,
PrivateKeyPath: cb.privateKeyPath,
PrivateKeyPassword: cb.privateKeyPassword,
GitUsername: cb.gitUsername,
Expand Down

0 comments on commit bfeadee

Please sign in to comment.