Point to tfignore branch of go-tfe

This commit is contained in:
Pam Selle 2019-10-08 14:44:02 -04:00
parent c1ea09141f
commit 57cf6d74ce
9 changed files with 42 additions and 31 deletions

2
go.mod
View File

@ -64,7 +64,7 @@ require (
github.com/hashicorp/go-retryablehttp v0.5.2 github.com/hashicorp/go-retryablehttp v0.5.2
github.com/hashicorp/go-rootcerts v1.0.0 github.com/hashicorp/go-rootcerts v1.0.0
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 // indirect
github.com/hashicorp/go-tfe v0.3.23 github.com/hashicorp/go-tfe v0.3.25-0.20191014160435-c612f0723085
github.com/hashicorp/go-uuid v1.0.1 github.com/hashicorp/go-uuid v1.0.1
github.com/hashicorp/go-version v1.2.0 github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f

14
go.sum
View File

@ -197,12 +197,18 @@ github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82k
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-slug v0.3.0 h1:L0c+AvH/J64iMNF4VqRaRku2DMTEuHioPVS7kMjWIU8= github.com/hashicorp/go-slug v0.3.1-0.20191009194302-70074d64c6a1 h1:MY27QJoTm9u5o8KmpruodvlYUFUCcrIjGaH0TIqiDAk=
github.com/hashicorp/go-slug v0.3.0/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8= github.com/hashicorp/go-slug v0.3.1-0.20191009194302-70074d64c6a1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
github.com/hashicorp/go-slug v0.3.1-0.20191010205338-b03503a77720 h1:TgaHYe8odauiIiJ/vHC/CdKNUBf3CUErDlmgPcRpdSc=
github.com/hashicorp/go-slug v0.3.1-0.20191010205338-b03503a77720/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1 h1:HOXYrgAVqLyWolTJqE7NktkqoQY0IGY3PJ+YKvbFJs4=
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 h1:7YOlAIO2YWnJZkQp7B5eFykaIY7C9JndqAFQyVV5BhM= github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86 h1:7YOlAIO2YWnJZkQp7B5eFykaIY7C9JndqAFQyVV5BhM=
github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-tfe v0.3.23 h1:kd9hlFQvGubNF/CpF7T5AP/xU8uLUq8ANbI5xRDVSms= github.com/hashicorp/go-tfe v0.3.25-0.20191010205045-c8671afaec68 h1:kOWu1Tov0Dz8akF/G55b1HziNgriZlmqlymfb2Clsz4=
github.com/hashicorp/go-tfe v0.3.23/go.mod h1:SuPHR+OcxvzBZNye7nGPfwZTEyd3rWPfLVbCgyZPezM= github.com/hashicorp/go-tfe v0.3.25-0.20191010205045-c8671afaec68/go.mod h1:6krZ7LCgjjzJSrXLduGG4HDt22vm3sCf1xQmnzxkl/0=
github.com/hashicorp/go-tfe v0.3.25-0.20191014160435-c612f0723085 h1:1MT7/1PJiEMrcphFExl33Su0LBQHpA+VKyf0i5OR8uI=
github.com/hashicorp/go-tfe v0.3.25-0.20191014160435-c612f0723085/go.mod h1:jCQyaNQaBTmvJ+EFgtDDw2xICAZABVXO6LkPXdgIOO8=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=

View File

@ -44,7 +44,7 @@ func main() {
// Then call the Pack function with a directory path containing the // Then call the Pack function with a directory path containing the
// configuration files and an io.Writer to write the slug to. // configuration files and an io.Writer to write the slug to.
if _, err := Pack("test-fixtures/archive-dir", slug); err != nil { if _, err := Pack("testdata/archive-dir", slug); err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -33,11 +33,15 @@ func Pack(src string, w io.Writer, dereference bool) (*Meta, error) {
// Tar the file contents. // Tar the file contents.
tarW := tar.NewWriter(gzipW) tarW := tar.NewWriter(gzipW)
// Load the ignore rule configuration, which will use
// defaults if no .terraformignore is configured
ignoreRules := parseIgnoreFile(src)
// Track the metadata details as we go. // Track the metadata details as we go.
meta := &Meta{} meta := &Meta{}
// Walk the tree of files. // Walk the tree of files.
err := filepath.Walk(src, packWalkFn(src, src, src, tarW, meta, dereference)) err := filepath.Walk(src, packWalkFn(src, src, src, tarW, meta, dereference, ignoreRules))
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -55,17 +59,12 @@ func Pack(src string, w io.Writer, dereference bool) (*Meta, error) {
return meta, nil return meta, nil
} }
func packWalkFn(root, src, dst string, tarW *tar.Writer, meta *Meta, dereference bool) filepath.WalkFunc { func packWalkFn(root, src, dst string, tarW *tar.Writer, meta *Meta, dereference bool, ignoreRules []rule) filepath.WalkFunc {
return func(path string, info os.FileInfo, err error) error { return func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
return err return err
} }
// Skip the .git directory.
if info.IsDir() && info.Name() == ".git" {
return filepath.SkipDir
}
// Get the relative path from the current src directory. // Get the relative path from the current src directory.
subpath, err := filepath.Rel(src, path) subpath, err := filepath.Rel(src, path)
if err != nil { if err != nil {
@ -75,20 +74,16 @@ func packWalkFn(root, src, dst string, tarW *tar.Writer, meta *Meta, dereference
return nil return nil
} }
// Ignore the .terraform directory itself. if m := matchIgnoreRule(subpath, ignoreRules); m {
if info.IsDir() && info.Name() == ".terraform" {
return nil return nil
} }
// Ignore any files in the .terraform directory. // Catch directories so we don't end up with empty directories,
if !info.IsDir() && filepath.Dir(subpath) == ".terraform" { // the files are ignored correctly
return nil if info.IsDir() {
} if m := matchIgnoreRule(subpath+string(os.PathSeparator), ignoreRules); m {
return nil
// Skip .terraform subdirectories, except for the modules subdirectory. }
if strings.HasPrefix(subpath, ".terraform"+string(filepath.Separator)) &&
!strings.HasPrefix(subpath, filepath.Clean(".terraform/modules")) {
return filepath.SkipDir
} }
// Get the relative path from the initial root directory. // Get the relative path from the initial root directory.
@ -159,7 +154,8 @@ func packWalkFn(root, src, dst string, tarW *tar.Writer, meta *Meta, dereference
// If the target is a directory we can recurse into the target // If the target is a directory we can recurse into the target
// directory by calling the packWalkFn with updated arguments. // directory by calling the packWalkFn with updated arguments.
if info.IsDir() { if info.IsDir() {
return filepath.Walk(target, packWalkFn(root, target, path, tarW, meta, dereference)) // I'm wondering if this section is unnecessary?
return filepath.Walk(target, packWalkFn(root, target, path, tarW, meta, dereference, ignoreRules))
} }
// Dereference this symlink by updating the header with the target file // Dereference this symlink by updating the header with the target file

View File

@ -5,7 +5,7 @@ require (
github.com/google/go-querystring v1.0.0 github.com/google/go-querystring v1.0.0
github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/go-cleanhttp v0.5.0
github.com/hashicorp/go-retryablehttp v0.5.2 github.com/hashicorp/go-retryablehttp v0.5.2
github.com/hashicorp/go-slug v0.3.0 github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1
github.com/hashicorp/go-uuid v1.0.1 github.com/hashicorp/go-uuid v1.0.1
github.com/stretchr/testify v1.3.0 github.com/stretchr/testify v1.3.0
github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d

View File

@ -8,8 +8,12 @@ github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6K
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4= github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4=
github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-slug v0.3.0 h1:L0c+AvH/J64iMNF4VqRaRku2DMTEuHioPVS7kMjWIU8= github.com/hashicorp/go-slug v0.3.1-0.20191009194302-70074d64c6a1 h1:MY27QJoTm9u5o8KmpruodvlYUFUCcrIjGaH0TIqiDAk=
github.com/hashicorp/go-slug v0.3.0/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8= github.com/hashicorp/go-slug v0.3.1-0.20191009194302-70074d64c6a1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
github.com/hashicorp/go-slug v0.3.1-0.20191010205338-b03503a77720 h1:TgaHYe8odauiIiJ/vHC/CdKNUBf3CUErDlmgPcRpdSc=
github.com/hashicorp/go-slug v0.3.1-0.20191010205338-b03503a77720/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1 h1:HOXYrgAVqLyWolTJqE7NktkqoQY0IGY3PJ+YKvbFJs4=
github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

View File

@ -179,6 +179,9 @@ type WorkspaceCreateOptions struct {
// organization. // organization.
Name *string `jsonapi:"attr,name"` Name *string `jsonapi:"attr,name"`
// Whether the workspace will use remote or local execution mode.
Operations *bool `jsonapi:"attr,operations,omitempty"`
// Whether to queue all runs. Unless this is set to true, runs triggered by // Whether to queue all runs. Unless this is set to true, runs triggered by
// a webhook will not be queued until at least one run is manually queued. // a webhook will not be queued until at least one run is manually queued.
QueueAllRuns *bool `jsonapi:"attr,queue-all-runs,omitempty"` QueueAllRuns *bool `jsonapi:"attr,queue-all-runs,omitempty"`
@ -316,6 +319,9 @@ type WorkspaceUpdateOptions struct {
// disabled, any push will trigger a run. // disabled, any push will trigger a run.
FileTriggersEnabled *bool `jsonapi:"attr,file-triggers-enabled,omitempty"` FileTriggersEnabled *bool `jsonapi:"attr,file-triggers-enabled,omitempty"`
// Whether the workspace will use remote or local execution mode.
Operations *bool `jsonapi:"attr,operations,omitempty"`
// Whether to queue all runs. Unless this is set to true, runs triggered by // Whether to queue all runs. Unless this is set to true, runs triggered by
// a webhook will not be queued until at least one run is manually queued. // a webhook will not be queued until at least one run is manually queued.
QueueAllRuns *bool `jsonapi:"attr,queue-all-runs,omitempty"` QueueAllRuns *bool `jsonapi:"attr,queue-all-runs,omitempty"`

View File

@ -59,7 +59,6 @@ func NewConstraint(v string) (Constraints, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
result[i] = c result[i] = c
} }

4
vendor/modules.txt vendored
View File

@ -314,9 +314,9 @@ github.com/hashicorp/go-retryablehttp
github.com/hashicorp/go-rootcerts github.com/hashicorp/go-rootcerts
# github.com/hashicorp/go-safetemp v1.0.0 # github.com/hashicorp/go-safetemp v1.0.0
github.com/hashicorp/go-safetemp github.com/hashicorp/go-safetemp
# github.com/hashicorp/go-slug v0.3.0 # github.com/hashicorp/go-slug v0.3.1-0.20191014160156-9121920affb1
github.com/hashicorp/go-slug github.com/hashicorp/go-slug
# github.com/hashicorp/go-tfe v0.3.23 # github.com/hashicorp/go-tfe v0.3.25-0.20191014160435-c612f0723085
github.com/hashicorp/go-tfe github.com/hashicorp/go-tfe
# github.com/hashicorp/go-uuid v1.0.1 # github.com/hashicorp/go-uuid v1.0.1
github.com/hashicorp/go-uuid github.com/hashicorp/go-uuid