Skip to content

Commit

Permalink
fix: add option to tag provider with git branch from Verify methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey committed Mar 28, 2022
1 parent 6c60bf7 commit 59f097f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions dsl/pact.go
Expand Up @@ -687,6 +687,7 @@ func (p *Pact) VerifyMessageProviderRaw(request VerifyMessageRequest) ([]types.P
BrokerToken: request.BrokerToken,
PublishVerificationResults: request.PublishVerificationResults,
ProviderVersion: request.ProviderVersion,
TagWithGitBranch: request.TagWithGitBranch,
ProviderTags: request.ProviderTags,
Provider: p.Provider,
PactLogDir: p.LogDir,
Expand Down
7 changes: 7 additions & 0 deletions dsl/verify_mesage_request.go
Expand Up @@ -60,6 +60,9 @@ type VerifyMessageRequest struct {
// Useful for debugging issues with the framework itself
PactLogLevel string

// Tag the provider with the current git branch in the Pact Broker
TagWithGitBranch bool

// Arguments to the VerificationProvider
// Deprecated: This will be deleted after the native library replaces Ruby deps.
Args []string
Expand Down Expand Up @@ -103,5 +106,9 @@ func (v *VerifyMessageRequest) Validate() error {
v.Args = append(v.Args, "--log-level", v.PactLogLevel)
}

if v.TagWithGitBranch {
v.Args = append(v.Args, "--tag-with-git-branch", "true")
}

return nil
}
7 changes: 7 additions & 0 deletions types/verify_request.go
Expand Up @@ -126,6 +126,9 @@ type VerifyRequest struct {
// Deprecated
Verbose bool

// Tag the provider with the current git branch in the Pact Broker
TagWithGitBranch bool

// Arguments to the VerificationProvider
// Deprecated: This will be deleted after the native library replaces Ruby deps.
Args []string
Expand Down Expand Up @@ -246,5 +249,9 @@ func (v *VerifyRequest) Validate() error {
v.Args = append(v.Args, "--log-level", v.PactLogLevel)
}

if v.TagWithGitBranch {
v.Args = append(v.Args, "--tag-with-git-branch", "true")
}

return nil
}

0 comments on commit 59f097f

Please sign in to comment.