Add release note generator; tweak test coverage reporting, fixup docs (#276)

Tweak script, add make target

refactored makefile

removed redundanty vendor exclusion

Updated dev readme and release doc

eval when non-docker

review comment changes

spelling
This commit is contained in:
Jonathan Cope 2018-07-26 17:20:41 -05:00 committed by Jeff Vance
parent 36b039d129
commit eb2190eb0d
7 changed files with 153 additions and 51 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ _out/*
bin/* bin/*
manifests/generated/* manifests/generated/*
.coverprofile .coverprofile
release-announcement

View File

@ -47,10 +47,9 @@ script:
- "sed \"s#cdi.kubevirt.io/storage.import.endpoint:.*#cdi.kubevirt.io/storage.import.endpoint: \"$SRC#\"\" manifests/example/golden-pvc.yaml | kubectl apply -f -" - "sed \"s#cdi.kubevirt.io/storage.import.endpoint:.*#cdi.kubevirt.io/storage.import.endpoint: \"$SRC#\"\" manifests/example/golden-pvc.yaml | kubectl apply -f -"
- k_wait_all_running pods - k_wait_all_running pods
- kubectl get pods --all-namespaces - kubectl get pods --all-namespaces
- if [[ ${TRAVIS_PULL_REQUEST} == 'false' ]]; then make goveralls && make test-functional; else make test; fi - make goveralls && make test-functional
before_deploy: before_deploy:
- git remote set-url origin https://"${GH_USER}":"${GH_TOKEN}"@github.com/kubevirt/containerized-data-importer.git
- docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" - docker login -u="$DOCKER_USER" -p="$DOCKER_PASS"
deploy: deploy:

View File

@ -12,8 +12,6 @@
#See the License for the specific language governing permissions and #See the License for the specific language governing permissions and
#limitations under the License. #limitations under the License.
DOCKER=1
.PHONY: build build-controller build-importer \ .PHONY: build build-controller build-importer \
docker docker-controller docker-cloner docker-importer \ docker docker-controller docker-cloner docker-importer \
test test-functional test-unit \ test test-functional test-unit \
@ -21,23 +19,24 @@ DOCKER=1
vet \ vet \
format \ format \
manifests \ manifests \
goveralls goveralls \
release-description
DOCKER=1
ifeq (${DOCKER}, 1)
DO=./hack/build/in-docker
else
DO=eval
endif
all: docker all: docker
clean: clean:
ifeq (${DOCKER}, 1) ${DO} "./hack/build/build-go.sh clean; rm -rf bin/* _out/* manifests/generated/* .coverprofile release-announcement"
./hack/build/in-docker "./hack/build/build-go.sh clean; rm -rf bin/* _out/* manifests/generated/* .coverprofile"
else
./hack/build/build-go.sh clean; rm -rf bin/* _out/* manifests/generated/* .coverprofile
endif
build: build:
ifeq (${DOCKER}, 1) ${DO} "./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} ./hack/build/build-manifests.sh ${WHAT} && ./hack/build/build-copy-artifacts.sh ${WHAT}"
./hack/build/in-docker "./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} ./hack/build/build-manifests.sh ${WHAT} && ./hack/build/build-copy-artifacts.sh ${WHAT}"
else
./hack/build/build-go.sh clean && ./hack/build/build-go.sh build ${WHAT} && ./hack/build/build-manifests.sh && ./hack/build/build-copy-artifacts.sh ${WHAT}
endif
build-controller: WHAT = cmd/cdi-controller build-controller: WHAT = cmd/cdi-controller
build-controller: build build-controller: build
@ -46,11 +45,7 @@ build-importer: build
# Note, the cloner is a bash script and has nothing to build # Note, the cloner is a bash script and has nothing to build
test: test:
ifeq (${DOCKER}, 1) ${DO} "./hack/build/build-go.sh test ${WHAT}"
./hack/build/in-docker "./hack/build/build-go.sh test ${WHAT}"
else
./hack/build/build-go.sh test ${WHAT}
endif
test-unit: WHAT = pkg/ test-unit: WHAT = pkg/
test-unit: test test-unit: test
@ -81,25 +76,16 @@ publish: docker
./hack/build/build-docker.sh publish ${WHAT} ./hack/build/build-docker.sh publish ${WHAT}
vet: vet:
ifeq (${DOCKER}, 1) ${DO} "./hack/build/build-go.sh vet ${WHAT}"
./hack/build/in-docker "./hack/build/build-go.sh vet ${WHAT}"
else
./hack/build/build-go.sh vet ${WHAT}
endif
format: format:
ifeq (${DOCKER}, 1) ${DO} "./hack/build/format.sh"
./hack/build/in-docker "./hack/build/format.sh"
else
./hack/build/format.sh
endif
manifests: manifests:
ifeq (${DOCKER}, 1) ${DO} "DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} ./hack/build/build-manifests.sh"
./hack/build/in-docker "DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} ./hack/build/build-manifests.sh"
else
./hack/build/build-manifests.sh
endif
goveralls: goveralls:
./hack/build/in-docker "TRAVIS_JOB_ID=${TRAVIS_JOB_ID} TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_BRANCH=${TRAVIS_BRANCH} ./hack/build/goveralls.sh" ${DO} "TRAVIS_JOB_ID=${TRAVIS_JOB_ID} TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} TRAVIS_BRANCH=${TRAVIS_BRANCH} ./hack/build/goveralls.sh"
release-description:
./hack/build/release-description.sh ${RELREF} ${PREREF}

View File

@ -1,5 +1,10 @@
# Version and Release # Version and Release
* [Overview](#overview)
* [Version Scheme](#version-scheme)
* [Releasing a New Version](#releasing-a-new-version)
* [Verifying the Release](#verifying-the-release)
* [Travis CI](#travis-ci)
### Overview ### Overview
### Version Scheme ### Version Scheme
@ -14,41 +19,46 @@ CDI adheres to the [semantic version definitions](https://semver.org/) format of
### Releasing a New Version ### Releasing a New Version
The version number is tracked in several files in CDI as well as through a git tag. To reduce the chance of human error, a help script is used to change the version in all known locations. Release branches are used to isolate a stable version of CDI. Git tags are used within these release branches to track incrementing of Minor and Patch versions. When a Major version is incremented, a new stable branch should be created corresponding to the release.
DO NOT EDIT ANY VERSION STRINGS IN CDI!! - Release branches should adhere to the `release-v#.#.#` pattern.
1. Set the new release version - Tags should adhere to the `v#.#.#(-alpha.#)` pattern.
A recipe has been provided in `Makefile` to handle version setting. Use ONLY this command to set versions. Do NOT edit the values manually. When creating a new release branch, follow the below process. This assumes that `origin` references a fork of `kubevirt/containerized-data-importer` and you have added the main repository as the remote alias `<upstream>`. If you have cloned `kubevirt/containerized-data-importer` directly, omit the `<upstream>` alias.
$ make set-version VERSION=v#.#.# 1. Make sure you have the latest upstream code
The `set-version` recipe will locate files in CDI containing the current version value, substitute in the new version, then commit and tag the changes. The user will be shown a list of files to be changed and prompted to continue before the substitutions are made. `$ git pull <upstream> master`
1. Verify the changes 1. Create a new branch from `<upstream>/master`
Before publishing the changes, make one last check to verify the correct version value has been substituted in. `$ git checkout <upstream>/master -b release-v#.#.#`
$ git diff HEAD~1 1. Create a tag corresponding to the version
1. Push the changes to Github `$ git tag -a -m "Release of version v#.#.#" v#.#.#`
$ git push upstream master && git push upstream --tags 1. Push the new branch and tag to the main kubevirt repo. (If you have cloned the main repo directly, use `origin` for <`upstream`>)
Travis CI will detect the new tag and execute the deploy script. This will publish the newly updated controller manifest and CDI binaries to git releases. `$ git push -u <upstream> release-v#.#.# && git push <upstream> --tags`
CI will be triggered when a tag matching `v#.#.#(-alpha.#)` is pushed. The automation will handle release artifact testing, building, and publishing.
Following the release, `make release-description` should be executed to generate a github release description template. The `Notable Changes` section should be filled in manually, briefly listing major changes that the new release includes. Copy/Paste this template into the corresponding github release.
#### Verifying the Release #### Verifying the Release
##### Images ##### Images
- Check hub.docker.com/r/kubevirt repository for the newly tagged images. If you do not see the tags corresponding to the version, something has gone wrong. - Check hub.docker.com/r/kubevirt repository for the newly tagged images. If you do not see the tags corresponding to the version, check the travis build log for errors.
[CDI-Controller](https://hub.docker.com/r/kubevirt/cdi-controller/tags/) [CDI-Controller](https://hub.docker.com/r/kubevirt/cdi-controller/tags/)
[CDI-Importer](https://hub.docker.com/r/kubevirt/cdi-importer/) [CDI-Importer](https://hub.docker.com/r/kubevirt/cdi-importer/)
##### Travis CI Jobs [CDI-Cloner](https://hub.docker.com/r/kubevirt/cdi-cloner/)
##### Travis CI
Track the CI job for the pushed tag. Navigate to the [CDI Travis dashboard](https://travis-ci.org/kubevirt/containerized-data-importer/branches) and select the left most colored box (either Green, Yellow, or Red) for the branch corresponding to the version Track the CI job for the pushed tag. Navigate to the [CDI Travis dashboard](https://travis-ci.org/kubevirt/containerized-data-importer/branches) and select the left most colored box (either Green, Yellow, or Red) for the branch corresponding to the version

View File

@ -1,5 +1,16 @@
## Getting Started For Developers ## Getting Started For Developers
* [Download CDI](#download-cdi)
* [Lint, Test, Build](#lint-test-build)
* [Make Targets](#make-targets)
* [Make Variables](#make-variables)
* [Submit PRs](#submit-prs)
* [Releases](#releases)
* [Vendoring Dependencies](#vendoring-dependencies)
* [S3 Compatible Client Setup](#s3-compatible-client-setup)
* [AWS S3 CLI](#aws-s3-cli)
* [Minio CLI](#minio-cli)
### Download CDI ### Download CDI
To download the source directly, simply To download the source directly, simply
@ -59,6 +70,10 @@ These may be passed to a target as `$ make VARIABLE=value target`
All PRs should originate from forks of kubevirt.io/containerized-data-importer. Work should not be done directly in the upstream repository. Open new working branches from master/HEAD of your forked repository and push them to your remote repo. Then submit PRs of the working branch against the upstream master branch. All PRs should originate from forks of kubevirt.io/containerized-data-importer. Work should not be done directly in the upstream repository. Open new working branches from master/HEAD of your forked repository and push them to your remote repo. Then submit PRs of the working branch against the upstream master branch.
### Releases
Release practices are described in the [release doc](/doc/releases.md).
### Vendoring Dependencies ### Vendoring Dependencies
This project uses `glide` as it's dependency manager. At present, all project dependencies are vendored; using `glide` is unnecessary in the normal work flow. This project uses `glide` as it's dependency manager. At present, all project dependencies are vendored; using `glide` is unnecessary in the normal work flow.

View File

@ -30,6 +30,6 @@ VERBOSITY=${VERBOSITY:-1}
PULL_POLICY=${PULL_POLICY:-IfNotPresent} PULL_POLICY=${PULL_POLICY:-IfNotPresent}
function allPkgs { function allPkgs {
ret=$(sed "s,kubevirt.io/containerized-data-importer,${CDI_DIR},g" <(go list ./... | grep -v -E "vendor|pkg/client" | sort -u )) ret=$(sed "s,kubevirt.io/containerized-data-importer,${CDI_DIR},g" <(go list ./... | grep -v "pkg/client" | sort -u ))
echo "$ret" echo "$ret"
} }

View File

@ -0,0 +1,91 @@
#!/usr/bin/env bash
set -eou pipefail
underline() {
echo "$2"
printf "%0.s$1" $(seq ${#2})
}
log() { echo "$@" >&2; }
title() { underline "=" "$@"; }
section() { underline "-" "$@"; }
#
# All sorts of content
#
release_notes() {
log "Fetching release notes"
cat manual-release-notes || echo "FIXME manual notes needed"
}
summary() {
log "Building summary"
echo "This release follows $PREREF and consists of $(git log --oneline $RELSPANREF | wc -l) changes, contributed by"
echo -n "$(git shortlog -sne $RELSPANREF | wc -l) people, leading to"
echo "$(git diff --shortstat $RELSPANREF)."
}
downloads() {
log "Adding download urls"
local GHRELURL="https://github.com/kubevirt/containerized-data-importer/releases/tag/"
local RELURL="$GHRELURL$RELREF"
cat <<EOF
The source code and selected binaries are available for download at:
<$RELURL>.
Pre-built CDI containers are published on Docker Hub and can be viewed at:
<https://hub.docker.com/r/kubevirt/cdi-controller/>
<https://hub.docker.com/r/kubevirt/cdi-importer/>
<https://hub.docker.com/r/kubevirt/cdi-cloner/>.
EOF
}
shortlog() {
git shortlog -sne $RELSPANREF | sed "s/^/ /"
}
usage() {
echo "Usage: $0 [RELEASE_REF] [PREV_RELEASE_REF]"
}
main() {
log "Span: $RELSPANREF"
cat <<EOF | tee release-announcement
$(summary)
$(downloads)
$(section "Notable changes")
$(release_notes)
$(section "Contributors")
$(git shortlog -sne $RELSPANREF | wc -l) people contributed to this release:
$(shortlog)
Additional Resources
--------------------
- Mailing list: <https://groups.google.com/forum/#!forum/kubevirt-dev>
- [How to contribute][contributing]
[contributing]: https://github.com/kubevirt/containerized-data-importer/blob/master/hack/README.md
EOF
}
#
# Let's get the party started
#
RELREF="$1"
PREREF="$2"
RELREF=${RELREF:-$(git describe --abbrev=0 --tags)}
PREREF=${PREREF:-$(git describe --abbrev=0 --tags $RELREF^)}
RELSPANREF=$PREREF..$RELREF
main
# vim: sw=2 et