Skip to content

Commit

Permalink
changed debian arm target to armhf, better changelog, notifying accou…
Browse files Browse the repository at this point in the history
…nt activity in broadcast (#46)
  • Loading branch information
jancajthaml authored Oct 18, 2018
1 parent cbd928a commit b77cdbd
Show file tree
Hide file tree
Showing 20 changed files with 164 additions and 107 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions bbtest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <jan.cajthaml@gmail.com>
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 \
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions bbtest/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") : [])
Expand Down
6 changes: 4 additions & 2 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

# ---------------------------------------------------------------------------- #
94 changes: 54 additions & 40 deletions dev/lifecycle/debian
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -eu
trap exit INT TERM
Expand All @@ -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
Expand All @@ -40,42 +40,52 @@ 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 <jan.cajthaml@gmail.com> ${DATE}" >> ${CHANGELOG}
}

generate_changelog() {
VER="${VERSION}"
tag=HEAD
ADDS=$(echo ${VER} | sed -e 's/~.*//' | cut -s -d- -f2)
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 <jan.cajthaml@gmail.com> ${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 <jan.cajthaml@gmail.com> ${DATE}" >> ${CHANGELOG}
echo "" >> ${CHANGELOG}
done
}

################################################################################
Expand All @@ -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}
Expand Down
18 changes: 13 additions & 5 deletions dev/lifecycle/package
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,36 @@ package_service() {

case ${arch} in

arm)
armhf)
GOOS=${platform} \
GOARM=7 \
CC=arm-linux-gnueabihf-gcc \
GOARCH=arm \
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
Expand Down
8 changes: 3 additions & 5 deletions packaging/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@

FROM alpine

MAINTAINER Jan Cajthaml <jan.cajthaml@gmail.com>

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

Expand Down
35 changes: 27 additions & 8 deletions packaging/debian_amd64/DEBIAN/changelog
Original file line number Diff line number Diff line change
@@ -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 <jan.cajthaml@gmail.com> Tue, 2 Oct 2018 08:24:00 +0200
-- Jan Cajthaml <jan.cajthaml@gmail.com> Thu, 18 Oct 2018 11:18:09 +0200

vault (1.0.5) unstable; urgency=low

* metrics fixed, hangs during bootstrap fixed (#45)

-- Jan Cajthaml <jan.cajthaml@gmail.com> 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 <jan.cajthaml@gmail.com> 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 <jan.cajthaml@gmail.com> 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 <jan.cajthaml@gmail.com> 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 <jan.cajthaml@gmail.com> Tue, 31 Jul 2018 13:54:34 +0200

vault (1.0.0) unstable; urgency=low

* release pipeline

-- Jan Cajthaml <jan.cajthaml@gmail.com> Fri, 27 Jul 2018 18:33:21 +0200

2 changes: 1 addition & 1 deletion packaging/debian_amd64/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: vault
Version: 1.0.4+increased-test-coverage
Version: 1.0.5+more-bbtests
Architecture: amd64
Maintainer: Jan Cajthaml <jan.cajthaml@gmail.com>
Depends: init-system-helpers (>= 1.18~), libzmq5 (= 4.2.1-4)
Expand Down
32 changes: 0 additions & 32 deletions packaging/debian_arm/DEBIAN/changelog

This file was deleted.

Loading

0 comments on commit b77cdbd

Please sign in to comment.