Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* Improve API error handling to decode both JSON:API error objects and regular JSON errors arrays by @uk1288 [#1304](https://github.com/hashicorp/go-tfe/pull/1304)

## Enhancements
* Adds the `ProviderType` field to `AdminSAMLSetting` and `AdminSAMLSettingsUpdateOptions` to support the `provider-type` SAML setting by @skj-skj [#1303](https://github.com/hashicorp/go-tfe/pull/1303)
* Adds the `ProviderType` field to `AdminSAMLSetting` and `AdminSAMLSettingsUpdateOptions` to support the `provider-type` SAML setting.
* Adds `AdminSCIMSetting` to support managing site-level SCIM settings by @skj-skj [#1307](https://github.com/hashicorp/go-tfe/pull/1307)
* Adds `AdminSCIMToken` to support managing site-level SCIM tokens by @skj-skj [#1310](https://github.com/hashicorp/go-tfe/pull/1310)
* Add support for trigger patterns and working directories to stacks by @aaabdelgany [#1305](https://github.com/hashicorp/go-tfe/pull/1305)

# v1.103.0

Expand Down
6 changes: 6 additions & 0 deletions stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ type Stack struct {
InputsCount int `jsonapi:"attr,inputs-count"`
OutputsCount int `jsonapi:"attr,outputs-count"`
CreationSource string `jsonapi:"attr,creation-source"`
WorkingDirectory string `jsonapi:"attr,working-directory,omitempty"`
TriggerPatterns []string `jsonapi:"attr,trigger-patterns,omitempty"`

// Relationships
Project *Project `jsonapi:"relation,project"`
Expand Down Expand Up @@ -166,6 +168,8 @@ type StackCreateOptions struct {
VCSRepo *StackVCSRepoOptions `jsonapi:"attr,vcs-repo"`
Project *Project `jsonapi:"relation,project"`
AgentPool *AgentPool `jsonapi:"relation,agent-pool"`
WorkingDirectory *string `jsonapi:"attr,working-directory,omitempty"`
TriggerPatterns []string `jsonapi:"attr,trigger-patterns"`
}

// StackUpdateOptions represents the options for updating a stack.
Expand All @@ -175,6 +179,8 @@ type StackUpdateOptions struct {
SpeculativeEnabled *bool `jsonapi:"attr,speculative-enabled,omitempty"`
VCSRepo *StackVCSRepoOptions `jsonapi:"attr,vcs-repo"`
AgentPool *AgentPool `jsonapi:"relation,agent-pool"`
WorkingDirectory *string `jsonapi:"attr,working-directory,omitempty"`
TriggerPatterns []string `jsonapi:"attr,trigger-patterns"`
}

// WaitForStatusResult is the data structure that is sent over the channel
Expand Down
11 changes: 10 additions & 1 deletion stack_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ func TestStackReadUpdateDelete(t *testing.T) {
Project: &Project{
ID: orgTest.DefaultProject.ID,
},
AgentPool: initialPool,
AgentPool: initialPool,
WorkingDirectory: String("envs"),
TriggerPatterns: []string{"/**/*"},
})

require.NoError(t, err)
Expand All @@ -175,12 +177,15 @@ func TestStackReadUpdateDelete(t *testing.T) {
require.False(t, stack.SpeculativeEnabled)

stackRead, err := client.Stacks.Read(ctx, stack.ID)

require.NoError(t, err)
require.Equal(t, stack.VCSRepo.Identifier, stackRead.VCSRepo.Identifier)
require.Equal(t, stack.VCSRepo.OAuthTokenID, stackRead.VCSRepo.OAuthTokenID)
require.Equal(t, stack.VCSRepo.Branch, stackRead.VCSRepo.Branch)
require.Equal(t, stack.AgentPool.ID, stackRead.AgentPool.ID)
assert.Equal(t, stack, stackRead)
assert.Equal(t, stackRead.WorkingDirectory, "envs")
assert.Equal(t, stackRead.TriggerPatterns, []string{"/**/*"})
assert.False(t, stackRead.SpeculativeEnabled)

updatedPool, err := client.AgentPools.Create(ctx, orgTest.Name, AgentPoolCreateOptions{
Expand All @@ -197,6 +202,8 @@ func TestStackReadUpdateDelete(t *testing.T) {
},
AgentPool: updatedPool,
SpeculativeEnabled: Bool(true),
WorkingDirectory: String(""),
TriggerPatterns: []string{""},
})

require.NoError(t, err)
Expand All @@ -207,6 +214,8 @@ func TestStackReadUpdateDelete(t *testing.T) {
stackUpdatedConfig, err := client.Stacks.FetchLatestFromVcs(ctx, stack.ID)
require.NoError(t, err)
require.Equal(t, stack.Name, stackUpdatedConfig.Name)
require.Equal(t, stackUpdated.WorkingDirectory, "")
require.Equal(t, stackUpdated.TriggerPatterns, []string{""})

err = client.Stacks.Delete(ctx, stack.ID)
require.NoError(t, err)
Expand Down
Loading