Skip to content

Commit

Permalink
Merge 61050c5 into 36b039d
Browse files Browse the repository at this point in the history
  • Loading branch information
copejon committed Jul 26, 2018
2 parents 36b039d + 61050c5 commit 28be5f0
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 51 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ _out/*
bin/*
manifests/generated/*
.coverprofile
release-announcement
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -"
- k_wait_all_running pods
- 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:
- 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"

deploy:
Expand Down
54 changes: 20 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,31 @@
#See the License for the specific language governing permissions and
#limitations under the License.

DOCKER=1

.PHONY: build build-controller build-importer \
docker docker-controller docker-cloner docker-importer \
test test-functional test-unit \
publish \
vet \
format \
manifests \
goveralls

all: docker
goveralls \
release-description

clean:
DOCKER=1
ifeq (${DOCKER}, 1)
./hack/build/in-docker "./hack/build/build-go.sh clean; rm -rf bin/* _out/* manifests/generated/* .coverprofile"
DO=./hack/build/in-docker
else
./hack/build/build-go.sh clean; rm -rf bin/* _out/* manifests/generated/* .coverprofile
DO=eval
endif

all: docker

clean:
${DO} "./hack/build/build-go.sh clean; rm -rf bin/* _out/* manifests/generated/* .coverprofile release-announcement"

build:
ifeq (${DOCKER}, 1)
./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
${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}"


build-controller: WHAT = cmd/cdi-controller
build-controller: build
Expand All @@ -46,11 +45,7 @@ build-importer: build
# Note, the cloner is a bash script and has nothing to build

test:
ifeq (${DOCKER}, 1)
./hack/build/in-docker "./hack/build/build-go.sh test ${WHAT}"
else
./hack/build/build-go.sh test ${WHAT}
endif
${DO} "./hack/build/build-go.sh test ${WHAT}"

test-unit: WHAT = pkg/
test-unit: test
Expand Down Expand Up @@ -81,25 +76,16 @@ publish: docker
./hack/build/build-docker.sh publish ${WHAT}

vet:
ifeq (${DOCKER}, 1)
./hack/build/in-docker "./hack/build/build-go.sh vet ${WHAT}"
else
./hack/build/build-go.sh vet ${WHAT}
endif
${DO} "./hack/build/build-go.sh vet ${WHAT}"

format:
ifeq (${DOCKER}, 1)
./hack/build/in-docker "./hack/build/format.sh"
else
./hack/build/format.sh
endif
${DO} "./hack/build/format.sh"

manifests:
ifeq (${DOCKER}, 1)
./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
${DO} "DOCKER_REPO=${DOCKER_REPO} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} ./hack/build/build-manifests.sh"

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}
38 changes: 24 additions & 14 deletions doc/releases.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# 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

### Version Scheme
Expand All @@ -14,41 +19,46 @@ CDI adheres to the [semantic version definitions](https://semver.org/) format of

### 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

##### 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-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
15 changes: 15 additions & 0 deletions hack/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## 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

To download the source directly, simply
Expand Down Expand Up @@ -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.

### Releases

Release practices are described in the [release doc](/doc/releases.md).

### 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.
Expand Down
2 changes: 1 addition & 1 deletion hack/build/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ VERBOSITY=${VERBOSITY:-1}
PULL_POLICY=${PULL_POLICY:-IfNotPresent}

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"
}
91 changes: 91 additions & 0 deletions hack/build/release-description.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 28be5f0

Please sign in to comment.