Merge pull request #1664 from monopole/moveGeneratedCode

Move generated code
This commit is contained in:
Jeff Regan
2019-10-21 13:21:19 -07:00
committed by GitHub
36 changed files with 202 additions and 141 deletions

View File

@@ -2,7 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
// Package builtinconfig provides legacy methods for
// configuring builting plugins from a common config file.
// It's better to configure them individually if using
// a custom configuration.
// configuring builtin plugins from a common config file.
// As a user, its best to configure plugins individually
// with plugin config files specified in the `transformers:`
// or `generators:` field, than to use this legacy
// configuration technique.
package builtinconfig

View File

@@ -4,8 +4,8 @@
package builtinhelpers
import (
"sigs.k8s.io/kustomize/v3/api/plugins/builtins"
"sigs.k8s.io/kustomize/v3/api/resmap"
"sigs.k8s.io/kustomize/v3/plugin/builtin"
)
//go:generate stringer -type=BuiltinPluginType
@@ -55,21 +55,21 @@ func GetBuiltinPluginType(n string) BuiltinPluginType {
}
var GeneratorFactories = map[BuiltinPluginType]func() resmap.GeneratorPlugin{
ConfigMapGenerator: builtin.NewConfigMapGeneratorPlugin,
SecretGenerator: builtin.NewSecretGeneratorPlugin,
ConfigMapGenerator: builtins.NewConfigMapGeneratorPlugin,
SecretGenerator: builtins.NewSecretGeneratorPlugin,
}
var TransformerFactories = map[BuiltinPluginType]func() resmap.TransformerPlugin{
AnnotationsTransformer: builtin.NewAnnotationsTransformerPlugin,
HashTransformer: builtin.NewHashTransformerPlugin,
ImageTagTransformer: builtin.NewImageTagTransformerPlugin,
InventoryTransformer: builtin.NewInventoryTransformerPlugin,
LabelTransformer: builtin.NewLabelTransformerPlugin,
LegacyOrderTransformer: builtin.NewLegacyOrderTransformerPlugin,
NamespaceTransformer: builtin.NewNamespaceTransformerPlugin,
PatchJson6902Transformer: builtin.NewPatchJson6902TransformerPlugin,
PatchStrategicMergeTransformer: builtin.NewPatchStrategicMergeTransformerPlugin,
PatchTransformer: builtin.NewPatchTransformerPlugin,
PrefixSuffixTransformer: builtin.NewPrefixSuffixTransformerPlugin,
ReplicaCountTransformer: builtin.NewReplicaCountTransformerPlugin,
AnnotationsTransformer: builtins.NewAnnotationsTransformerPlugin,
HashTransformer: builtins.NewHashTransformerPlugin,
ImageTagTransformer: builtins.NewImageTagTransformerPlugin,
InventoryTransformer: builtins.NewInventoryTransformerPlugin,
LabelTransformer: builtins.NewLabelTransformerPlugin,
LegacyOrderTransformer: builtins.NewLegacyOrderTransformerPlugin,
NamespaceTransformer: builtins.NewNamespaceTransformerPlugin,
PatchJson6902Transformer: builtins.NewPatchJson6902TransformerPlugin,
PatchStrategicMergeTransformer: builtins.NewPatchStrategicMergeTransformerPlugin,
PatchTransformer: builtins.NewPatchTransformerPlugin,
PrefixSuffixTransformer: builtins.NewPrefixSuffixTransformerPlugin,
ReplicaCountTransformer: builtins.NewReplicaCountTransformerPlugin,
}

View File

@@ -34,7 +34,7 @@ pushd $dir >& /dev/null
GOPATH=$myGoPath go generate \
sigs.k8s.io/kustomize/v3/plugin/builtin/...
GOPATH=$myGoPath go fmt \
sigs.k8s.io/kustomize/v3/plugin/builtin
sigs.k8s.io/kustomize/v3/api/plugins/builtins
popd >& /dev/null

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on AnnotationsTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"sigs.k8s.io/kustomize/v3/api/resmap"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on ConfigMapGenerator; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"sigs.k8s.io/kustomize/v3/api/kv"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on HashTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on ImageTagTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on InventoryTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on LabelTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"sigs.k8s.io/kustomize/v3/api/resmap"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on LegacyOrderTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"sort"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on NamespaceTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on PatchJson6902Transformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on PatchStrategicMergeTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on PatchTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on PrefixSuffixTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"errors"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on ReplicaCountTransformer; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"fmt"

View File

@@ -1,5 +1,7 @@
// Code generated by pluginator on SecretGenerator; DO NOT EDIT.
package builtin
// pluginator {Version:unknown GitCommit:$Format:%H$ BuildDate:1970-01-01T00:00:00Z GoOs:linux GoArch:amd64}
package builtins
import (
"sigs.k8s.io/kustomize/v3/api/kv"

View File

@@ -1,7 +1,7 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// Package builtins holds code generated from the builting plugins.
// Package builtins holds code generated from the builtin plugins.
// The "builtin" plugins are written as normal plugins and can
// be used as such, but they are also used to generate the code
// in this package so they can be statically linked to client code.

View File

@@ -0,0 +1,17 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// +build tools
// This file exists to declare that its containing
// package explicitly depends on the pluginator
// tool (via go:generate directives)
package builtins
// TODO: replace this, with the appropriate version
// once the API is launched, and the new pluginator
// has been compiled against it and released.
//
// import (
// _ "sigs.k8s.io/kustomize/pluginator"
// )

View File

@@ -3,12 +3,14 @@
/*
See docs/plugins.md to learn about plugins.
Read docs/plugins.md first for an overview of kustomize plugins.
BUILTIN PLUGIN CONFIGURATION
For performance and semantic sanity reasons, all
There are two kinds of plugins, Go plugins (shared
object library) and exec plugins (independent binary).
For performance and standardized testing reasons, all
builtin plugins are Go plugins (not exec plugins).
Using "SecretGenerator" as an example in what
@@ -67,8 +69,8 @@ It arises from following requirements:
`go get` and should run where Go
programs are expected to run.
The extension requirement led to the creation
of a framework that accommodates writing a
The extension requirement led to building
a framework that accommodates writing a
G or T as either
* an 'exec' plugin (any executable file
@@ -92,16 +94,19 @@ TO GENERATE CODE
cd $repo/v3/plugin/builtin
go generate ./...
See travis/pre-commit.sh for canonical way
to execute the above.
This creates
$repo/plugin/builtin/SecretGenerator.go
$repo/api/plugins/builtins/SecretGenerator.go
etc.
Generated plugins are used in kustomize via
package whatever
import sigs.k8s.io/kustomize/v3/plugin/builtin
import sigs.k8s.io/kustomize/v3/plugins/builtins
...
g := builtin.NewSecretGenerator()
g.Config(h, k)
@@ -110,4 +115,4 @@ Generated plugins are used in kustomize via
// Eventually emit resources.
*/
package plugin
package plugins

View File

@@ -18,11 +18,11 @@ import (
"sigs.k8s.io/kustomize/v3/api/pgmconfig"
"sigs.k8s.io/kustomize/v3/api/plugins/builtinconfig"
"sigs.k8s.io/kustomize/v3/api/plugins/builtinhelpers"
"sigs.k8s.io/kustomize/v3/api/plugins/builtins"
"sigs.k8s.io/kustomize/v3/api/plugins/loader"
"sigs.k8s.io/kustomize/v3/api/resmap"
"sigs.k8s.io/kustomize/v3/api/transform"
"sigs.k8s.io/kustomize/v3/api/types"
"sigs.k8s.io/kustomize/v3/plugin/builtin"
"sigs.k8s.io/yaml"
)
@@ -164,7 +164,7 @@ func (kt *KustTarget) makeCustomizedResMap(
func (kt *KustTarget) addHashesToNames(
ra *accumulator.ResAccumulator) error {
p := builtin.NewHashTransformerPlugin()
p := builtins.NewHashTransformerPlugin()
err := kt.configureBuiltinPlugin(p, nil, builtinhelpers.HashTransformer)
if err != nil {
return err
@@ -193,7 +193,7 @@ func (kt *KustTarget) computeInventory(
c.Name = inv.ConfigMap.Name
c.Namespace = inv.ConfigMap.Namespace
c.Policy = garbagePolicy.String()
p := builtin.NewInventoryTransformerPlugin()
p := builtins.NewInventoryTransformerPlugin()
err := kt.configureBuiltinPlugin(p, c, builtinhelpers.InventoryTransformer)
if err != nil {
return err

8
go.mod
View File

@@ -13,11 +13,17 @@ require (
github.com/spf13/pflag v1.0.5
golang.org/x/net v0.0.0-20191011234655-491137f69257 // indirect
golang.org/x/tools v0.0.0-20191014141550-5fa5b1782b2c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.2
k8s.io/api v0.0.0-20190313235455-40a48860b5ab
k8s.io/apimachinery v0.0.0-20190313205120-d7deff9243b1
k8s.io/client-go v11.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208
sigs.k8s.io/kustomize/pluginator v1.0.0
sigs.k8s.io/yaml v1.1.0
)
// TODO: replace this in the above requirements,
// with the appropriate version once the API is launched,
// and a new pluginator binary has been compiled against
// it and released.
// sigs.k8s.io/kustomize/pluginator v1.0.0

33
go.sum
View File

@@ -33,9 +33,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/emicklei/go-restful v2.9.6+incompatible h1:tfrHha8zJ01ywiOEC1miGY8st1/igzWB8OmvPgoYX7w=
github.com/emicklei/go-restful v2.9.6+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
@@ -134,13 +133,11 @@ github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367 h1:ScAXWS+TR6MZKex+7Z8rneuSJH+FSDqd6ocQyl+ZHo4=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9 h1:Dk8DO58y0wXeNG49dRqzf4HrZAK9lFfTgS/FNtB6NlM=
github.com/googleapis/gnostic v0.0.0-20170426233943-68f4ded48ba9/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/googleapis/gnostic v0.3.0 h1:CcQijm0XKekKjP/YCz28LXVSpgguuB+nCxaSjCe09y0=
github.com/googleapis/gnostic v0.3.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
@@ -166,9 +163,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3 h1:/UewZcckqhvnnS0C6r3Sher2hSEbVmM6Ogpcjen08+Y=
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
@@ -192,9 +188,8 @@ github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQ
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63 h1:nTT4s92Dgz2HlrB2NaMgvlfqHH39OgMhA7z3PK7PGD4=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 h1:IaSjLMT6WvkoZZjspGxy3rdaTEmWLoRm49WbtVUi9sA=
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86 h1:q6SrfsK4FojRnJ1j8+8OJzyq3g9Y1oSVyL6nYGJXXBk=
github.com/matoous/godox v0.0.0-20190910121045-032ad8106c86/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
@@ -210,9 +205,8 @@ github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQz
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da h1:ZQGIPjr1iTtUPXZFk8WShqb5G+Qg65VHFLtSvmHh+Mw=
github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/monopole/mdrip v1.0.0 h1:RFDBa+tab6mW+gX4Ww2SZDc4kS6p01FwnLtgz64Il+I=
github.com/monopole/mdrip v1.0.0/go.mod h1:N1/ppRG9CaPeUKAUHZ3dUlfOT81lTpKZLkyhCvTETwM=
github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk=
@@ -223,13 +217,9 @@ github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96d
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
@@ -277,8 +267,6 @@ github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.2 h1:NfkwRbgViGoyjBKsLI0QMDcuMnhM+SBg3T0cGfpvKDE=
github.com/spf13/cobra v0.0.2/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
@@ -363,8 +351,6 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190621203818-d432491b9138 h1:t8BZD9RDjkm9/h7yYN6kE8oaeov5r9aztkB7zKA5Tkg=
golang.org/x/sys v0.0.0-20190621203818-d432491b9138/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5 h1:SW/0nsKCUaozCUtZTakri5laocGx/5bkDSSLrFUsa5s=
golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -427,9 +413,8 @@ k8s.io/apimachinery v0.0.0-20190313205120-d7deff9243b1/go.mod h1:ccL7Eh7zubPUSh9
k8s.io/client-go v11.0.0+incompatible h1:LBbX2+lOwY9flffWlJM7f1Ct8V2SRNiMRDFeiwnJo9o=
k8s.io/client-go v11.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92 h1:PgoMI/L1Nu5Vmvgm+vGheLuxKST8h6FMOqggyAFtHPc=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.3 h1:niceAagH1tzskmaie/icWd7ci1wbG7Bf2c6YGcQv+3c=
k8s.io/klog v0.3.3/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208 h1:5sW+fEHvlJI3Ngolx30CmubFulwH28DhKjGf70Xmtco=
k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I=
@@ -438,10 +423,6 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphD
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f h1:Cq7MalBHYACRd6EesksG1Q8EoIAKOsiZviGKbOLIej4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
sigs.k8s.io/kustomize v2.0.3+incompatible h1:JUufWFNlI44MdtnjUqVnvh29rR37PQFzPbLXqhyOyX0=
sigs.k8s.io/kustomize/pluginator v1.0.0 h1:aeLqD8CIaqr++49YrcuRUcXl5vVKYLhCSfwXUi3ifQ4=
sigs.k8s.io/kustomize/pluginator v1.0.0/go.mod h1:i8HdU5FdH1zDjCKiFf5CNl7slsc0QffyKsY2OuPynJ0=
sigs.k8s.io/kustomize/v3 v3.2.0/go.mod h1:ztX4zYc/QIww3gSripwF7TBOarBTm5BvyAMem0kCzOE=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

View File

@@ -4,10 +4,17 @@ go 1.13
require (
github.com/elastic/go-elasticsearch/v6 v6.8.2
github.com/emicklei/go-restful v2.9.6+incompatible // indirect
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/gofuzz v1.0.0 // indirect
github.com/googleapis/gnostic v0.3.0 // indirect
github.com/gorilla/mux v1.7.3
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79
github.com/json-iterator/go v1.1.6 // indirect
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/rs/cors v1.7.0
k8s.io/klog v0.3.3 // indirect
sigs.k8s.io/kustomize/v3 v3.3.1
sigs.k8s.io/yaml v1.1.0
)

View File

@@ -3,9 +3,16 @@ module sigs.k8s.io/kustomize/kustomize/v3
go 1.13
require (
github.com/emicklei/go-restful v2.9.6+incompatible // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/googleapis/gnostic v0.3.0 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pkg/errors v0.8.1
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
k8s.io/klog v0.3.3 // indirect
sigs.k8s.io/kustomize/v3 v3.3.1
sigs.k8s.io/yaml v1.1.0
)

View File

@@ -186,12 +186,10 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c h1:Hww8mOyEKTeON4bZn7F
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c h1:eSfnfIuwhxZyULg1NNuZycJcYkjYVGYe7FczwQReM6U=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
@@ -228,7 +226,6 @@ github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34c
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.2/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
@@ -308,7 +305,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4=
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190621203818-d432491b9138/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5 h1:SW/0nsKCUaozCUtZTakri5laocGx/5bkDSSLrFUsa5s=
golang.org/x/sys v0.0.0-20190911201528-7ad0cfa0b7b5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -375,8 +371,6 @@ k8s.io/kube-openapi v0.0.0-20190603182131-db7b694dc208/go.mod h1:nfDlWeOsu3pUf4y
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
sigs.k8s.io/kustomize/pluginator v1.0.0/go.mod h1:i8HdU5FdH1zDjCKiFf5CNl7slsc0QffyKsY2OuPynJ0=
sigs.k8s.io/kustomize/v3 v3.2.0/go.mod h1:ztX4zYc/QIww3gSripwF7TBOarBTm5BvyAMem0kCzOE=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

View File

@@ -14,12 +14,12 @@ import (
"sigs.k8s.io/kustomize/v3/api/ifc"
fLdr "sigs.k8s.io/kustomize/v3/api/loader"
"sigs.k8s.io/kustomize/v3/api/pgmconfig"
"sigs.k8s.io/kustomize/v3/api/plugins/builtins"
"sigs.k8s.io/kustomize/v3/api/plugins/config"
pLdr "sigs.k8s.io/kustomize/v3/api/plugins/loader"
"sigs.k8s.io/kustomize/v3/api/resmap"
"sigs.k8s.io/kustomize/v3/api/resource"
"sigs.k8s.io/kustomize/v3/api/target"
"sigs.k8s.io/kustomize/v3/plugin/builtin"
"sigs.k8s.io/yaml"
)
@@ -167,7 +167,7 @@ func (o *Options) emitResources(
// can be performed by a plugin. This particular
// plugin doesn't require configuration; just make
// it and call transform.
builtin.NewLegacyOrderTransformerPlugin().Transform(m)
builtins.NewLegacyOrderTransformerPlugin().Transform(m)
}
res, err := m.AsYaml()
if err != nil {

View File

@@ -1,19 +0,0 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// Package pgmconfig holds global constants for the kustomize tool.
package pgmconfig
const (
// Program name, for help, finding the XDG_CONFIG_DIR, etc.
ProgramName = "kustomize"
// TODO: delete this. it's a copy of a const
// defined elsewhere but used by pluginator.
DomainName = "sigs.k8s.io"
// TODO: delete this. its a copy of a const
// defined elsewhere but used by pluginator.
PluginRoot = "plugin"
)

View File

@@ -1,13 +0,0 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package plugins
const (
// Used with Go plugins.
// TODO: delete this from API in favor of api/plugins/config
PluginSymbol = "KustomizePlugin"
// TODO: delete this from API in favor of api/plugins/config
BuiltinPluginPackage = "builtin"
)

27
plugin/README.md Normal file
View File

@@ -0,0 +1,27 @@
This directory and the directories below it
are not _importable_ Go packages.
Each directory contains a kustomize plugin,
which is either
* some random non-Go based executable,
e.g. a bash script that runs java
in a JVM, or python in a python VM, etc.
* the source code for a Go executable,
i.e. a `main.go` in the unimportable
`main` package,
ideally declaring its dependencies
with it's own `go.mod` file.
* the source code for a Go
plugin, which is also an unimportable
`main` package ideally with its
own `go.mod` file, formulated to be
a Go plugin. If in the `builtin`
sub-directory, these plugins are converted
to statically linkable code.
To read more about plugins, see
sigs.k8s.io/kustomize/api/plugins/doc.go

View File

@@ -5,9 +5,9 @@ package main
import (
"github.com/pkg/errors"
"sigs.k8s.io/kustomize/v3/api/plugins/builtins"
"sigs.k8s.io/kustomize/v3/api/resmap"
"sigs.k8s.io/kustomize/v3/api/types"
"sigs.k8s.io/kustomize/v3/plugin/builtin"
"sigs.k8s.io/yaml"
)
@@ -41,7 +41,7 @@ func (p *plugin) Config(h *resmap.PluginHelpers, _ []byte) error {
return errors.Wrapf(
err, "dateprefixer makeconfig")
}
prefixer := builtin.NewPrefixSuffixTransformerPlugin()
prefixer := builtins.NewPrefixSuffixTransformerPlugin()
err = prefixer.Config(h, c)
if err != nil {
return errors.Wrapf(

View File

@@ -5,9 +5,9 @@ package main
import (
"github.com/pkg/errors"
"sigs.k8s.io/kustomize/v3/api/plugins/builtins"
"sigs.k8s.io/kustomize/v3/api/resmap"
"sigs.k8s.io/kustomize/v3/api/types"
"sigs.k8s.io/kustomize/v3/plugin/builtin"
"sigs.k8s.io/yaml"
)
@@ -44,7 +44,7 @@ func (p *plugin) Config(h *resmap.PluginHelpers, c []byte) error {
if err != nil {
return err
}
prefixer := builtin.NewPrefixSuffixTransformerPlugin()
prefixer := builtins.NewPrefixSuffixTransformerPlugin()
err = prefixer.Config(h, c)
if err != nil {
return errors.Wrapf(

View File

@@ -1,13 +0,0 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
// +build tools
// This file exists to declare that package
// plugin explicitly depends on the pluginator
// tool (via go:generate directives)
package plugin
import (
_ "sigs.k8s.io/kustomize/pluginator"
)

View File

@@ -2,4 +2,13 @@ module sigs.k8s.io/kustomize/pluginator
go 1.13
require sigs.k8s.io/kustomize/v3 v3.3.1
require (
github.com/emicklei/go-restful v2.9.6+incompatible // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/googleapis/gnostic v0.3.0 // indirect
github.com/json-iterator/go v1.1.6 // indirect
github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
k8s.io/klog v0.3.3 // indirect
sigs.k8s.io/kustomize/v3 v3.3.1
)

View File

@@ -48,7 +48,8 @@ func main() {
fmt.Sprintf(
"// pluginator %+v\n", provenance.GetProvenance()))
w.write("\n")
w.write("package " + plugins.BuiltinPluginPackage)
// TODO: `builtins` should be a const?
w.write("package builtins")
pType := unknown
@@ -124,8 +125,7 @@ func makeOutputFileName(root string) string {
"src",
pgmconfig.DomainName,
pgmconfig.ProgramName,
pgmconfig.PluginRoot,
plugins.BuiltinPluginPackage,
"api", "plugins", "builtins",
root+".go")
}

View File

@@ -14,8 +14,29 @@ function installHelm {
sudo mv linux-amd64/helm /usr/local/bin/helm
}
function removeBin {
local d=$(go env GOPATH)/bin/$1
echo "Removing binary $d"
/bin/rm -f $d
}
function installTools {
go install sigs.k8s.io/kustomize/pluginator
# TODO(2018/Oct/19): After the API is in place, and
# there's a new pluginator compiled against that API,
# switch back to this:
# go install sigs.k8s.io/kustomize/pluginator
# In the meantime, use the local copy.
# Go module rules, and the existing violations of
# semver, mean that simply using the replace directive
# in the go.mod won't yield the desired result.
removeBin pluginator
# Install from whatever code is on disk.
(cd pluginator; go install .)
echo "Installed pluginator."
}
function runFunc {
@@ -32,7 +53,11 @@ function runFunc {
}
function testGoLangCILint {
go run "github.com/golangci/golangci-lint/cmd/golangci-lint" run ./...
# TODO(2018/Oct/19): After the API is in place, reinstate this
# The flux in go.mod files causing troubles possibly related to
# https://github.com/golangci/golangci-lint/issues/761
# go run "github.com/golangci/golangci-lint/cmd/golangci-lint" run ./...
echo "Skipping linting for now."
}
function testGoTests {
@@ -60,9 +85,10 @@ function testGoTests {
}
function testExamplesAgainstLatestRelease {
/bin/rm -f $(go env GOPATH)/bin/kustomize
removeBin kustomize
# Install latest release.
(cd ~; go get sigs.k8s.io/kustomize/v3/cmd/kustomize@v3.2.0)
(cd ~; GO111MODULE=on go get sigs.k8s.io/kustomize/v3/cmd/kustomize@v3.2.0)
go run "github.com/monopole/mdrip" --mode test --label testAgainstLatestRelease ./examples
@@ -78,7 +104,7 @@ function testExamplesAgainstLatestRelease {
}
function testExamplesAgainstHead {
/bin/rm -f $(go env GOPATH)/bin/kustomize
removeBin kustomize
# Install from head.
(cd kustomize; go install .)
# To test examples of unreleased features, add
@@ -88,7 +114,7 @@ function testExamplesAgainstHead {
}
function generateCode {
./plugin/generateBuiltins.sh $preferredGoPath
./api/plugins/builtinhelpers/generateBuiltins.sh $preferredGoPath
}
# This script tries to work for both travis
@@ -122,9 +148,6 @@ function setPreferredGoPathAndUnsetGoPath {
echo "preferredGoPath=$preferredGoPath"
}
# Until go v1.13, set this explicitly.
export GO111MODULE=on
# We don't want GOPATH to be defined, as it
# has too much baggage.
setPreferredGoPathAndUnsetGoPath