From 43683849f16b00a6a106129ad8404c41dd1f41d6 Mon Sep 17 00:00:00 2001 From: Bill Robinson Date: Mon, 28 Aug 2017 16:20:45 -0700 Subject: [PATCH 1/3] Makefile,scripts/release.sh: change release script to match release process for other repos (auth_proxy, install) Specifically, removed code for generating and uploading tarballs to Github and replaced it with a tag-based release system. Changes to the Contiv release process necessitated the alignment of the USE_RELEASE variable in scripts/release.sh with the other projects' release.sh files. Signed-off-by: Bill Robinson --- Makefile | 18 +----------------- scripts/release.sh | 45 ++++++++++++++++++++------------------------- 2 files changed, 21 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 4fe3887db..fb8d3afc5 100755 --- a/Makefile +++ b/Makefile @@ -15,9 +15,6 @@ NAME := netplugin VERSION_FILE := $(NAME)-version VERSION := `cat $(VERSION_FILE)` TAR_EXT := tar.bz2 -TAR_FILENAME := $(NAME)-$(VERSION).$(TAR_EXT) -TAR_LOC := . -TAR_FILE := $(TAR_LOC)/$(TAR_FILENAME) GO_MIN_VERSION := 1.7 GO_MAX_VERSION := 1.8 GO_VERSION := $(shell go version | cut -d' ' -f3 | sed 's/go//') @@ -321,20 +318,7 @@ host-plugin-release: @echo dev: (need docker login with user in contiv org) docker plugin push ${CONTIV_V2PLUGIN_NAME} -only-tar: - -tar: clean-tar - CONTIV_NODES=1 ${MAKE} build - @tar -jcf $(TAR_FILE) -C $(GOPATH)/src/github.com/contiv/netplugin/bin netplugin netmaster netctl contivk8s netcontiv -C $(GOPATH)/src/github.com/contiv/netplugin/scripts contrib/completion/bash/netctl -C $(GOPATH)/src/github.com/contiv/netplugin/scripts get-contiv-diags - -clean-tar: - @rm -f $(TAR_LOC)/*.$(TAR_EXT) - @rm -f ${VERSION_FILE} - # GITHUB_USER and GITHUB_TOKEN are needed be set to run github-release -release: tar - TAR_FILENAME=$(TAR_FILENAME) TAR_FILE=$(TAR_FILE) VERSION=$(VERSION) \ +release: OLD_VERSION=${OLD_VERSION} BUILD_VERSION=${BUILD_VERSION} \ USE_RELEASE=${USE_RELEASE} scripts/release.sh - @make clean-tar - diff --git a/scripts/release.sh b/scripts/release.sh index c1f2d73be..4fdf2e33c 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,36 +1,33 @@ #!/bin/bash - -set -euo pipefail - -if [ -z "${VERSION-}" ]; then - echo "VERSION needs to be defined to make a release" +# Assumes following variables to be defined: +# OLD_VERSION - previous version against which to create changelog +# BUILD_VERSION - new version being released +# GITHUB_USER - contiv +# GITHUB_TOKEN - your github token +# USE_RELEASE - if 0 or not set, will make a pre-release + +if [ -z "$(which github-release)" ]; then + echo "Please install github-release before running this script" + echo "You may download a release from https://github.com/aktau/github-release/releases or run 'go get github.com/aktau/github-release' if you have Go installed" exit 1 fi -if [ -z "${TAR_FILENAME-}" ]; then - echo "TAR_FILENAME needs to be defined to make a release" +if [ -z "$BUILD_VERSION" ]; then + echo "A release requires BUILD_VERSION to be defined" exit 1 fi -if [ ! -f "$TAR_FILE" ]; then - echo "TAR_FILE ($TAR_FILE) doesn't exist" +if [ -z "$OLD_VERSION" ]; then + echo "A release requires OLD_VERSION to be defined" exit 1 fi -if [ -n "$USE_RELEASE" ]; then - if [ -z "$OLD_VERSION" ]; then - echo "A release requires OLD_VERSION to be defined" - exit 1 - fi - if [ "$OLD_VERSION" != "none" ]; then - comparison="$OLD_VERSION..HEAD" - fi - pre_release="" -else - latest_tag=$(git tag | egrep -v "^v" | grep UTC | sort -V | tail -1) +if [ "$OLD_VERSION" != "none" ]; then + comparison="$OLD_VERSION..HEAD" +fi - comparison="$latest_tag..HEAD" - echo "Making a pre-release..." +if [ "$USE_RELEASE" != "1" ]; then + echo "Making a pre-release.." pre_release="-p" fi @@ -46,6 +43,4 @@ else fi set -x -( (github-release -v release $pre_release -r netplugin -t $VERSION -d "**Changelog**
$changelog") \ - && (github-release -v upload -r netplugin -t $VERSION -n $TAR_FILENAME -f $TAR_FILE \ - || github-release -v delete -r netplugin -t $VERSION)) || exit 1 +( (github-release -v release $pre_release -r netplugin -t $BUILD_VERSION -d "**Changelog**
$changelog")) || exit 1 From 2a9348b00a28ff27a030e0bd10bda5859b562484 Mon Sep 17 00:00:00 2001 From: Bill Robinson Date: Mon, 25 Sep 2017 17:59:40 -0700 Subject: [PATCH 2/3] Makefile,scripts/release.sh: revert deletion of TAR_FILENAME/TAR_FILE vars from Makefile and bring back `tar` target This corrects an undesired change in logic introduced in https://github.com/contiv/netplugin/pull/961 Signed-off-by: Bill Robinson --- Makefile | 17 ++++++++++++++++- scripts/release.sh | 15 ++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fb8d3afc5..ee432d80e 100755 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ NAME := netplugin VERSION_FILE := $(NAME)-version VERSION := `cat $(VERSION_FILE)` TAR_EXT := tar.bz2 +TAR_FILENAME := $(NAME)-$(VERSION).$(TAR_EXT) +TAR_LOC := . +TAR_FILE := $(TAR_LOC)/$(TAR_FILENAME) GO_MIN_VERSION := 1.7 GO_MAX_VERSION := 1.8 GO_VERSION := $(shell go version | cut -d' ' -f3 | sed 's/go//') @@ -318,7 +321,19 @@ host-plugin-release: @echo dev: (need docker login with user in contiv org) docker plugin push ${CONTIV_V2PLUGIN_NAME} +only-tar: + +tar: clean-tar + CONTIV_NODES=1 ${MAKE} build + @tar -jcf $(TAR_FILE) -C $(GOPATH)/src/github.com/contiv/netplugin/bin netplugin netmaster netctl contivk8s netcontiv -C $(GOPATH)/src/github.com/contiv/netplugin/scripts contrib/completion/bash/netctl -C $(GOPATH)/src/github.com/contiv/netplugin/scripts get-contiv-diags + +clean-tar: + @rm -f $(TAR_LOC)/*.$(TAR_EXT) + @rm -f ${VERSION_FILE} + # GITHUB_USER and GITHUB_TOKEN are needed be set to run github-release -release: +release: tar + TAR_FILENAME=$(TAR_FILENAME) TAR_FILE=$(TAR_FILE) \ OLD_VERSION=${OLD_VERSION} BUILD_VERSION=${BUILD_VERSION} \ USE_RELEASE=${USE_RELEASE} scripts/release.sh + @make clean-tar diff --git a/scripts/release.sh b/scripts/release.sh index 4fdf2e33c..04b0c88db 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -12,6 +12,17 @@ if [ -z "$(which github-release)" ]; then exit 1 fi + +if [ -z "${TAR_FILENAME-}" ]; then + echo "TAR_FILENAME needs to be defined to make a release" + exit 1 +fi + +if [ ! -f "$TAR_FILE" ]; then + echo "TAR_FILE ($TAR_FILE) doesn't exist" + exit 1 +fi + if [ -z "$BUILD_VERSION" ]; then echo "A release requires BUILD_VERSION to be defined" exit 1 @@ -43,4 +54,6 @@ else fi set -x -( (github-release -v release $pre_release -r netplugin -t $BUILD_VERSION -d "**Changelog**
$changelog")) || exit 1 +( (github-release -v release $pre_release -r netplugin -t $BUILD_VERSION -d "**Changelog**
$changelog") \ + && (github-release -v upload -r netplugin -t $BUILD_VERSION -n $TAR_FILENAME -f $TAR_FILE \ + || github-release -v delete -r netplugin -t $BUILD_VERSION)) || exit 1 From 52681cf87c6f5f09fcc47425c832bc08e915232a Mon Sep 17 00:00:00 2001 From: unclejack Date: Sat, 30 Sep 2017 00:12:49 +0300 Subject: [PATCH 3/3] version/CURRENT_VERSION: bump version to 1.1.3 Signed-off-by: Cristian Staretu --- version/CURRENT_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/CURRENT_VERSION b/version/CURRENT_VERSION index 8428158dc..781dcb07c 100644 --- a/version/CURRENT_VERSION +++ b/version/CURRENT_VERSION @@ -1 +1 @@ -1.1.2 \ No newline at end of file +1.1.3