diff --git a/.circleci/config.yml b/.circleci/config.yml index 039a220..b7d6f6d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: circleci/golang:1.13 + - image: circleci/golang:1.14 working_directory: /go/src/github.com/servicemeshinterface/smi-sdk-go steps: - checkout diff --git a/docs/release_process.md b/docs/release_process.md index 2ec5f97..f9bf872 100644 --- a/docs/release_process.md +++ b/docs/release_process.md @@ -2,7 +2,11 @@ This document describes the release process for this project. Releases are published via GitHub releases. -All releases will have a [semantic version](https://semver.org/) associated with them. This project will be versioned at 1.0.0 once the [Service Mesh Interface(SMI) specification](https://github.com/servicemeshinterface/smi-spec) is at 1.0.0 and all APIs defined in this project are at `v1`. All releases until then will be marked `v0.x.0` where `x` is incremented with each release. +All releases will have a [semantic version](https://semver.org/) associated with them. +This project will be versioned at 1.0.0 once the +[Service Mesh Interface(SMI) specification](https://github.com/servicemeshinterface/smi-spec) +is at 1.0.0 and all APIs defined in this project are at `v1`. +All releases until then will be marked `v0.x.0` where `x` is incremented with each release. To perform a release of the smi-sdk-go project: @@ -11,10 +15,7 @@ To perform a release of the smi-sdk-go project: $ git tag -a v0.x.0 -m "version 0.x.0" $ git push origin v0.x.0 ``` -2. Then, generate all assets to upload with the git release: -```console -$ git checkout tags/v0.x.0 -$ make dist checksum -``` -3. Last, visit the [releases page](https://github.com/servicemeshinterface/smi-sdk-go/releases) to `Draft a new release` using the tag you just created and pushed. Be sure to include release notes on what changes are included in the release and upload the assets created in the previous step. +2. Last, visit the [releases page](https://github.com/servicemeshinterface/smi-sdk-go/releases) +to `Draft a new release` using the tag you just created and pushed. +Be sure to include release notes on what changes are included in the release. diff --git a/go.mod b/go.mod index 90233a8..d3528e0 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/servicemeshinterface/smi-sdk-go -go 1.13 +go 1.14 require ( github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect github.com/googleapis/gnostic v0.2.0 // indirect github.com/stretchr/testify v1.4.0 - k8s.io/api v0.17.2 - k8s.io/apimachinery v0.17.2 - k8s.io/client-go v0.17.2 - k8s.io/code-generator v0.17.2 + k8s.io/api v0.17.4 + k8s.io/apimachinery v0.17.4 + k8s.io/client-go v0.17.4 + k8s.io/code-generator v0.17.4 ) diff --git a/go.sum b/go.sum index ca8784f..2d68f79 100644 --- a/go.sum +++ b/go.sum @@ -154,8 +154,8 @@ golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo= +golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495 h1:I6A9Ag9FpEKOjcKrRNjQkPHawoXIhKyTGfvvjFAiiAk= @@ -249,18 +249,18 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.17.2 h1:NF1UFXcKN7/OOv1uxdRz3qfra8AHsPav5M93hlV9+Dc= -k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4= -k8s.io/apimachinery v0.17.2 h1:hwDQQFbdRlpnnsR64Asdi55GyCaIP/3WQpMmbNBeWr4= -k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg= -k8s.io/client-go v0.17.2 h1:ndIfkfXEGrNhLIgkr0+qhRguSD3u6DCmonepn1O6NYc= -k8s.io/client-go v0.17.2/go.mod h1:QAzRgsa0C2xl4/eVpeVAZMvikCn8Nm81yqVx3Kk9XYI= -k8s.io/code-generator v0.17.2 h1:pTwl3rLB1fUyxmvEzmVPMM0tBSdUehd7z+bDzpj4lPE= -k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= +k8s.io/api v0.17.4 h1:HbwOhDapkguO8lTAE8OX3hdF2qp8GtpC9CW/MQATXXo= +k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA= +k8s.io/apimachinery v0.17.4 h1:UzM+38cPUJnzqSQ+E1PY4YxMHIzQyCg29LOoGfo79Zw= +k8s.io/apimachinery v0.17.4/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= +k8s.io/client-go v0.17.4 h1:VVdVbpTY70jiNHS1eiFkUt7ZIJX3txd29nDxxXH4en8= +k8s.io/client-go v0.17.4/go.mod h1:ouF6o5pz3is8qU0/qYL2RnoxOPqgfuidYLowytyLJmc= +k8s.io/code-generator v0.17.4 h1:C3uu/IvQclEIO4ouUOXuoKWfc4765mYe0uebStg9CaY= +k8s.io/code-generator v0.17.4/go.mod h1:l8BLVwASXQZTo2xamW5mQNFCe1XPiAesVq7Y1t7PiQQ= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6 h1:4s3/R4+OYYYUKptXPhZKjQ04WJ6EhQQVFdjOFvCazDk= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190822140433-26a664648505 h1:ZY6yclUKVbZ+SdWnkfY+Je5vrMpKOxmGeKRbsXVmqYM= diff --git a/hack/tools.go b/hack/tools.go index 140fa54..a8e5864 100644 --- a/hack/tools.go +++ b/hack/tools.go @@ -4,4 +4,4 @@ package hack import ( _ "k8s.io/code-generator" -) \ No newline at end of file +) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 0fb9dc9..893c4a1 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -2,51 +2,43 @@ set -eu -# ROOT_PACKAGE :: the package (relative to $GOPATH/src) that is the target for code generation ROOT_PACKAGE="github.com/servicemeshinterface/smi-sdk-go" +ROOT_DIR="$(git rev-parse --show-toplevel)" -function generate_client() { +# get code-generator version from go.sum +CODEGEN_VERSION="$(grep 'k8s.io/code-generator' go.sum | awk '{print $2}' | head -1)" +CODEGEN_PKG="$(echo `go env GOPATH`"/pkg/mod/k8s.io/code-generator@${CODEGEN_VERSION}")" - SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - ROOT_DIR="$( cd $SCRIPT_ROOT/.. && pwd )" - GEN_VER=$( awk '/k8s.io\/code-generator/ { print $2 }' "$ROOT_DIR/go.mod" ) - CODEGEN_PKG=${GOPATH}/pkg/mod/k8s.io/code-generator@${GEN_VER} +# ensure we can execute the codegen script +chmod +x ${CODEGEN_PKG}/generate-groups.sh - # CUSTOM_RESOURCE_NAME :: the name of the custom resource that we're generating client code for +function generate_client() { CUSTOM_RESOURCE_NAME=$1 CUSTOM_RESOURCE_VERSIONS=$2 - # make the generate script executable - chmod +x ${CODEGEN_PKG}/generate-groups.sh - - # delete the generated code as this is additive, removed objects will not be cleaned - - # enumerate versions + # delete the generated deepcopy for V in ${CUSTOM_RESOURCE_VERSIONS//,/ }; do rm -f ${ROOT_DIR}/pkg/apis/${CUSTOM_RESOURCE_NAME}/${V}/zz_generated.deepcopy.go done + + # delete the generated code as this is additive, removed objects will not be cleaned rm -rf ${ROOT_DIR}/pkg/gen/client/${CUSTOM_RESOURCE_NAME} + # the generate-groups.sh script cannot handle group names with dashes, so we use smispec.io as the group name if [[ "$OSTYPE" == "darwin"* ]]; then find "${ROOT_DIR}/pkg/apis/${CUSTOM_RESOURCE_NAME}" -type f -exec sed -i '' 's/smi-spec.io/smispec.io/g' {} + else find "${ROOT_DIR}/pkg/apis/${CUSTOM_RESOURCE_NAME}" -type f -exec sed -i 's/smi-spec.io/smispec.io/g' {} + fi - # generate the code with: - # --output-base because this script should also be able to run inside the vendor dir of - # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir - # instead of the $GOPATH directly. For normal projects this can be dropped. - GO111MODULE="on" "${CODEGEN_PKG}"/generate-groups.sh \ - "deepcopy,client,informer,lister" \ + # run code generation + "${CODEGEN_PKG}"/generate-groups.sh all \ "$ROOT_PACKAGE/pkg/gen/client/$CUSTOM_RESOURCE_NAME" \ "$ROOT_PACKAGE/pkg/apis" \ $CUSTOM_RESOURCE_NAME:$CUSTOM_RESOURCE_VERSIONS \ - --go-header-file "${SCRIPT_ROOT}"/boilerplate.go.txt + --go-header-file "${ROOT_DIR}"/hack/boilerplate.go.txt - # The generate-groups.sh script cannot handle group names with dashes, so we use - # smispec.io as the group name, then replace it with smi-spec.io after code - # generation. + # replace smispec.io with smi-spec.io after code generation if [[ "$OSTYPE" == "darwin"* ]]; then find "${ROOT_DIR}/pkg/apis/${CUSTOM_RESOURCE_NAME}" -type f -exec sed -i '' 's/smispec.io/smi-spec.io/g' {} + find "${ROOT_DIR}/pkg/gen/client/${CUSTOM_RESOURCE_NAME}" -type f -exec sed -i '' 's/smispec.io/smi-spec.io/g' {} + @@ -69,4 +61,4 @@ generate_client "access" "v1alpha1" echo "" echo "##### Generating metrics client ######" -generate_client "metrics" "v1alpha1,v1alpha2" \ No newline at end of file +generate_client "metrics" "v1alpha1,v1alpha2" diff --git a/pkg/apis/metrics/v1alpha1/list_test.go b/pkg/apis/metrics/v1alpha1/list_test.go index bb4f892..867170e 100644 --- a/pkg/apis/metrics/v1alpha1/list_test.go +++ b/pkg/apis/metrics/v1alpha1/list_test.go @@ -11,9 +11,9 @@ func TestNewList(t *testing.T) { assert := assertLib.New(t) testCases := []struct { - obj *v1.ObjectReference + obj *v1.ObjectReference edges bool - link string + link string }{ { &v1.ObjectReference{ diff --git a/pkg/apis/metrics/v1alpha2/list_test.go b/pkg/apis/metrics/v1alpha2/list_test.go index 6697949..cc1fb0c 100644 --- a/pkg/apis/metrics/v1alpha2/list_test.go +++ b/pkg/apis/metrics/v1alpha2/list_test.go @@ -11,9 +11,9 @@ func TestNewList(t *testing.T) { assert := assertLib.New(t) testCases := []struct { - obj *v1.ObjectReference + obj *v1.ObjectReference edges bool - link string + link string }{ { &v1.ObjectReference{