Skip to content

Commit

Permalink
Add new global flag to skip artifact upload
Browse files Browse the repository at this point in the history
  • Loading branch information
peti2001 committed Jan 13, 2022
1 parent 2137a02 commit 8a203cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
Seeds: *RootConfig.Seeds,
ShowProgressBar: !*RootConfig.Headless,
SkipLibraries: *RootConfig.SkipLibraries,
SkipUpload: *RootConfig.SkipUpload,
}
err := repoSource.ExtractFromSource(source, config)

Expand Down
1 change: 1 addition & 0 deletions cmd/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var (
Seeds: *RootConfig.Seeds,
ShowProgressBar: !*RootConfig.Headless,
SkipLibraries: *RootConfig.SkipLibraries,
SkipUpload: *RootConfig.SkipUpload,
}
err := repoSource.ExtractFromSource(source, config)

Expand Down
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type rootConfig struct {
OutPutPath *string
Obfuscate *bool
Headless *bool
SkipUpload *bool
}

var (
Expand Down Expand Up @@ -53,6 +54,7 @@ func init() {
RootConfig.OutPutPath = rootCmd.PersistentFlags().String("output_path", "./artifacts", "Where to put output file. Existing artifacts will be overwritten.")
RootConfig.Obfuscate = rootCmd.PersistentFlags().Bool("obfuscate", true, "File names and emails won't be hashed. Set it to true for debug purposes.")
RootConfig.Headless = rootCmd.PersistentFlags().Bool("headless", false, "Headless mode is used on CodersRank's backend system.")
RootConfig.SkipUpload = rootCmd.PersistentFlags().Bool("skip_upload", false, "Artifacts won't be uploaded. Don't even ask whether to upload the artifacts.")
}

func initConfig() {
Expand Down
7 changes: 5 additions & 2 deletions repoSources/repoSource.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type ExtractConfig struct {
Seeds []string
ShowProgressBar bool // Show progress bar only if running in interactive mode
SkipLibraries bool
SkipUpload bool // If this is true the artifacts won't be uploaded
}

// RepoSource describes the interface that each provider has to implement
Expand Down Expand Up @@ -69,8 +70,10 @@ func ExtractFromSource(source RepoSource, config ExtractConfig) error {

}

artifactUploader := NewArtifactUploader(config.OutputPath)
artifactUploader.UploadRepos(repos)
if !config.SkipUpload {
artifactUploader := NewArtifactUploader(config.OutputPath)
artifactUploader.UploadRepos(repos)
}

source.CleanUp()

Expand Down

0 comments on commit 8a203cc

Please sign in to comment.