Skip to content

Commit

Permalink
[CI-2304] Progress indictor output change (#899)
Browse files Browse the repository at this point in the history
* Update dependencies

* Add new progress wrapper

* Update wrapper usage
  • Loading branch information
tothszabi authored Dec 6, 2023
1 parent 92d4629 commit 3cbcaa8
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 18 deletions.
6 changes: 3 additions & 3 deletions bitrise/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

"github.com/bitrise-io/bitrise/log"
"github.com/bitrise-io/bitrise/plugins"
"github.com/bitrise-io/bitrise/progress"
"github.com/bitrise-io/bitrise/tools"
"github.com/bitrise-io/bitrise/utils"
"github.com/bitrise-io/go-utils/colorstring"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/progress"
"github.com/bitrise-io/go-utils/retry"
"github.com/bitrise-io/go-utils/versions"
"github.com/bitrise-io/goinp/goinp"
Expand Down Expand Up @@ -125,7 +125,7 @@ func CheckIsHomebrewInstalled(isFullSetupMode bool) error {
// brew doctor
doctorOutput := ""
var err error
progress.NewDefaultWrapper("brew doctor").WrapAction(func() {
progress.ShowIndicator("brew doctor", func() {
doctorOutput, err = command.RunCommandAndReturnCombinedStdoutAndStderr("brew", "doctor")
})
if err != nil {
Expand Down Expand Up @@ -196,7 +196,7 @@ func checkIsBitriseToolInstalled(toolname, minVersion string, isInstall bool) er

// Install
var err error
progress.NewDefaultWrapper("Installing").WrapAction(func() {
progress.ShowIndicator("Installing", func() {
err = retry.Times(2).Wait(5 * time.Second).Try(func(attempt uint) error {
if attempt > 0 {
log.Warnf("Download failed, retrying ...")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module github.com/bitrise-io/bitrise
go 1.17

require (
github.com/bitrise-io/colorstring v0.0.0-20180614154802-a8cd70115192
github.com/bitrise-io/envman v0.0.0-20221010094751-a03ce30a5316
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.19
github.com/bitrise-io/go-utils v1.0.8
github.com/bitrise-io/go-utils v1.0.11
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19
github.com/bitrise-io/goinp v0.0.0-20211005113137-305e91b481f4
github.com/bitrise-io/gows v0.0.0-20211005113107-14f65e686b88
Expand All @@ -20,7 +21,6 @@ require (
)

require (
github.com/bitrise-io/colorstring v0.0.0-20180614154802-a8cd70115192 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/bitrise-io/go-utils v0.0.0-20200224122728-e212188d99b4/go.mod h1:tTEs
github.com/bitrise-io/go-utils v0.0.0-20210505121718-07411d72e36e/go.mod h1:nhdaDQFvaMny1CugVV6KjK92/q97ENo0RuKSW5I4fbA=
github.com/bitrise-io/go-utils v1.0.1/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
github.com/bitrise-io/go-utils v1.0.3/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
github.com/bitrise-io/go-utils v1.0.8 h1:ekXH6FK5V8UxkyHm2FsQL8yk9Wqd5fjg1NGlD7jK2kc=
github.com/bitrise-io/go-utils v1.0.8/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
github.com/bitrise-io/go-utils v1.0.11 h1:NJ9rRWif4C6nhdh/v6Y/sJZU1UJ+yj0mDgnxsDr71ho=
github.com/bitrise-io/go-utils v1.0.11/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.13/go.mod h1:gZWtM7PLn1VOroa4gN1La/24aRVc0jg5R701jTsPaO8=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19 h1:55as5Iv0N4btuRP3YwRzN+BCMtKO210MnJ8mpxmeI7o=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.19/go.mod h1:Laih4ji980SQkRgdnMCH0g4u2GZI/5nnbqmYT9UfKFQ=
Expand Down
6 changes: 3 additions & 3 deletions plugins/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"

"github.com/bitrise-io/bitrise/log"
"github.com/bitrise-io/bitrise/progress"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-utils/progress"
"github.com/bitrise-io/go-utils/sliceutil"
ver "github.com/hashicorp/go-version"
)
Expand Down Expand Up @@ -169,7 +169,7 @@ func installLocalPlugin(pluginSourceURI, pluginLocalPth string) (Plugin, error)
tmpPluginBinPth := filepath.Join(tmpPluginBinDir, newPlugin.Name)

var err error
progress.NewDefaultWrapper("Downloading plugin binary").WrapAction(func() {
progress.ShowIndicator("Downloading plugin binary", func() {
err = downloadPluginBin(executableURL, tmpPluginBinPth)
})
if err != nil {
Expand Down Expand Up @@ -252,7 +252,7 @@ func InstallPlugin(pluginSourceURI, versionTag string) (Plugin, string, error) {
version := ""
err = nil

progress.NewDefaultWrapper("git clone plugin source").WrapAction(func() {
progress.ShowIndicator("git clone plugin source", func() {
version, err = GitCloneAndCheckoutVersionOrLatestVersion(pluginSrcTmpDir, pluginSourceURI, versionTag)
})

Expand Down
13 changes: 13 additions & 0 deletions progress/progress.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package progress

import (
"github.com/bitrise-io/bitrise/log"
"github.com/bitrise-io/bitrise/log/logwriter"
"github.com/bitrise-io/go-utils/progress"
)

func ShowIndicator(message string, action func()) {
logger := log.NewLogger(log.GetGlobalLoggerOpts())
output := logwriter.NewLogWriter(logger)
progress.NewDefaultWrapperWithOutput(message, output).WrapAction(action)
}
4 changes: 2 additions & 2 deletions toolkits/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"github.com/bitrise-io/bitrise/configs"
"github.com/bitrise-io/bitrise/log"
"github.com/bitrise-io/bitrise/models"
"github.com/bitrise-io/bitrise/progress"
"github.com/bitrise-io/bitrise/tools"
"github.com/bitrise-io/bitrise/utils"
"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/go-utils/progress"
"github.com/bitrise-io/go-utils/retry"
"github.com/bitrise-io/go-utils/versions"
"github.com/bitrise-io/gows/gows"
Expand Down Expand Up @@ -225,7 +225,7 @@ func (toolkit GoToolkit) Install() error {
goArchiveDownloadPath := filepath.Join(goTmpDirPath, localFileName)

var downloadErr error
progress.NewDefaultWrapper("Downloading").WrapAction(func() {
progress.ShowIndicator("Downloading", func() {
downloadErr = retry.Times(2).Wait(5 * time.Second).Try(func(attempt uint) error {
if attempt > 0 {
log.Warnf("==> Download failed, retrying ...")
Expand Down
4 changes: 2 additions & 2 deletions vendor/github.com/bitrise-io/go-utils/command/command.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions vendor/github.com/bitrise-io/go-utils/progress/spinner.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/github.com/bitrise-io/go-utils/progress/wrapper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ github.com/bitrise-io/envman/version
# github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.19
## explicit; go 1.17
github.com/bitrise-io/go-steputils/v2/secretkeys
# github.com/bitrise-io/go-utils v1.0.8
# github.com/bitrise-io/go-utils v1.0.11
## explicit; go 1.13
github.com/bitrise-io/go-utils/colorstring
github.com/bitrise-io/go-utils/command
Expand Down

0 comments on commit 3cbcaa8

Please sign in to comment.