diff --git a/.circleci/config.yml b/.circleci/config.yml index fb094c63..2017550c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,7 +105,7 @@ jobs: - vault-base-{{ .Environment.CIRCLE_SHA1 }} - run: dep ensure - run: ./dev/lifecycle/package --target linux/amd64 - - run: ./dev/lifecycle/package --target linux/arm + - run: ./dev/lifecycle/package --target linux/armhf - run: name: Package debian command: | @@ -123,7 +123,7 @@ jobs: fi ./dev/lifecycle/debian -v ${VERSION} --arch amd64 - ./dev/lifecycle/debian -v ${VERSION} --arch arm + ./dev/lifecycle/debian -v ${VERSION} --arch armhf - save_cache: key: vault-binaries-{{ .Environment.CIRCLE_SHA1 }}-{{ .Environment.CIRCLE_TAG }} paths: @@ -212,8 +212,8 @@ jobs: - vault-binaries-{{ .Environment.CIRCLE_SHA1 }}-{{ .Environment.CIRCLE_TAG }} - run: if [ ! -f ./packaging/bin/vault_${CIRCLE_TAG#v}_amd64.deb ] ; then exit 1 ; fi - run: if [ ! -f ./packaging/bin/linux-amd64 ] ; then exit 1 ; fi - - run: if [ ! -f ./packaging/bin/vault_${CIRCLE_TAG#v}_arm.deb ] ; then exit 1 ; fi - - run: if [ ! -f ./packaging/bin/linux-arm ] ; then exit 1 ; fi + - run: if [ ! -f ./packaging/bin/vault_${CIRCLE_TAG#v}_armhf.deb ] ; then exit 1 ; fi + - run: if [ ! -f ./packaging/bin/linux-armhf ] ; then exit 1 ; fi - deploy: name: Release artifacts to github command: | diff --git a/Makefile b/Makefile index 2046498f..c38c9ccd 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ package: @(rm -rf packaging/bin/* &> /dev/null || :) docker-compose run --rm package --target linux/amd64 docker-compose run --rm debian -v $(VERSION)+$(META) --arch amd64 - docker-compose run --rm package --target linux/arm - docker-compose run --rm debian -v $(VERSION)+$(META) --arch arm + docker-compose run --rm package --target linux/armhf + docker-compose run --rm debian -v $(VERSION)+$(META) --arch armhf docker-compose build artifacts .PHONY: bootstrap diff --git a/bbtest/Dockerfile b/bbtest/Dockerfile index 54f9d205..28de314e 100644 --- a/bbtest/Dockerfile +++ b/bbtest/Dockerfile @@ -15,13 +15,9 @@ FROM ruby:2.5.0-stretch ENV DEBIAN_FRONTEND=noninteractive \ - LANG=C.UTF-8 \ - LAKE_VERSION=1.0.3 - -MAINTAINER Jan Cajthaml + LANG=C.UTF-8 RUN apt-get -y update && \ - apt-get -y upgrade && \ apt-get clean && \ apt-get -y install \ libzmq3-dev=4.2.1-4 \ @@ -85,7 +81,7 @@ RUN sed -ri /etc/systemd/journald.conf -e 's!^#?Storage=.*!Storage=volatile!' COPY packaging/bin /tmp/packages -RUN if [ ! -f /tmp/packages/vault_*_arm.deb ] ; \ +RUN if [ ! -f /tmp/packages/vault_*_amd64.deb ] ; \ then (>&2 echo "no package to test found"); \ exit 1 ; fi diff --git a/bbtest/spec.rb b/bbtest/spec.rb index b4f97da9..c7c22886 100644 --- a/bbtest/spec.rb +++ b/bbtest/spec.rb @@ -29,6 +29,7 @@ config.after(:suite) do |_| print "\n[ suite ending ]\n" + # fixme delete get_containers = lambda do |image| containers = %x(docker ps -aqf "ancestor=#{image}" 2>/dev/null) return ($? == 0 ? containers.split("\n") : []) diff --git a/dev/Dockerfile b/dev/Dockerfile index c94a5455..b5421cd8 100644 --- a/dev/Dockerfile +++ b/dev/Dockerfile @@ -35,7 +35,7 @@ FROM base AS go ENV DEBIAN_FRONTEND=noninteractive \ LANG=C.UTF-8 \ - GOLANG_VERSION=1.10.1 \ + GOLANG_VERSION=1.11.1 \ GOPATH=/go RUN apt-get -y install --no-install-recommends tar=1.29b-1.1 @@ -64,7 +64,7 @@ RUN curl -L https://github.com/Masterminds/glide/releases/download/v0.13.1/glide RUN go get -u \ \ - github.com/golang/lint/golint \ + golang.org/x/lint/golint \ github.com/fzipp/gocyclo \ github.com/client9/misspell/cmd/misspell @@ -136,4 +136,6 @@ COPY --from=go /go/bin/misspell /usr/bin/misspell COPY --from=library/docker:18.06 /usr/local/bin/docker /usr/bin/docker +RUN echo "nameserver 1.1.1.1" > /etc/resolv.conf + # ---------------------------------------------------------------------------- # diff --git a/dev/lifecycle/debian b/dev/lifecycle/debian index d90fab7d..86ae6eec 100755 --- a/dev/lifecycle/debian +++ b/dev/lifecycle/debian @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -eu trap exit INT TERM @@ -11,21 +11,21 @@ key="$1" case $key in - --arch) - TARGET_ARCHITECTURE="$2" - shift - shift - ;; + --arch) + TARGET_ARCHITECTURE="$2" + shift + shift + ;; - -v|--version) - VERSION="$2" - shift - shift - ;; + -v|--version) + VERSION="$2" + shift + shift + ;; - *) - shift - ;; + *) + shift + ;; esac done @@ -40,23 +40,6 @@ if [ ! "${TARGET_ARCHITECTURE}" ] ; then exit 1 fi -append_to_changelog() { - local desc="$*" - - DATE=$(git log -1 --format=%cD ${tag}) - - if [ ${FIRST} -eq 0 ] ; then echo >> ${CHANGELOG} ; fi - FIRST=0 - - echo "vault (${VER}) ${DIST}; urgency=low" >> ${CHANGELOG} - echo >> ${CHANGELOG} - if [ "${desc}" ] ; then - echo "${desc}" >> ${CHANGELOG} - echo >> ${CHANGELOG} - fi - echo " -- Jan Cajthaml ${DATE}" >> ${CHANGELOG} -} - generate_changelog() { VER="${VERSION}" tag=HEAD @@ -64,18 +47,45 @@ generate_changelog() { if [ -f ${CHANGELOG} ] ; then rm -f ${CHANGELOG} fi - if [ -n "${ADDS}" ] ; then - append_to_changelog " * includes ${ADDS} commits after $(echo ${VER} | cut -d- -f1) release" + + touch ${CHANGELOG} + + if [[ -n "${ADDS// }" ]] ; then + DATE=$(git log -1 --format=%cD ${tag}) + echo "vault (${VER}) ${DIST}; urgency=low" >> ${CHANGELOG} + echo "" >> ${CHANGELOG} + echo " * includes non-released commits" >> ${CHANGELOG} + echo "" >> ${CHANGELOG} + echo " -- Jan Cajthaml ${DATE}" >> ${CHANGELOG} + echo "" >> ${CHANGELOG} fi - for tag in $(git tag --sort=-v:refname); do - VER=${tag#v} - append_to_changelog "$(git tag -l -n20 ${tag} | tail -n+2 | sed -e 's/^ */ /')" + PAIRS=() + prev_tag=HEAD + for tag in $(git tag --sort=-v:refname | awk '{arr[i++]=$0} END {while (i>0) print arr[--i] }') ; do + PAIRS+=("${prev_tag} ${tag}") + prev_tag=${tag} done - if [ ! -f ${CHANGELOG} ] ; then - append_to_changelog - fi + idx=( ${!PAIRS[@]} ) + for ((i=${#idx[@]} - 1; i >= 0; i--)) ; do + tag_from=${PAIRS[idx[i]]%% *} + tag_to=${PAIRS[idx[i]]#* } + + DATE=$(git log -1 --format=%cD ${tag_to}) + + echo "vault (${tag_to#v}) ${DIST}; urgency=low" >> ${CHANGELOG} + echo "" >> ${CHANGELOG} + + echo "$(git log --pretty=oneline --pretty=format:%s ^${tag_from} ${tag_to})" | \ + while read note ; do + echo " * ${note}" >> ${CHANGELOG} + done + + echo "" >> ${CHANGELOG} + echo " -- Jan Cajthaml ${DATE}" >> ${CHANGELOG} + echo "" >> ${CHANGELOG} + done } ################################################################################ @@ -101,13 +111,17 @@ fi mkdir -p ${DEB_SOURCES}/openbank/services/vault +if [ -f "${DEB_SOURCES}/openbank/services/vault/vault" ] ; then + rm -f ${DEB_SOURCES}/openbank/services/vault/vault +fi + du -hs "${BIN_SOURCES}/linux-${TARGET_ARCHITECTURE}" cp \ "${BIN_SOURCES}/linux-${TARGET_ARCHITECTURE}" \ "${DEB_SOURCES}/openbank/services/vault/vault" -du -hs "${DEB_SOURCES}/openbank/services/vault/vault" +file "${DEB_SOURCES}/openbank/services/vault/vault" generate_changelog sed -i 's/Version.*/Version: '${VERSION#v}'/' ${CONTROL} diff --git a/dev/lifecycle/package b/dev/lifecycle/package index ac345065..55e36023 100755 --- a/dev/lifecycle/package +++ b/dev/lifecycle/package @@ -18,7 +18,7 @@ package_service() { case ${arch} in - arm) + armhf) GOOS=${platform} \ GOARM=7 \ CC=arm-linux-gnueabihf-gcc \ @@ -26,20 +26,28 @@ package_service() { CGO_ENABLED=1 \ \ go build -a -o ${output} || { - (>&2 echo "unable to build for ${platform}/arm") + (>&2 echo "unable to build for ${platform}/armhf") exit 1 } + file ${output} ;; - *) + amd64) GOOS=${platform} \ - GOARCH=${arch} \ + CC=gcc \ + GOARCH=amd64 \ CGO_ENABLED=1 \ \ go build -a -o ${output} || { - (>&2 echo "unable to build for ${platform}/${arch}") + (>&2 echo "unable to build for ${platform}/amd64") exit 1 } + file ${output} + ;; + + *) + (>&2 echo "unsupported target ${platform}/${arch}") + exit 1 ;; esac diff --git a/packaging/Dockerfile b/packaging/Dockerfile index 2dd5c964..69344340 100644 --- a/packaging/Dockerfile +++ b/packaging/Dockerfile @@ -14,17 +14,15 @@ FROM alpine -MAINTAINER Jan Cajthaml - COPY bin /opt/artifacts RUN \ if \ [ -z "$(find . /opt/artifacts -type f -name 'vault_*_amd64.deb' -print)" ] || \ [ ! -f /opt/artifacts/linux-amd64 ] || \ - [ -z "$(find /opt/artifacts -type f -name 'vault_*_arm.deb' -print)" ] || \ - [ ! -f /opt/artifacts/linux-arm ] ; then \ - (>&2 echo "missing expected files, run package and debian for both amd64 and arm") ; \ + [ -z "$(find /opt/artifacts -type f -name 'vault_*_armhf.deb' -print)" ] || \ + [ ! -f /opt/artifacts/linux-armhf ] ; then \ + (>&2 echo "missing expected files, run package and debian for both amd64 and armhf") ; \ exit 1 ; \ fi diff --git a/packaging/debian_amd64/DEBIAN/changelog b/packaging/debian_amd64/DEBIAN/changelog index 2e77ee22..1df42c3b 100644 --- a/packaging/debian_amd64/DEBIAN/changelog +++ b/packaging/debian_amd64/DEBIAN/changelog @@ -1,32 +1,51 @@ -vault (v1.0.4+increased-test-coverage) unstable; urgency=low +vault (v1.0.5+more-bbtests) unstable; urgency=low - * includes test commits after v1.0.4+increased release + * includes non-released commits - -- Jan Cajthaml Tue, 2 Oct 2018 08:24:00 +0200 + -- Jan Cajthaml Thu, 18 Oct 2018 11:18:09 +0200 + +vault (1.0.5) unstable; urgency=low + + * metrics fixed, hangs during bootstrap fixed (#45) + + -- Jan Cajthaml Tue, 2 Oct 2018 23:24:59 +0200 vault (1.0.4) unstable; urgency=low - - * flat and more controlled structure and lifecycle of sub routines - * use new lake-client - * snapshot updated test coverage + * flat and more controlled structure and lifecycle of sub routines (#44) + * debian improvements (#43) + * no need to load environment from config file into postinstall (#42) + * codacy fixes (#41) + * faster bbtests with more scenarios, merged meta and snapshot into one account state, faster hydration and persistence of account (#40) + * logging creation of new account (#38) -- Jan Cajthaml Tue, 2 Oct 2018 08:24:00 +0200 vault (1.0.3) unstable; urgency=low + * logging creation of new account + * debian packaging and multiple per-tenant vaults on single machine (#37) + * updated to new lake client (#36) + -- Jan Cajthaml Sat, 18 Aug 2018 18:09:11 +0200 vault (1.0.2) unstable; urgency=low - + * unified bbtests, reduced flakes, arm platform now supported as target architecture (#35) + * restructuring project, benchmarking and optimising storage functions (#33) -- Jan Cajthaml Tue, 14 Aug 2018 17:52:48 +0200 vault (1.0.1) unstable; urgency=low + * restructuring project, benchmarking and optimising storage functions + * release pipeline (#32) + -- Jan Cajthaml Tue, 31 Jul 2018 13:54:34 +0200 vault (1.0.0) unstable; urgency=low + * release pipeline + -- Jan Cajthaml Fri, 27 Jul 2018 18:33:21 +0200 + diff --git a/packaging/debian_amd64/DEBIAN/control b/packaging/debian_amd64/DEBIAN/control index 6be70bd8..b9ca50a7 100755 --- a/packaging/debian_amd64/DEBIAN/control +++ b/packaging/debian_amd64/DEBIAN/control @@ -1,5 +1,5 @@ Package: vault -Version: 1.0.4+increased-test-coverage +Version: 1.0.5+more-bbtests Architecture: amd64 Maintainer: Jan Cajthaml Depends: init-system-helpers (>= 1.18~), libzmq5 (= 4.2.1-4) diff --git a/packaging/debian_arm/DEBIAN/changelog b/packaging/debian_arm/DEBIAN/changelog deleted file mode 100644 index 2e77ee22..00000000 --- a/packaging/debian_arm/DEBIAN/changelog +++ /dev/null @@ -1,32 +0,0 @@ -vault (v1.0.4+increased-test-coverage) unstable; urgency=low - - * includes test commits after v1.0.4+increased release - - -- Jan Cajthaml Tue, 2 Oct 2018 08:24:00 +0200 - -vault (1.0.4) unstable; urgency=low - - - * flat and more controlled structure and lifecycle of sub routines - * use new lake-client - * snapshot updated test coverage - - -- Jan Cajthaml Tue, 2 Oct 2018 08:24:00 +0200 - -vault (1.0.3) unstable; urgency=low - - -- Jan Cajthaml Sat, 18 Aug 2018 18:09:11 +0200 - -vault (1.0.2) unstable; urgency=low - - - - -- Jan Cajthaml Tue, 14 Aug 2018 17:52:48 +0200 - -vault (1.0.1) unstable; urgency=low - - -- Jan Cajthaml Tue, 31 Jul 2018 13:54:34 +0200 - -vault (1.0.0) unstable; urgency=low - - -- Jan Cajthaml Fri, 27 Jul 2018 18:33:21 +0200 diff --git a/packaging/debian_armhf/DEBIAN/changelog b/packaging/debian_armhf/DEBIAN/changelog new file mode 100644 index 00000000..1df42c3b --- /dev/null +++ b/packaging/debian_armhf/DEBIAN/changelog @@ -0,0 +1,51 @@ +vault (v1.0.5+more-bbtests) unstable; urgency=low + + * includes non-released commits + + -- Jan Cajthaml Thu, 18 Oct 2018 11:18:09 +0200 + +vault (1.0.5) unstable; urgency=low + + * metrics fixed, hangs during bootstrap fixed (#45) + + -- Jan Cajthaml Tue, 2 Oct 2018 23:24:59 +0200 + +vault (1.0.4) unstable; urgency=low + + * flat and more controlled structure and lifecycle of sub routines (#44) + * debian improvements (#43) + * no need to load environment from config file into postinstall (#42) + * codacy fixes (#41) + * faster bbtests with more scenarios, merged meta and snapshot into one account state, faster hydration and persistence of account (#40) + * logging creation of new account (#38) + + -- Jan Cajthaml Tue, 2 Oct 2018 08:24:00 +0200 + +vault (1.0.3) unstable; urgency=low + + * logging creation of new account + * debian packaging and multiple per-tenant vaults on single machine (#37) + * updated to new lake client (#36) + + -- Jan Cajthaml Sat, 18 Aug 2018 18:09:11 +0200 + +vault (1.0.2) unstable; urgency=low + + * unified bbtests, reduced flakes, arm platform now supported as target architecture (#35) + * restructuring project, benchmarking and optimising storage functions (#33) + + -- Jan Cajthaml Tue, 14 Aug 2018 17:52:48 +0200 + +vault (1.0.1) unstable; urgency=low + + * restructuring project, benchmarking and optimising storage functions + * release pipeline (#32) + + -- Jan Cajthaml Tue, 31 Jul 2018 13:54:34 +0200 + +vault (1.0.0) unstable; urgency=low + + * release pipeline + + -- Jan Cajthaml Fri, 27 Jul 2018 18:33:21 +0200 + diff --git a/packaging/debian_arm/DEBIAN/compat b/packaging/debian_armhf/DEBIAN/compat similarity index 100% rename from packaging/debian_arm/DEBIAN/compat rename to packaging/debian_armhf/DEBIAN/compat diff --git a/packaging/debian_arm/DEBIAN/control b/packaging/debian_armhf/DEBIAN/control similarity index 81% rename from packaging/debian_arm/DEBIAN/control rename to packaging/debian_armhf/DEBIAN/control index 62e45a3d..11c66989 100755 --- a/packaging/debian_arm/DEBIAN/control +++ b/packaging/debian_armhf/DEBIAN/control @@ -1,6 +1,6 @@ Package: vault -Version: 1.0.4+increased-test-coverage -Architecture: arm +Version: 1.0.5+more-bbtests +Architecture: armhf Maintainer: Jan Cajthaml Depends: init-system-helpers (>= 1.18~), libzmq5 (= 4.2.1-4) Section: openbank diff --git a/packaging/debian_arm/DEBIAN/copyright b/packaging/debian_armhf/DEBIAN/copyright similarity index 100% rename from packaging/debian_arm/DEBIAN/copyright rename to packaging/debian_armhf/DEBIAN/copyright diff --git a/packaging/debian_arm/DEBIAN/displace b/packaging/debian_armhf/DEBIAN/displace similarity index 100% rename from packaging/debian_arm/DEBIAN/displace rename to packaging/debian_armhf/DEBIAN/displace diff --git a/packaging/debian_arm/DEBIAN/postinst b/packaging/debian_armhf/DEBIAN/postinst similarity index 100% rename from packaging/debian_arm/DEBIAN/postinst rename to packaging/debian_armhf/DEBIAN/postinst diff --git a/packaging/debian_arm/DEBIAN/postrm b/packaging/debian_armhf/DEBIAN/postrm similarity index 100% rename from packaging/debian_arm/DEBIAN/postrm rename to packaging/debian_armhf/DEBIAN/postrm diff --git a/packaging/debian_arm/DEBIAN/preinst b/packaging/debian_armhf/DEBIAN/preinst similarity index 100% rename from packaging/debian_arm/DEBIAN/preinst rename to packaging/debian_armhf/DEBIAN/preinst diff --git a/packaging/debian_arm/lib/systemd/system/vault@.service b/packaging/debian_armhf/lib/systemd/system/vault@.service similarity index 100% rename from packaging/debian_arm/lib/systemd/system/vault@.service rename to packaging/debian_armhf/lib/systemd/system/vault@.service