From f05f34e13b01705963bae8af01222fced41dc127 Mon Sep 17 00:00:00 2001 From: Silas Davis <silas@monax.io> Date: Fri, 23 Feb 2018 14:42:51 +0000 Subject: [PATCH] Use Relic for release infrastrucutre and versioning Signed-off-by: Silas Davis <silas@monax.io> --- .circleci/config.yml | 2 + CHANGELOG.md | 66 ++++--- Gopkg.lock | 8 +- Makefile | 52 ++++-- NOTES.md | 1 + client/cmd/burrow-client.go | 5 +- cmd/burrow/main.go | 9 +- consensus/tendermint/abci/app.go | 4 +- project/cmd/changelog/main.go | 11 ++ project/cmd/notes/main.go | 11 ++ project/cmd/version/main.go | 11 ++ project/history.go | 126 +++++++++++++ rpc/service.go | 4 +- scripts/local_version.sh | 2 +- scripts/tag_release.sh | 41 +++++ util/version/cmd/main.go | 26 --- vendor/github.com/monax/relic/LICENSE | 201 +++++++++++++++++++++ vendor/github.com/monax/relic/history.go | 221 +++++++++++++++++++++++ vendor/github.com/monax/relic/version.go | 72 ++++++++ version/version.go | 134 -------------- 20 files changed, 791 insertions(+), 216 deletions(-) create mode 100644 NOTES.md create mode 100644 project/cmd/changelog/main.go create mode 100644 project/cmd/notes/main.go create mode 100644 project/cmd/version/main.go create mode 100644 project/history.go create mode 100755 scripts/tag_release.sh delete mode 100644 util/version/cmd/main.go create mode 100644 vendor/github.com/monax/relic/LICENSE create mode 100644 vendor/github.com/monax/relic/history.go create mode 100644 vendor/github.com/monax/relic/version.go delete mode 100644 version/version.go diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f8ef966..41e3fc37 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,8 @@ jobs: steps: - checkout - run: make test + # In case we miss compile errors not pulled into test paths + - run: make build test_integration: <<: *defaults diff --git a/CHANGELOG.md b/CHANGELOG.md index 59ce4188..e9923816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ -# burrow changelog -## v0.17.1 +# Hyperledger Burrow Changelog +## Version 0.17.1 Minor tweaks to docker build file -## v0.17.0 +## Version 0.17.0 This is a service release with some significant ethereum/solidity compatibility improvements and new logging features. It includes: - [Upgrade to use Tendermint v0.9.2](https://github.com/hyperledger/burrow/pull/595) @@ -17,28 +17,25 @@ Known issues: - SELFDESTRUCT opcode causes a panic when an account is removed. A [fix](https://github.com/hyperledger/burrow/pull/605) was produced but was [reverted](https://github.com/hyperledger/burrow/pull/636) pending investigation of a possible regression. -## v0.16.3 -This release adds an stop-gap fix to the `Transact` method so that it never -transfers value with the `CallTx` is generates. +## Version 0.16.3 +This release adds an stop-gap fix to the Transact method so that it never +transfers value with the CallTx is generates. -We hard-code `amount = fee` so that no value is transferred -regardless of fee sent. This fixes an invalid jump destination error arising +We hard-code amount = fee so that no value is transferred +regardless of fee sent. This fixes an invalid jump destination error arising from transferring value to non-payable functions with newer versions of solidity. -By doing this we can resolve some issues with users of the v0 RPC without making +By doing this we can resolve some issues with users of the v0 RPC without making a breaking API change. -## v0.16.2 -This release finalises our accession to the Hyperledger project and updates our -root package namespace to github.com/hyperledger/burrow. +## Version 0.16.2 +This release finalises our accession to the Hyperledger project and updates our root package namespace to github.com/hyperledger/burrow. -It also includes a bug fix for rpc/V0 so that BroadcastTx can accept any -transaction type and various pieces of internal clean-up. +It also includes a bug fix for rpc/V0 so that BroadcastTx can accept any transaction type and various pieces of internal clean-up. -## v0.16.1 -This release was an internal rename to 'Burrow' with some minor other attendant -clean up. +## Version 0.16.1 +This release was an internal rename to 'Burrow' with some minor other attendant clean up. -## v0.16.0 +## Version 0.16.0 This is a consolidation release that fixes various bugs and improves elements of the architecture across the Monax Platform to support a quicker release cadence. @@ -47,14 +44,14 @@ cadence. - [pull-510](https://github.com/hyperledger/burrow/pull/510) upgrade consensus engine to Tendermint v0.8.0 - [pull-507](https://github.com/hyperledger/burrow/pull/507) use sha3 for snative addresses for future-proofing - [pull-506](https://github.com/hyperledger/burrow/pull/506) alignment and consolidation for genesis and config between tooling and chains -- [pull-504](https://github.com/hyperledger/burrow/pull/504) relicense burrow to Apache 2.0 +- [pull-504](https://github.com/hyperledger/burrow/pull/504) relicense eris-db to Apache 2.0 - [pull-500](https://github.com/hyperledger/burrow/pull/500) introduce more strongly types secure native contracts - [pull-499](https://github.com/hyperledger/burrow/pull/499) introduce word256 and remove dependency on tendermint/go-common - [pull-493](https://github.com/hyperledger/burrow/pull/493) re-introduce GenesisTime in GenesisDoc -- Logging system overhauled based on the central logging interface of go-kit log. Configuration lacking in this release but should be in 0.16.1. Allows powerful routing, filtering, and output options for better operations and increasing the observability of a burrow blockchain. More to follow. -- Genesis making is improved and moved into burrow. -- Config templating is moved into burrow for better synchronisation of server config between the consumer of it (burrow) and the producers of it (cli and other tools). +- Logging system overhauled based on the central logging interface of go-kit log. Configuration lacking in this release but should be in 0.16.1. Allows powerful routing, filtering, and output options for better operations and increasing the observability of an eris blockchain. More to follow. +- Genesis making is improved and moved into eris-db. +- Config templating is moved into eris-db for better synchronisation of server config between the consumer of it (eris-db) and the producers of it (eris cli and other tools). - Some documentation updates in code and in specs. - [pull-462](https://github.com/hyperledger/burrow/pull/499) Makefile added to capture conventions around building and testing and replicate them across different environments such as continuous integration systems. @@ -65,11 +62,21 @@ cadence. - [pull-468](https://github.com/hyperledger/burrow/pull/468) correct specifications for params on unsubscribe on rpc/tendermint - [pull-465](https://github.com/hyperledger/burrow/pull/465) fix divergence from JSON-RPC spec for Response object - [pull-366](https://github.com/hyperledger/burrow/pull/366) correction to circle ci script -- [pull-379](https://github.com/hyperledger/burrow/pull/379) more descriptive error message for burrow-client +- [pull-379](https://github.com/hyperledger/burrow/pull/379) more descriptive error message for eris-client -## v0.12.0 -This release marks the start of burrow as the full permissioned blockchain node - of the Monax Platform with the Tendermint permissioned consensus engine. + +## Version 0.15.0 +This release was elided to synchronise release versions with tooling + +## Version 0.14.0 +This release was elided to synchronise release versions with tooling + +## Version 0.13.0 +This release was elided to synchronise release versions with tooling + +## Version 0.12.0 +This release marks the start of Eris-DB as the full permissioned blockchain node + of the Eris platform with the Tendermint permissioned consensus engine. This involved significant refactoring of almost all parts of the code, but provides a solid foundation to build the next generation of advanced permissioned smart contract blockchains. @@ -82,7 +89,8 @@ This release marks the start of burrow as the full permissioned blockchain node - Support DELEGATECALL opcode in Ethereum Virtual Machine (important for solidity library calls) - ARM support - Docker image size reduced - - Introduction of burrow-client companion library for interacting with burrow + - Introduction of eris-client companion library for interacting with + eris:db - Improved single configuration file for all components written by eris-cm - Allow multiple event subscriptions from same host under rpc/tendermint @@ -101,4 +109,6 @@ This release marks the start of burrow as the full permissioned blockchain node - Bugfixes (incomplete list) - [EVM] Fix calculation of child CALL gaslimit (allowing solidity library calls to work properly) - [RPC/v0] Fix blocking event subscription in transactAndHold (preventing return in Javascript libraries) - - [Blockchain] Fix getBlocks to respect block height cap + - [Blockchain] Fix getBlocks to respect block height cap. + + diff --git a/Gopkg.lock b/Gopkg.lock index 828659ed..ea2371c1 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -169,6 +169,12 @@ revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" version = "v0.0.3" +[[projects]] + name = "github.com/monax/relic" + packages = ["."] + revision = "f24b36b5f6f7f5c6034c89a6a47de1bfbbf7787e" + version = "v1.1.0" + [[projects]] name = "github.com/pkg/errors" packages = ["."] @@ -480,6 +486,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "4269612536b67891e85fa038e9d6c0a41fd5fcdf61bf1056aedd331077efa173" + inputs-digest = "7de732c5f18fd5e9f0e3d92740cb3280da0d4ae86648dee9dd85ba2ecab47f06" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Makefile b/Makefile index 00f9c54a..b6670e8b 100644 --- a/Makefile +++ b/Makefile @@ -10,21 +10,10 @@ SHELL := /bin/bash REPO := $(shell pwd) GOFILES_NOVENDOR := $(shell find ${REPO} -type f -name '*.go' -not -path "${REPO}/vendor/*") PACKAGES_NOVENDOR := $(shell go list ./... | grep -vF /vendor/) -VERSION := $(shell go run ./util/version/cmd/main.go) -VERSION_MIN := $(shell echo ${VERSION} | cut -d . -f 1-2) COMMIT_SHA := $(shell echo `git rev-parse --short --verify HEAD`) DOCKER_NAMESPACE := quay.io/monax - -.PHONY: greet -greet: - @echo "Hi! I'm the marmot that will help you with burrow v${VERSION}" - -.PHONY: version -version: - @echo "${VERSION}" - ### Formatting, linting and vetting # check the code for style standards; currently enforces go formatting. @@ -124,6 +113,13 @@ build_race_db: build_race_client: go build -race -o ${REPO}/target/burrow-client-${COMMIT_SHA} ./client/cmd/burrow-client +### Build docker images for github.com/hyperledger/burrow + +# build docker image for burrow +.PHONY: build_docker_db +build_docker_db: check + @scripts/build_tool.sh + ### Testing github.com/hyperledger/burrow # test burrow @@ -142,16 +138,34 @@ test_integration: test_race: build_race @go test -race ${PACKAGES_NOVENDOR} -### Build docker images for github.com/hyperledger/burrow - -# build docker image for burrow -.PHONY: build_docker_db -build_docker_db: check - @scripts/build_tool.sh - ### Clean up # clean removes the target folder containing build artefacts .PHONY: clean clean: - -rm -r ./target + -rm -r ./target + +### Release and versioning + +# Print version +.PHONY: version +version: + @go run ./project/cmd/version/main.go + +# Generate full changelog of all release notes +CHANGELOG.md: project/history.go project/cmd/changelog/main.go + @go run ./project/cmd/changelog/main.go > CHANGELOG.md + +# Generated release note for this version +NOTES.md: project/history.go project/cmd/notes/main.go + @go run ./project/cmd/notes/main.go > NOTES.md + +.PHONY: docs +docs: CHANGELOG.md NOTES.md + +# Tag the current HEAD commit with the current release defined in +# ./release/release.go +.PHONY: tag_release +tag_release: test check CHANGELOG.md NOTES.md build + @scripts/tag_release.sh + diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 00000000..a5d00090 --- /dev/null +++ b/NOTES.md @@ -0,0 +1 @@ +Minor tweaks to docker build file diff --git a/client/cmd/burrow-client.go b/client/cmd/burrow-client.go index b06833f4..990f6589 100644 --- a/client/cmd/burrow-client.go +++ b/client/cmd/burrow-client.go @@ -19,7 +19,7 @@ import ( "strconv" "github.com/hyperledger/burrow/client" - "github.com/hyperledger/burrow/version" + "github.com/hyperledger/burrow/project" "github.com/spf13/cobra" ) @@ -34,7 +34,8 @@ var BurrowClientCmd = &cobra.Command{ Made with <3 by Monax Industries. Complete documentation is available at https://monax.io/docs -` + "\nVERSION:\n " + version.GetSemanticVersionString(), + +VERSION: ` + project.History.CurrentVersion().String(), Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, } diff --git a/cmd/burrow/main.go b/cmd/burrow/main.go index 9f24df90..146a5d64 100644 --- a/cmd/burrow/main.go +++ b/cmd/burrow/main.go @@ -14,6 +14,7 @@ import ( logging_config "github.com/hyperledger/burrow/logging/config" "github.com/hyperledger/burrow/logging/config/presets" "github.com/hyperledger/burrow/logging/loggers" + "github.com/hyperledger/burrow/project" "github.com/jawher/mow.cli" ) @@ -26,9 +27,15 @@ func main() { configOpt := burrow.StringOpt("c config", "", "Use the a specified burrow config TOML file") - burrow.Spec = "[--config=<config file>] [--genesis=<genesis json file>]" + versionOpt := burrow.BoolOpt("v version", false, "Print the Burrow version") + + burrow.Spec = "[--config=<config file>] [--genesis=<genesis json file>] [--version]" burrow.Action = func() { + if *versionOpt { + fmt.Println(project.History.CurrentVersion().String()) + os.Exit(0) + } // We need to reflect on whether this obscures where values are coming from conf := config.DefaultBurrowConfig() // We treat logging a little differently in that if anything is set for logging we will not diff --git a/consensus/tendermint/abci/app.go b/consensus/tendermint/abci/app.go index 2142e90c..6a5627aa 100644 --- a/consensus/tendermint/abci/app.go +++ b/consensus/tendermint/abci/app.go @@ -11,8 +11,8 @@ import ( "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" logging_types "github.com/hyperledger/burrow/logging/types" + "github.com/hyperledger/burrow/project" "github.com/hyperledger/burrow/txs" - "github.com/hyperledger/burrow/version" abci_types "github.com/tendermint/abci/types" "github.com/tendermint/go-wire" ) @@ -50,7 +50,7 @@ func (app *abciApp) Info(info abci_types.RequestInfo) abci_types.ResponseInfo { tip := app.blockchain.Tip() return abci_types.ResponseInfo{ Data: responseInfoName, - Version: version.GetSemanticVersionString(), + Version: project.History.CurrentVersion().String(), LastBlockHeight: int64(tip.LastBlockHeight()), LastBlockAppHash: tip.AppHashAfterLastBlock(), } diff --git a/project/cmd/changelog/main.go b/project/cmd/changelog/main.go new file mode 100644 index 00000000..5bcbee7d --- /dev/null +++ b/project/cmd/changelog/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "fmt" + + "github.com/hyperledger/burrow/project" +) + +func main() { + fmt.Println(project.History.MustChangelog()) +} diff --git a/project/cmd/notes/main.go b/project/cmd/notes/main.go new file mode 100644 index 00000000..bf67ffd0 --- /dev/null +++ b/project/cmd/notes/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "fmt" + + "github.com/hyperledger/burrow/project" +) + +func main() { + fmt.Println(project.History.CurrentNotes()) +} diff --git a/project/cmd/version/main.go b/project/cmd/version/main.go new file mode 100644 index 00000000..1ec1b724 --- /dev/null +++ b/project/cmd/version/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "fmt" + + "github.com/hyperledger/burrow/project" +) + +func main() { + fmt.Println(project.History.CurrentVersion().String()) +} diff --git a/project/history.go b/project/history.go new file mode 100644 index 00000000..5c6f2eec --- /dev/null +++ b/project/history.go @@ -0,0 +1,126 @@ +package project + +import ( + "github.com/monax/relic" +) + +// The releases described by version string and changes, newest release first. +// The current release is taken to be the first release in the slice, and its +// version determines the single authoritative version for the next release. +// +// To cut a new release add a release to the front of this slice then run the +// release tagging script: ./scripts/tag_release.sh +var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow").MustDeclareReleases( + "0.17.1", + `Minor tweaks to docker build file`, + + "0.17.0", + `This is a service release with some significant ethereum/solidity compatibility improvements and new logging features. It includes: + +- [Upgrade to use Tendermint v0.9.2](https://github.com/hyperledger/burrow/pull/595) +- [Implemented dynamic memory](https://github.com/hyperledger/burrow/pull/607) assumed by the EVM bytecode produce by solidity, fixing various issues. +- Logging sinks and configuration - providing a flexible mechanism for configuring log flows and outputs see [logging section in readme](https://github.com/hyperledger/burrow#logging). Various other logging enhancements. +- Fix event unsubscription +- Remove module-specific versioning +- Rename suicide to selfdestruct +- SNative tweaks + +Known issues: + +- SELFDESTRUCT opcode causes a panic when an account is removed. A [fix](https://github.com/hyperledger/burrow/pull/605) was produced but was [reverted](https://github.com/hyperledger/burrow/pull/636) pending investigation of a possible regression.`, + + "0.16.3", + `This release adds an stop-gap fix to the Transact method so that it never +transfers value with the CallTx is generates. + +We hard-code amount = fee so that no value is transferred +regardless of fee sent. This fixes an invalid jump destination error arising +from transferring value to non-payable functions with newer versions of solidity. +By doing this we can resolve some issues with users of the v0 RPC without making +a breaking API change.`, + + "0.16.2", + `This release finalises our accession to the Hyperledger project and updates our root package namespace to github.com/hyperledger/burrow. + +It also includes a bug fix for rpc/V0 so that BroadcastTx can accept any transaction type and various pieces of internal clean-up.`, + + "0.16.1", + `This release was an internal rename to 'Burrow' with some minor other attendant clean up.`, + + "0.16.0", + `This is a consolidation release that fixes various bugs and improves elements +of the architecture across the Monax Platform to support a quicker release +cadence. + +#### Features and improvements (among others) +- [pull-510](https://github.com/hyperledger/burrow/pull/510) upgrade consensus engine to Tendermint v0.8.0 +- [pull-507](https://github.com/hyperledger/burrow/pull/507) use sha3 for snative addresses for future-proofing +- [pull-506](https://github.com/hyperledger/burrow/pull/506) alignment and consolidation for genesis and config between tooling and chains +- [pull-504](https://github.com/hyperledger/burrow/pull/504) relicense eris-db to Apache 2.0 +- [pull-500](https://github.com/hyperledger/burrow/pull/500) introduce more strongly types secure native contracts +- [pull-499](https://github.com/hyperledger/burrow/pull/499) introduce word256 and remove dependency on tendermint/go-common +- [pull-493](https://github.com/hyperledger/burrow/pull/493) re-introduce GenesisTime in GenesisDoc + +- Logging system overhauled based on the central logging interface of go-kit log. Configuration lacking in this release but should be in 0.16.1. Allows powerful routing, filtering, and output options for better operations and increasing the observability of an eris blockchain. More to follow. +- Genesis making is improved and moved into eris-db. +- Config templating is moved into eris-db for better synchronisation of server config between the consumer of it (eris-db) and the producers of it (eris cli and other tools). +- Some documentation updates in code and in specs. +- [pull-462](https://github.com/hyperledger/burrow/pull/499) Makefile added to capture conventions around building and testing and replicate them across different environments such as continuous integration systems. + +#### Bugfixes (among others) +- [pull-516](https://github.com/hyperledger/burrow/pull/516) Organize and add unit tests for rpc/v0 +- [pull-453](https://github.com/hyperledger/burrow/pull/453) Fix deserialisation for BroadcastTx on rpc/v0 +- [pull-476](https://github.com/hyperledger/burrow/pull/476) patch EXTCODESIZE for native contracts as solc ^v0.4 performs a safety check for non-zero contract code +- [pull-468](https://github.com/hyperledger/burrow/pull/468) correct specifications for params on unsubscribe on rpc/tendermint +- [pull-465](https://github.com/hyperledger/burrow/pull/465) fix divergence from JSON-RPC spec for Response object +- [pull-366](https://github.com/hyperledger/burrow/pull/366) correction to circle ci script +- [pull-379](https://github.com/hyperledger/burrow/pull/379) more descriptive error message for eris-client +`, + + "0.15.0", + "This release was elided to synchronise release versions with tooling", + + "0.14.0", + "This release was elided to synchronise release versions with tooling", + + "0.13.0", + "This release was elided to synchronise release versions with tooling", + + "0.12.0", + `This release marks the start of Eris-DB as the full permissioned blockchain node + of the Eris platform with the Tendermint permissioned consensus engine. + This involved significant refactoring of almost all parts of the code, + but provides a solid foundation to build the next generation of advanced + permissioned smart contract blockchains. + + Many changes are under the hood but here are the main externally + visible changes: + +- Features and improvements + - Upgrade to Tendermint 0.6.0 in-process consensus + - Support DELEGATECALL opcode in Ethereum Virtual Machine (important for solidity library calls) + - ARM support + - Docker image size reduced + - Introduction of eris-client companion library for interacting with + eris:db + - Improved single configuration file for all components written by eris-cm + - Allow multiple event subscriptions from same host under rpc/tendermint + + +- Tool changes + - Use glide instead of godeps for dependencies + + +- Testing + - integration tests over simulated RPC calls + - significantly improved unit tests + - the ethereum virtual machine and the consensus engine are now top-level + components and are exposed to continuous integration tests + + +- Bugfixes (incomplete list) + - [EVM] Fix calculation of child CALL gaslimit (allowing solidity library calls to work properly) + - [RPC/v0] Fix blocking event subscription in transactAndHold (preventing return in Javascript libraries) + - [Blockchain] Fix getBlocks to respect block height cap. +`, +) diff --git a/rpc/service.go b/rpc/service.go index a9001d51..1c127df6 100644 --- a/rpc/service.go +++ b/rpc/service.go @@ -27,8 +27,8 @@ import ( "github.com/hyperledger/burrow/logging" "github.com/hyperledger/burrow/logging/structure" logging_types "github.com/hyperledger/burrow/logging/types" + "github.com/hyperledger/burrow/project" "github.com/hyperledger/burrow/txs" - "github.com/hyperledger/burrow/version" tm_types "github.com/tendermint/tendermint/types" ) @@ -189,7 +189,7 @@ func (s *service) Status() (*ResultStatus, error) { LatestBlockHash: latestBlockHash, LatestBlockHeight: latestHeight, LatestBlockTime: latestBlockTime, - NodeVersion: version.GetVersionString(), + NodeVersion: project.History.CurrentVersion().String(), }, nil } diff --git a/scripts/local_version.sh b/scripts/local_version.sh index 4ae67c41..21f4fc24 100755 --- a/scripts/local_version.sh +++ b/scripts/local_version.sh @@ -12,7 +12,7 @@ REPO=${REPO:-"$GOPATH/src/github.com/hyperledger/burrow"} VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$" -version=$(go run "$REPO/util/version/cmd/main.go") +version=$(go run "$REPO/project/cmd/version/main.go") tag=$(git tag --points-at HEAD) function log() { diff --git a/scripts/tag_release.sh b/scripts/tag_release.sh new file mode 100755 index 00000000..155c6360 --- /dev/null +++ b/scripts/tag_release.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +# Wait a second so we don't see ephemeral file changes +sleep 1 + +# Don't tag if there is a dirty working dir +if ! git diff-index --quiet HEAD ; then + echo "Warning there appears to be uncommitted changes in the working directory:" + git diff-index HEAD + echo + echo "Please commit them or stash them before tagging a release." + echo +fi + +version=v$(go run ./project/cmd/version/main.go) +notes=$(go run ./project/cmd/notes/main.go) + +echo "This command will tag the current commit $(git rev-parse --short HEAD) as version $version" +echo "defined programmatically in project/releases.go with release notes:" +echo +echo "$notes" | xargs -L1 echo "> " +echo +echo "It will then push the version tag to origin." +echo +read -p "Do you want to continue? [Y\n]: " -r +# Just hitting return defaults to continuing +[[ $REPLY ]] && [[ ! $REPLY =~ ^[Yy]$ ]] && echo && exit 0 +echo + +# Create tag +echo "Tagging version $version with message:" +echo "" +echo "$notes" +echo "" +echo "$notes" | git tag -s -a ${version} -F- + +# Push tag +git push origin ${version} + diff --git a/util/version/cmd/main.go b/util/version/cmd/main.go deleted file mode 100644 index 3c7dd2ba..00000000 --- a/util/version/cmd/main.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "fmt" - - "github.com/hyperledger/burrow/version" -) - -// Print the Burrow version -func main() { - fmt.Println(version.GetSemanticVersionString()) -} diff --git a/vendor/github.com/monax/relic/LICENSE b/vendor/github.com/monax/relic/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/github.com/monax/relic/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/monax/relic/history.go b/vendor/github.com/monax/relic/history.go new file mode 100644 index 00000000..2fe8c796 --- /dev/null +++ b/vendor/github.com/monax/relic/history.go @@ -0,0 +1,221 @@ +package relic + +import ( + "bytes" + "errors" + "fmt" + "text/template" +) + +// The purpose of History is to capture version changes and change logs +// in a single location and use that data to generate releases and print +// changes to the command line to automate releases and provide a single +// source of truth for improved certainty around versions and releases +type History struct { + ProjectName string + Releases []Release + ChangelogTemplate *template.Template +} + +// Provides the read-only methods of History to ensure releases are not accidentally mutated when it is not intended +type ImmutableHistory interface { + // Get latest version + CurrentVersion() Version + // Get latest release note + CurrentNotes() string + // Get the project name + Project() string + // Get complete changelog + Changelog() (string, error) + // Get complete changelog or panic if error + MustChangelog() string + // Find the release specified by Version struct or version string + Release(versionLike interface{}) (Release, error) +} + +var _ ImmutableHistory = &History{} + +type Release struct { + Version Version + Notes string +} + +var DefaultChangelogTemplate = template.Must(template.New("default_changelog_template"). + Parse(`# {{ .Project }} Changelog{{ range .Releases }} +## Version {{ .Version }} +{{ .Notes }} +{{ end }}`)) + +// Define a new project history to which releases can be added in code +// e.g. var history = relic.NewHistory().MustDeclareReleases(...) +func NewHistory(projectName string) *History { + return &History{ + ProjectName: projectName, + ChangelogTemplate: DefaultChangelogTemplate, + } +} + +// Change the default changelog template from DefaultChangelogTemplate +func (h *History) WithChangelogTemplate(tmpl *template.Template) *History { + h.ChangelogTemplate = tmpl + return h +} + +// Adds releases to the History with the newest releases provided first (so latest is at top). +// Releases can be specified by pairs of version (string or struct), notes (string) or by sequence of Release (struct) +// or mixtures thereof. +func (h *History) DeclareReleases(releaseLikes ...interface{}) (*History, error) { + var rs []Release + for i := 0; i < len(releaseLikes); i++ { + switch r := releaseLikes[i].(type) { + case Release: + rs = append(rs, r) + case fmt.Stringer: + releaseLikes[i] = r.String() + i-- + case string: + version, err := AsVersion(r) + if err != nil { + return nil, fmt.Errorf("could not interpret %v as a version: %v", r, err) + } + if i+1 >= len(releaseLikes) { + return nil, fmt.Errorf("when specifying releases in pairs of version and note you must provide "+ + "both, but the last release (for version %s) has no note", version.String()) + } + release := Release{ + Version: version, + } + // Get notes from next element + switch n := releaseLikes[i+1].(type) { + case string: + release.Notes = n + case fmt.Stringer: + release.Notes = n.String() + default: + return nil, fmt.Errorf("release element %v should be notes but cannot be converted to string", + releaseLikes[i+1]) + } + if release.Notes == "" { + return nil, fmt.Errorf("release note for version %s is empty", version.String()) + } + rs = append(rs, release) + // consume an additional element + i++ + } + } + // Check we still have a valid sequence of releases + rs = append(rs, h.Releases...) + err := EnsureReleasesUniqueValidAndMonotonic(rs) + if err != nil { + return h, err + } + + h.Releases = rs + return h, err +} + +// Like DeclareReleases but will panic if the Releases list becomes invalid +func (h *History) MustDeclareReleases(releaseLikes ...interface{}) *History { + h, err := h.DeclareReleases(releaseLikes...) + if err != nil { + panic(fmt.Errorf("could not register releases: %v", err)) + } + return h +} + +func (h *History) CurrentVersion() Version { + return h.Releases[0].Version +} + +// Gets the release notes for the current version +func (h *History) CurrentNotes() string { + return h.Releases[0].Notes +} + +func (h *History) Project() string { + return h.ProjectName +} + +// Gets the Release for version given in versionString +func (h *History) Release(versionLike interface{}) (Release, error) { + version, err := AsVersion(versionLike) + if err != nil { + return Release{}, err + } + for _, r := range h.Releases { + if r.Version == version { + return r, nil + } + } + return Release{}, fmt.Errorf("could not find release with version %v", version) +} + +// Get the changelog for the complete history +func (h *History) Changelog() (string, error) { + buf := new(bytes.Buffer) + err := h.ChangelogTemplate.Execute(buf, h) + if err != nil { + return "", err + } + return buf.String(), nil +} + +// Generates changelog, panicking if there is an error +func (h *History) MustChangelog() string { + changelog, err := h.Changelog() + if err != nil { + panic(err) + } + return changelog +} + +// Checks that a sequence of releases are monotonically decreasing with each +// version being a simple major, minor, or patch bump of its successor in the +// slice +func EnsureReleasesUniqueValidAndMonotonic(rs []Release) error { + if len(rs) == 0 { + return errors.New("at least one release must be defined") + } + version := rs[0].Version + for i := 1; i < len(rs); i++ { + // The numbers of the lower version (expect descending sort) + previousVersion := rs[i].Version + // Check versions are consecutive + if version.Major() == previousVersion.Major()+1 { + // Major bump, so minor and patch versions must be reset + if version.Minor() != 0 || version.Patch() != 0 { + return fmt.Errorf("minor and patch versions must be reset to "+ + "0 after a major bump, but they are not in %s -> %s", + rs[i].Version, rs[i-1].Version) + } + } else if version.Major() == previousVersion.Major() { + // Same major number + if version.Minor() == previousVersion.Minor()+1 { + // Minor bump so patch version must be reset + if version.Patch() != 0 { + return fmt.Errorf("patch version must be reset to "+ + "0 after a minor bump, but they are not in %s -> %s", + rs[i].Version, rs[i-1].Version) + } + } else if version.Minor() == previousVersion.Minor() { + // Same minor number so must be patch bump to be valid + if version.Patch() != previousVersion.Patch()+1 { + return fmt.Errorf("consecutive patch versions must be equal "+ + "or incremented by 1, but they are not in %s -> %s", + rs[i].Version, rs[i-1].Version) + } + } else { + return fmt.Errorf("consecutive minor versions must be equal or "+ + "incremented by 1, but they are not in %s -> %s", + rs[i].Version, rs[i-1].Version) + } + } else { + return fmt.Errorf("consecutive major versions must be equal or "+ + "incremented by 1, but they are not in %s -> %s", + rs[i].Version, rs[i-1].Version) + } + + version = previousVersion + } + return nil +} diff --git a/vendor/github.com/monax/relic/version.go b/vendor/github.com/monax/relic/version.go new file mode 100644 index 00000000..7bbdf3fa --- /dev/null +++ b/vendor/github.com/monax/relic/version.go @@ -0,0 +1,72 @@ +package relic + +import ( + "fmt" + "strconv" + "strings" +) + +const ( + // Base of minor, major, and patch version numbers + numberBase = 10 + // Number of bits to represent version numbers + uintBits = 8 +) + +type Version struct { + major uint8 + minor uint8 + patch uint8 +} + +func (v Version) Major() uint8 { + return v.major +} + +func (v Version) Minor() uint8 { + return v.minor +} + +func (v Version) Patch() uint8 { + return v.patch +} + +func (v Version) String() string { + return fmt.Sprintf("%v.%v.%v", v.major, v.minor, v.patch) +} + +func AsVersion(versionLike interface{}) (Version, error) { + switch v := versionLike.(type) { + case Version: + return v, nil + case string: + return ParseVersion(v) + default: + return Version{}, fmt.Errorf("unsupported type for version: %t, must be Version or string", v) + } +} + +func ParseVersion(versionString string) (Version, error) { + parts := strings.Split(versionString, ".") + if len(parts) != 3 { + return Version{}, + fmt.Errorf("version string must have three '.' separated parts but '%s' does not", versionString) + } + maj, err := strconv.ParseUint(parts[0], numberBase, uintBits) + if err != nil { + return Version{}, err + } + min, err := strconv.ParseUint(parts[1], numberBase, uintBits) + if err != nil { + return Version{}, err + } + pat, err := strconv.ParseUint(parts[2], numberBase, uintBits) + if err != nil { + return Version{}, err + } + return Version{ + major: uint8(maj), + minor: uint8(min), + patch: uint8(pat), + }, err +} diff --git a/version/version.go b/version/version.go deleted file mode 100644 index 0bee5423..00000000 --- a/version/version.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2017 Monax Industries Limited -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package version - -// version provides the current burrow version and a VersionIdentifier -// for the modules to identify their version with. - -import ( - "fmt" -) - -// IMPORTANT: this version number needs to be manually kept -// in sync at the bottom of this file for the deployment scripts to parse -// the version number. -const ( - // Client identifier to advertise over the network - clientIdentifier = "burrow" - // Major version component of the current release - versionMajor = 0 - // Minor version component of the current release - versionMinor = 18 - // Patch version component of the current release - versionPatch = 0 -) - -var burrowVersion *VersionIdentifier - -func init() { - burrowVersion = New(clientIdentifier, versionMajor, versionMinor, versionPatch) -} - -func GetBurrowVersion() *VersionIdentifier { - return burrowVersion -} - -//------------------------------------------------------------------------------ -// versioning globally for burrow and scoped for modules - -type VersionIdentifier struct { - ClientIdentifier string - MajorVersion uint8 - MinorVersion uint8 - PatchVersion uint8 -} - -func New(client string, major, minor, patch uint8) *VersionIdentifier { - return &VersionIdentifier{ - ClientIdentifier: client, - MajorVersion: major, - MinorVersion: minor, - PatchVersion: patch, - } -} - -// GetVersionString returns `client-major.minor.patch` for burrow -// without a receiver, or for the version called on. -// MakeVersionString builds the same version string with provided parameters. -func GetVersionString() string { return burrowVersion.GetVersionString() } -func (v *VersionIdentifier) GetVersionString() string { - return fmt.Sprintf("%s-%d.%d.%d", v.ClientIdentifier, v.MajorVersion, - v.MinorVersion, v.PatchVersion) -} - -// note: the arguments are passed in as int (rather than uint8) -// because on asserting the version constructed from the configuration file -// the casting of an int to uint8 is uglier than expanding the type range here. -// Should the configuration file have an invalid integer (that could not convert) -// then this will equally be reflected in a failed assertion of the version string. -func MakeVersionString(client string, major, minor, patch int) string { - return fmt.Sprintf("%s-%d.%d.%d", client, major, minor, patch) -} - -// GetMinorVersionString returns `client-major.minor` for burrow -// without a receiver, or for the version called on. -// MakeMinorVersionString builds the same version string with -// provided parameters. -func GetMinorVersionString() string { return burrowVersion.GetVersionString() } -func (v *VersionIdentifier) GetMinorVersionString() string { - return fmt.Sprintf("%s-%d.%d", v.ClientIdentifier, v.MajorVersion, - v.MinorVersion) -} - -// Return the plain version string without the ClientIdentifier -func GetSemanticVersionString() string { return burrowVersion.GetSemanticVersionString() } -func (v *VersionIdentifier) GetSemanticVersionString() string { - return fmt.Sprintf("%d.%d.%d", v.MajorVersion, - v.MinorVersion, v.PatchVersion) -} - -// note: similar remark applies here on the use of `int` over `uint8` -// for the arguments as above for MakeVersionString() -func MakeMinorVersionString(client string, major, minor, patch int) string { - return fmt.Sprintf("%s-%d.%d", client, major, minor) -} - -// GetVersion returns a tuple of client, major, minor, and patch as types, -// either for burrow without a receiver or the called version structure. -func GetVersion() (client string, major, minor, patch uint8) { - return burrowVersion.GetVersion() -} - -func (version *VersionIdentifier) GetVersion() ( - client string, major, minor, patch uint8) { - return version.ClientIdentifier, version.MajorVersion, version.MinorVersion, - version.PatchVersion -} - -//------------------------------------------------------------------------------ -// Matching functions - -// MatchesMinorVersion matches the client identifier, major and minor version -// number of the reference version identifier to be equal with the receivers. -func MatchesMinorVersion(referenceVersion *VersionIdentifier) bool { - return burrowVersion.MatchesMinorVersion(referenceVersion) -} -func (version *VersionIdentifier) MatchesMinorVersion( - referenceVersion *VersionIdentifier) bool { - referenceClient, referenceMajor, referenceMinor, _ := referenceVersion.GetVersion() - return version.ClientIdentifier == referenceClient && - version.MajorVersion == referenceMajor && - version.MinorVersion == referenceMinor -} -- GitLab