Skip to content

Commit

Permalink
Update go steputils (#4)
Browse files Browse the repository at this point in the history
* Update go-steputils

* Update token generation script in E2E tests

* Fix breaking changes

* Rename variable
  • Loading branch information
ofalvai authored Nov 9, 2022
1 parent 4984c14 commit b0a78d9
Show file tree
Hide file tree
Showing 25 changed files with 1,083 additions and 372 deletions.
10 changes: 5 additions & 5 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ workflows:
set -e
json_response=$(curl --fail -X POST https://auth.services.bitrise.io/auth/realms/bitrise-services/protocol/openid-connect/token -k \
--data "client_id=abcs-steps" \
--data "client_id=bitrise-steps" \
--data "client_secret=$CACHE_API_CLIENT_SECRET" \
--data "grant_type=urn:ietf:params:oauth:grant-type:uma-ticket" \
--data "claim_token=eyJhcHBfaWQiOlsiNDhmYThmYmVlNjk4NjIyYyJdLCAiYWNjZXNzX2dyYW50ZWQiOlsidHJ1ZSJdfQ==" \
--data "claim_token=eyJhcHBfaWQiOlsiY2FjaGUtc3RlcHMtdGVzdHMiXSwgIm9yZ19pZCI6WyJ0ZXN0LW9yZy1pZCJdLCAiYWJjc19hY2Nlc3NfZ3JhbnRlZCI6WyJ0cnVlIl19" \
--data "claim_token_format=urn:ietf:params:oauth:token-type:jwt" \
--data "audience=advanced-build-cache-service")
--data "audience=bitrise-services")
auth_token=$(echo $json_response | jq -r .access_token)
envman add --key BITRISEIO_ABCS_API_URL --value $BITRISEIO_CACHE_SERVICE_URL --sensitive
envman add --key BITRISEIO_ABCS_ACCESS_TOKEN --value $auth_token --sensitive
envman add --key BITRISEIO_ABCS_API_URL --value $BITRISEIO_CACHE_SERVICE_URL
envman add --key BITRISEIO_BITRISE_SERVICES_ACCESS_TOKEN --value $auth_token --sensitive
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/bitrise-steplib/steps-restore-gradle-cache
go 1.17

require (
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.12
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.12
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.15
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.13
)

require (
Expand Down
11 changes: 4 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
github.com/bitrise-io/go-steputils v1.0.1 h1:lwPl2W1njfANrBoTCkuqOOYbTha263ZFqoWQH0fwhaY=
github.com/bitrise-io/go-steputils v1.0.1/go.mod h1:YIUaQnIAyK4pCvQG0hYHVkSzKNT9uL2FWmkFNW4mfNI=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.12 h1:lQ/ayzGLU5f69CJCIvHt9gmhrbcwcwbNw5v1mWmXVX0=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.12/go.mod h1:ub3KVohX1vc1f2alPeVg7EoXAifm7p+SD326c2OUKdo=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.15 h1:wG037NV+pS8cEwtalE5K58bmKLyUkU0+4m4IuXjTzmo=
github.com/bitrise-io/go-steputils/v2 v2.0.0-alpha.15/go.mod h1:M09BbxYoh6B7KJnXk/yvtuU5nZPh7RQBJGKc1dp+0hQ=
github.com/bitrise-io/go-utils v1.0.1 h1:e7mepVBkVN1DXRPESNXb0djEw6bxB6B93p/Q74zzcvk=
github.com/bitrise-io/go-utils v1.0.1/go.mod h1:ZY1DI+fEpZuFpO9szgDeICM4QbqoWVt0RSY3tRI1heY=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.12 h1:FxzmUw3B3eQuxPxBFN/oORunIdxSBqZgJZmRb8CAiTc=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.12/go.mod h1:gZWtM7PLn1VOroa4gN1La/24aRVc0jg5R701jTsPaO8=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.13 h1:QtAAfm/FpMDv/PnDxgzylVbbSx21pyl7+5T/ToJnWAQ=
github.com/bitrise-io/go-utils/v2 v2.0.0-alpha.13/go.mod h1:gZWtM7PLn1VOroa4gN1La/24aRVc0jg5R701jTsPaO8=
github.com/bmatcuk/doublestar/v4 v4.2.0 h1:Qu+u9wR3Vd89LnlLMHvnZ5coJMWKQamqdz9/p5GNthA=
github.com/bmatcuk/doublestar/v4 v4.2.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -48,7 +46,6 @@ golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"

"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/env"
"github.com/bitrise-io/go-utils/v2/log"
"github.com/bitrise-steplib/steps-restore-gradle-cache/step"
Expand All @@ -17,7 +18,8 @@ func run() int {
logger := log.NewLogger()
envRepo := env.NewRepository()
inputParser := stepconf.NewInputParser(envRepo)
cacheStep := step.New(logger, inputParser, envRepo)
cmdFactory := command.NewFactory(envRepo)
cacheStep := step.New(logger, inputParser, envRepo, cmdFactory)

exitCode := 0

Expand Down
8 changes: 6 additions & 2 deletions step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/bitrise-io/go-steputils/v2/cache"
"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/env"
"github.com/bitrise-io/go-utils/v2/log"
)
Expand All @@ -32,17 +33,20 @@ type RestoreCacheStep struct {
logger log.Logger
inputParser stepconf.InputParser
envRepo env.Repository
cmdFactory command.Factory
}

func New(
logger log.Logger,
inputParser stepconf.InputParser,
envRepo env.Repository,
cmdFactory command.Factory,
) RestoreCacheStep {
return RestoreCacheStep{
logger: logger,
inputParser: inputParser,
envRepo: envRepo,
cmdFactory: cmdFactory,
}
}

Expand All @@ -59,8 +63,8 @@ func (step RestoreCacheStep) Run() error {

step.logger.EnableDebugLog(input.Verbose)

saver := cache.NewRestorer(step.envRepo, step.logger)
return saver.Restore(cache.RestoreCacheInput{
restorer := cache.NewRestorer(step.envRepo, step.logger, step.cmdFactory)
return restorer.Restore(cache.RestoreCacheInput{
StepId: stepId,
Verbose: input.Verbose,
Keys: keys,
Expand Down
28 changes: 28 additions & 0 deletions vendor/github.com/bitrise-io/go-steputils/v2/cache/common.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.

19 changes: 10 additions & 9 deletions vendor/github.com/bitrise-io/go-steputils/v2/cache/network/api.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.

Loading

0 comments on commit b0a78d9

Please sign in to comment.