File tree 6 files changed +13
-66
lines changed
6 files changed +13
-66
lines changed Original file line number Diff line number Diff line change 1
1
bin
2
2
.cnab
3
- * -packr.go
4
3
/build /git_askpass.sh
Original file line number Diff line number Diff line change @@ -29,7 +29,3 @@ Here are the most common Makefile tasks
29
29
* ` build ` builds both the runtime and client.
30
30
* ` install ` installs the mixin into ** ~ /.porter/mixins** .
31
31
* ` test-unit ` runs the unit tests.
32
- * ` clean-packr ` removes extra packr files that were a side-effect of the build.
33
- Normally this is run automatically but if you run into issues with packr,
34
- run this command.
35
-
Original file line number Diff line number Diff line change @@ -32,32 +32,21 @@ endif
32
32
REGISTRY ?= $(USER )
33
33
34
34
.PHONY : build
35
- build : build-client build-runtime clean-packr
35
+ build : build-client build-runtime
36
36
37
- build-runtime : generate
37
+ build-runtime :
38
38
mkdir -p $(BINDIR )
39
39
GOARCH=$(RUNTIME_ARCH ) GOOS=$(RUNTIME_PLATFORM ) $(GO ) build -ldflags ' $(LDFLAGS)' -o $(BINDIR ) /$(MIXIN ) -runtime$(FILE_EXT ) ./cmd/$(MIXIN )
40
40
41
- build-client : generate
41
+ build-client :
42
42
mkdir -p $(BINDIR )
43
43
$(GO ) build -ldflags ' $(LDFLAGS)' -o $(BINDIR ) /$(MIXIN )$(FILE_EXT ) ./cmd/$(MIXIN )
44
44
45
- generate : packr2
46
- $(GO ) mod tidy
47
- $(GO ) generate ./...
48
-
49
- HAS_PACKR2 := $(shell command -v packr2)
50
- packr2 :
51
- ifndef HAS_PACKR2
52
- $(GO) get -u github.com/gobuffalo/packr/v2/packr2
53
- endif
54
-
55
- xbuild-all : generate
45
+ xbuild-all :
56
46
$(foreach OS, $(SUPPORTED_PLATFORMS ) , \
57
47
$(foreach ARCH, $(SUPPORTED_ARCHES ) , \
58
48
$(MAKE ) $(MAKE_OPTS ) CLIENT_PLATFORM=$(OS ) CLIENT_ARCH=$(ARCH ) MIXIN=$(MIXIN ) xbuild; \
59
49
))
60
- $(MAKE ) clean-packr
61
50
62
51
xbuild : $(BINDIR ) /$(VERSION ) /$(MIXIN ) -$(CLIENT_PLATFORM ) -$(CLIENT_ARCH )$(FILE_EXT )
63
52
$(BINDIR ) /$(VERSION ) /$(MIXIN ) -$(CLIENT_PLATFORM ) -$(CLIENT_ARCH )$(FILE_EXT ) :
@@ -87,8 +76,5 @@ install:
87
76
install $(BINDIR ) /$(MIXIN )$(FILE_EXT ) $(PORTER_HOME ) /mixins/$(MIXIN ) /$(MIXIN )$(FILE_EXT )
88
77
install $(BINDIR ) /$(MIXIN ) -runtime$(FILE_EXT ) $(PORTER_HOME ) /mixins/$(MIXIN ) /runtimes/$(MIXIN ) -runtime$(FILE_EXT )
89
78
90
- clean : clean-packr
79
+ clean :
91
80
-rm -fr bin/
92
-
93
- clean-packr : packr2
94
- cd pkg/kubernetes && packr2 clean
Original file line number Diff line number Diff line change 1
- //go:generate packr2
2
-
3
1
package kubernetes
4
2
5
3
import (
@@ -11,7 +9,6 @@ import (
11
9
12
10
"get.porter.sh/porter/pkg/context"
13
11
"github.com/ghodss/yaml"
14
- "github.com/gobuffalo/packr/v2"
15
12
"github.com/pkg/errors"
16
13
"github.com/xeipuuv/gojsonschema"
17
14
)
@@ -22,22 +19,16 @@ const (
22
19
23
20
type Mixin struct {
24
21
* context.Context
25
- schemas * packr.Box
26
22
KubernetesClientVersion string
27
23
}
28
24
29
25
func New () * Mixin {
30
26
return & Mixin {
31
27
Context : context .New (),
32
- schemas : NewSchemaBox (),
33
28
KubernetesClientVersion : defaultKubernetesClientVersion ,
34
29
}
35
30
}
36
31
37
- func NewSchemaBox () * packr.Box {
38
- return packr .New ("get.porter.sh/porter/pkg/kubernetes/schema" , "./schema" )
39
- }
40
-
41
32
func (m * Mixin ) getCommandFile (commandFile string , w io.Writer ) ([]byte , error ) {
42
33
if commandFile == "" {
43
34
reader := bufio .NewReader (m .In )
@@ -65,10 +56,7 @@ func (m *Mixin) ValidatePayload(b []byte) error {
65
56
manifestLoader := gojsonschema .NewGoLoader (s )
66
57
67
58
// Load the step schema
68
- schema , err := m .GetSchema ()
69
- if err != nil {
70
- return err
71
- }
59
+ schema := m .GetSchema ()
72
60
schemaLoader := gojsonschema .NewStringLoader (schema )
73
61
74
62
validator , err := gojsonschema .NewSchema (schemaLoader )
Original file line number Diff line number Diff line change 1
1
package kubernetes
2
2
3
3
import (
4
+ _ "embed"
4
5
"fmt"
5
-
6
- packr "github.com/gobuffalo/packr/v2"
7
6
)
8
7
9
- func (m * Mixin ) PrintSchema () error {
10
- schema , err := m .GetSchema ()
11
- if err != nil {
12
- return err
13
- }
8
+ //go:embed schema/schema.json
9
+ var schema string
14
10
11
+ func (m * Mixin ) PrintSchema () error {
12
+ schema := m .GetSchema ()
15
13
fmt .Fprintf (m .Out , schema )
16
-
17
14
return nil
18
15
}
19
16
20
- func (m * Mixin ) GetSchema () (string , error ) {
21
- t := packr .New ("schema" , "./schema" )
22
-
23
- b , err := t .Find ("schema.json" )
24
- if err != nil {
25
- return "" , err
26
- }
27
-
28
- return string (b ), nil
17
+ func (m * Mixin ) GetSchema () string {
18
+ return schema
29
19
}
Original file line number Diff line number Diff line change @@ -9,18 +9,6 @@ import (
9
9
"github.com/stretchr/testify/require"
10
10
)
11
11
12
- func TestMixin_GetSchema (t * testing.T ) {
13
- m := NewTestMixin (t )
14
-
15
- gotSchema , err := m .GetSchema ()
16
- require .NoError (t , err )
17
-
18
- wantSchema , err := ioutil .ReadFile ("./schema/schema.json" )
19
- require .NoError (t , err )
20
-
21
- assert .Equal (t , string (wantSchema ), gotSchema )
22
- }
23
-
24
12
func TestMixin_PrintSchema (t * testing.T ) {
25
13
m := NewTestMixin (t )
26
14
You can’t perform that action at this time.
0 commit comments