Skip to content

Commit 4a4c55f

Browse files
update tools and remove deprecated io lib
1 parent 7db0b50 commit 4a4c55f

18 files changed

+52
-71
lines changed

GNUmakefile

+4-15
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@ PKG_NAME=codefresh
66
NAMESPACE=app
77
BINARY=terraform-provider-${PKG_NAME}
88
OS_ARCH=darwin_amd64
9-
TFPLUGINDOCS_VERSION=v0.14.1
109

1110
default: build
1211

13-
tools:
14-
GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
15-
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/golangci-lint
16-
GO111MODULE=on go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
17-
1812
build: fmtcheck
1913
go install
2014
go build -o ${BINARY}
@@ -31,7 +25,7 @@ fmtcheck:
3125

3226
lint:
3327
@echo "==> Checking source code against linters..."
34-
golangci-lint run ./...
28+
go tool golangci-lint run ./...
3529

3630
test: fmtcheck
3731
go test -i $(TEST) || exit 1
@@ -58,13 +52,8 @@ vet:
5852
exit 1; \
5953
fi
6054

61-
docs-prepare:
62-
@echo "==> Setting up tfplugindocs..."
63-
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@${TFPLUGINDOCS_VERSION}
64-
65-
docs: docs-prepare
55+
docs:
6656
@echo "==> Generating Provider Documentation..."
67-
tfplugindocs generate
68-
69-
.PHONY: build test testacc vet fmt fmtcheck lint tools test-compile docs docs-prepare
57+
go tool tfplugindocs generate
7058

59+
.PHONY: build test testacc vet fmt fmtcheck lint test-compile docs docs-prepare

codefresh.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ steps:
3939
# The following will resolve to their latest patch version
4040
environment:
4141
- TF_VERSION=1.3.0
42-
- TF_VERSION=1.7.0
42+
- TF_VERSION=1.11.4
4343
when:
4444
condition:
4545
all:

codefresh/cfclient/account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"errors"
55
"fmt"
66

7-
"github.com/imdario/mergo"
7+
"dario.cat/mergo"
88
)
99

1010
type DockerRegistry struct {

codefresh/cfclient/client.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"strings"
1010
)
@@ -71,7 +71,7 @@ func (client *Client) RequestAPI(opt *RequestOptions) ([]byte, error) {
7171
}
7272
defer resp.Body.Close()
7373

74-
body, err := ioutil.ReadAll(resp.Body)
74+
body, err := io.ReadAll(resp.Body)
7575
if err != nil {
7676
return nil, fmt.Errorf("Failed to read body %v %v", resp.StatusCode, resp.Status)
7777
}
@@ -103,7 +103,7 @@ func (client *Client) RequestApiXAccessToken(opt *RequestOptions) ([]byte, error
103103
}
104104
defer resp.Body.Close()
105105

106-
body, err := ioutil.ReadAll(resp.Body)
106+
body, err := io.ReadAll(resp.Body)
107107
if err != nil {
108108
return nil, fmt.Errorf("Failed to read body %v %v", resp.StatusCode, resp.Status)
109109
}

codefresh/cfclient/gql_client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"errors"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
)
1010

@@ -38,7 +38,7 @@ func (client *Client) SendGqlRequest(request GraphQLRequest) ([]byte, error) {
3838
return nil, err
3939
}
4040
if resp.StatusCode >= 400 {
41-
bodyBytes, _ := ioutil.ReadAll(resp.Body)
41+
bodyBytes, _ := io.ReadAll(resp.Body)
4242
return nil, errors.New(resp.Status + " " + string(bodyBytes))
4343
}
4444
defer resp.Body.Close()

codefresh/internal/datautil/yaml.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package datautil
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"strings"
6-
76
"github.com/mikefarah/yq/v4/pkg/yqlib"
87
"gopkg.in/op/go-logging.v1"
98
)
@@ -24,7 +23,7 @@ func Yq(yamlString string, expression string, outputformat string) (string, erro
2423
yqEvaluator := yqlib.NewStringEvaluator()
2524

2625
// Disable yq logging
27-
yqLogBackend := logging.AddModuleLevel(logging.NewLogBackend(ioutil.Discard, "", 0))
26+
yqLogBackend := logging.AddModuleLevel(logging.NewLogBackend(io.Discard, "", 0))
2827
yqlib.GetLogger().SetBackend(yqLogBackend)
2928

3029
yamlString, err := yqEvaluator.Evaluate(yamlString, expression, yqEncoder, yqDecoder)

codefresh/resource_step_types_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package codefresh
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"os"
87
"regexp"
@@ -49,7 +48,7 @@ func TestCleanUpStepFromTransientValues(t *testing.T) {
4948

5049
func TestNormalizeYamlStringStepTypes(t *testing.T) {
5150
testFile := "../test_data/step_types/testStepWithRuntimeData.yaml"
52-
yamlString, err := ioutil.ReadFile(testFile)
51+
yamlString, err := os.ReadFile(testFile)
5352
if err != nil {
5453
t.Errorf("Unable to open test file %s. Err: #%v ", testFile, err)
5554
}
@@ -85,7 +84,7 @@ func TestSortVersions(t *testing.T) {
8584

8685
func TestExtractSteps(t *testing.T) {
8786
testFile := "../test_data/step_types/testStepTypesOrder.yaml"
88-
yamlString, err := ioutil.ReadFile(testFile)
87+
yamlString, err := os.ReadFile(testFile)
8988
if err != nil {
9089
t.Errorf("Unable to read file %s", testFile)
9190
}
@@ -112,11 +111,11 @@ func TestAccCodefreshStepTypes(t *testing.T) {
112111
}
113112
name := accountName + "/" + stepTypesNamePrefix + acctest.RandString(10)
114113
resourceName := "codefresh_step_types.test"
115-
contentStepsV1, err := ioutil.ReadFile("../test_data/step_types/testSteps.yaml")
114+
contentStepsV1, err := os.ReadFile("../test_data/step_types/testSteps.yaml")
116115
if err != nil {
117116
log.Fatal(err)
118117
}
119-
contentStepsV2, err := ioutil.ReadFile("../test_data/step_types/testStepsTemplate.yaml")
118+
contentStepsV2, err := os.ReadFile("../test_data/step_types/testStepsTemplate.yaml")
120119
if err != nil {
121120
log.Fatal(err)
122121
}

docs/data-sources/account_gitops_settings.md

-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ This data source retrieves gitops settings for the active account
2323
- `id` (String) Account Id
2424
- `name` (String) Account name for active account
2525
- `shared_config_repository` (String) Shared config repository url
26-
27-

docs/data-sources/account_idp.md

-2
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,3 @@ This data source retrieves an account level identity provider
2828
- `login_url` (String) Login url using the IDP to Codefresh
2929
- `redirect_ui_url` (String) UI Callback url for the identity provider
3030
- `redirect_url` (String) API Callback url for the identity provider
31-
32-

docs/data-sources/current_account.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,5 @@ current_ac = {
6969
Required:
7070

7171
- `email` (String)
72-
- `name` (String)
73-
74-
Read-Only:
75-
76-
- `id` (String) The ID of this resource.
72+
- `id` (String)
73+
- `name` (String)

docs/data-sources/current_account_user.md

-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ Returns a user the current Codefresh account by name or email.
2323
### Read-Only
2424

2525
- `id` (String) The ID of this resource.
26-
27-

docs/data-sources/pipelines.md

-2
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ Read-Only:
3535
- `project` (String)
3636
- `spec` (String)
3737
- `tags` (List of String)
38-
39-

docs/data-sources/service_account.md

-2
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,3 @@ This data source retrieves a Codefresh service account by its ID or name.
2525
### Read-Only
2626

2727
- `id` (String) The ID of this resource.
28-
29-

docs/resources/api_key.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ page_title: "codefresh_api_key Resource - terraform-provider-codefresh"
33
subcategory: ""
44
description: |-
55
Manages an API Key tied to a user within an account or a service account within the current account.
6-
On the Codefresh SaaS platfrom this resource is only usable for service accounts.
7-
Management of API keys for users in other accounts requires admin priveleges and hence can only be done on Codefresh on-premises installations.
6+
On the Codefresh SaaS platfrom this resource is only usable for service accounts.
7+
Management of API keys for users in other accounts requires admin priveleges and hence can only be done on Codefresh on-premises installations.
88
---
99

1010
# codefresh_api_key (Resource)

docs/resources/pipeline.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Optional:
205205

206206
Read-Only:
207207

208-
- `id` (String) The ID of this resource.
208+
- `id` (String)
209209

210210

211211
<a id="nestedblock--spec--options"></a>

go.mod

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
module github.com/codefresh-io/terraform-provider-codefresh
22

33
require (
4+
dario.cat/mergo v1.0.2
45
github.com/Masterminds/semver v1.5.0
5-
github.com/bflad/tfproviderdocs v0.12.1
66
github.com/bflad/tfproviderlint v0.31.0
77
github.com/cenkalti/backoff v2.2.1+incompatible
8-
github.com/client9/misspell v0.3.4
98
github.com/dlclark/regexp2 v1.11.5
109
github.com/ghodss/yaml v1.0.0
1110
github.com/golangci/golangci-lint v1.64.8
1211
github.com/hashicorp/go-cty v1.5.0
1312
github.com/hashicorp/terraform-plugin-sdk v1.17.2
1413
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
1514
github.com/iancoleman/orderedmap v0.3.0
16-
github.com/imdario/mergo v0.3.15
1715
github.com/mikefarah/yq/v4 v4.45.3
1816
github.com/robfig/cron v1.2.0
1917
github.com/stretchr/objx v0.5.2
@@ -34,6 +32,7 @@ require (
3432
github.com/Crocmagnon/fatcontext v0.7.1 // indirect
3533
github.com/Djarvur/go-err113 v0.1.0 // indirect
3634
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.1 // indirect
35+
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
3736
github.com/Masterminds/goutils v1.1.1 // indirect
3837
github.com/Masterminds/semver/v3 v3.3.0 // indirect
3938
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
@@ -56,7 +55,7 @@ require (
5655
github.com/bgentry/speakeasy v0.1.0 // indirect
5756
github.com/bkielbasa/cyclop v1.2.3 // indirect
5857
github.com/blizzy78/varnamelen v0.8.0 // indirect
59-
github.com/bmatcuk/doublestar v1.3.4 // indirect
58+
github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
6059
github.com/bombsimon/wsl/v4 v4.5.0 // indirect
6160
github.com/breml/bidichk v0.3.2 // indirect
6261
github.com/breml/errchkjson v0.4.0 // indirect
@@ -111,6 +110,7 @@ require (
111110
github.com/gostaticanalysis/comment v1.5.0 // indirect
112111
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
113112
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
113+
github.com/hashicorp/cli v1.1.7 // indirect
114114
github.com/hashicorp/errwrap v1.1.0 // indirect
115115
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
116116
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -128,13 +128,15 @@ require (
128128
github.com/hashicorp/logutils v1.0.0 // indirect
129129
github.com/hashicorp/terraform-exec v0.22.0 // indirect
130130
github.com/hashicorp/terraform-json v0.24.0 // indirect
131+
github.com/hashicorp/terraform-plugin-docs v0.21.0 // indirect
131132
github.com/hashicorp/terraform-plugin-go v0.26.0 // indirect
132133
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
133134
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
134135
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
135136
github.com/hashicorp/yamux v0.1.1 // indirect
136137
github.com/hexops/gotextdiff v1.0.3 // indirect
137138
github.com/huandu/xstrings v1.4.0 // indirect
139+
github.com/imdario/mergo v0.3.15 // indirect
138140
github.com/inconshreveable/mousetrap v1.1.0 // indirect
139141
github.com/jgautheron/goconst v1.7.1 // indirect
140142
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
@@ -163,7 +165,6 @@ require (
163165
github.com/mattn/go-runewidth v0.0.16 // indirect
164166
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
165167
github.com/mgechev/revive v1.7.0 // indirect
166-
github.com/mitchellh/cli v1.1.5 // indirect
167168
github.com/mitchellh/copystructure v1.2.0 // indirect
168169
github.com/mitchellh/go-homedir v1.1.0 // indirect
169170
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
@@ -233,18 +234,20 @@ require (
233234
github.com/yagipy/maintidx v1.0.0 // indirect
234235
github.com/yeya24/promlinter v0.3.0 // indirect
235236
github.com/ykadowak/zerologlint v0.1.5 // indirect
236-
github.com/yuin/goldmark v1.5.4 // indirect
237+
github.com/yuin/goldmark v1.7.7 // indirect
237238
github.com/yuin/goldmark-meta v1.1.0 // indirect
238239
github.com/yuin/gopher-lua v1.1.1 // indirect
239240
github.com/zclconf/go-cty v1.16.2 // indirect
240241
gitlab.com/bosi/decorder v0.4.2 // indirect
241242
go-simpler.org/musttag v0.13.0 // indirect
242243
go-simpler.org/sloglint v0.9.0 // indirect
244+
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
243245
go.uber.org/atomic v1.10.0 // indirect
244246
go.uber.org/automaxprocs v1.6.0 // indirect
245247
go.uber.org/multierr v1.11.0 // indirect
246248
go.uber.org/zap v1.24.0 // indirect
247249
golang.org/x/crypto v0.38.0 // indirect
250+
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
248251
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
249252
golang.org/x/mod v0.24.0 // indirect
250253
golang.org/x/net v0.40.0 // indirect
@@ -266,3 +269,9 @@ require (
266269
go 1.24
267270

268271
toolchain go1.24.2
272+
273+
tool (
274+
github.com/bflad/tfproviderlint/cmd/tfproviderlint
275+
github.com/golangci/golangci-lint/cmd/golangci-lint
276+
github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
277+
)

0 commit comments

Comments
 (0)