Pin kustomize and the plugins to kust Api v0.2.0

This commit is contained in:
Jeffrey Regan
2019-11-11 19:34:54 -08:00
parent bae6418ca2
commit 2dd148af24
55 changed files with 307 additions and 183 deletions

View File

@@ -14,8 +14,6 @@ require (
github.com/rs/cors v1.7.0
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a // indirect
sigs.k8s.io/kustomize/api v0.1.1
sigs.k8s.io/kustomize/api v0.2.0
sigs.k8s.io/yaml v1.1.0
)
replace sigs.k8s.io/kustomize/api v0.0.0 => ../../api

61
hack/pinUnpinPluginApiDep.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
# This script unpins or repins the Go kustomize API dependence
# for all the plugins in the repo.
# Run from repo root, e.g.
#
# ./hack/pinUnpinPluginApiDep.sh pin v0.2.0
#
# or
#
# ./hack/pinUnpinPluginApiDep.sh unPin
#
set -o errexit
set -o nounset
set -o pipefail
operation=$1
version=$2
if [[ ("$operation" != "pin") && ("$operation" != "unPin") ]]; then
echo "unknown operation $operation"
exit 1
fi
function doUnPin {
oldV=$(grep -m 1 sigs.k8s.io/kustomize/api go.mod | awk '{print $2}')
go mod edit -replace=sigs.k8s.io/kustomize/api@${oldV}=$1
go mod tidy
}
function doPin {
oldV=$(grep -m 1 sigs.k8s.io/kustomize/api go.mod | awk '{print $2}')
go mod edit -dropreplace=sigs.k8s.io/kustomize/api@${oldV}
go mod edit -dropreplace=sigs.k8s.io/kustomize/api@v0.1.1
go mod edit -require=sigs.k8s.io/kustomize/api@$1
go mod tidy
}
function forEachGoMod {
for goMod in $(find $2 -name 'go.mod'); do
d=$(dirname "${goMod}")
echo $d
(cd $d; $1 $3)
done
}
function unPin {
forEachGoMod doUnPin ./plugin/builtin ../../../api
forEachGoMod doUnPin ./plugin/someteam.example.com ../../../../api
}
function pin {
forEachGoMod doPin ./plugin/builtin $version
forEachGoMod doPin ./plugin/someteam.example.com $version
}
$operation

View File

@@ -1,53 +0,0 @@
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
# This script unpins or repins the Go kustomize API dependence
# for all the plugins in the repo.
# Run this from repo root, e.g.
#
# ./hack/unpinRepinPluginApiDep.sh unPin v0.1.1
#
set -o errexit
set -o nounset
set -o pipefail
operation=$1
version=$2
if [[ ("$operation" != "unPin") && ("$operation" != "rePin") ]]; then
echo "unknown operation $operation"
exit 1
fi
function addReplace {
go mod edit -replace=sigs.k8s.io/kustomize/api@${version}=$1
go mod tidy
}
function dropReplace {
go mod edit -dropreplace=sigs.k8s.io/kustomize/api@${version}
go mod tidy
}
function forEachGoMod {
for goMod in $(find $2 -name 'go.mod'); do
d=$(dirname "${goMod}")
echo $d
(cd $d; $1 $3 )
done
}
function unPin {
forEachGoMod addReplace ./plugin/builtin ../../../api
forEachGoMod addReplace ./plugin/someteam.example.com ../../../../api
}
function rePin {
forEachGoMod dropReplace ./plugin/builtin
forEachGoMod dropReplace ./plugin/someteam.example.com
}
$operation