From 712ec7d3fb9051ea5ae7bfeb6ec33e9c90f867be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 17 Dec 2018 15:28:45 +0200 Subject: [PATCH 01/12] Update Dockerfile ENV CGO_ENABLED=0 --- contrib/docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 6b4bfcb6..fb4fbfaa 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -2,6 +2,9 @@ FROM docker.io/golang:alpine as builder COPY . /src WORKDIR /src + +ENV CGO_ENABLED=0 + RUN apk add git && ./build FROM docker.io/alpine From 8ec4c66f655eef5bd694dc3a88ea8686c3d722d7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 17 Dec 2018 19:06:52 +0000 Subject: [PATCH 02/12] Multithread the admin socket --- src/yggdrasil/admin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 5028c9b6..bd3c9051 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -395,7 +395,7 @@ func (a *admin) listen() { for { conn, err := a.listener.Accept() if err == nil { - a.handleRequest(conn) + go a.handleRequest(conn) } } } From 0a9b34d121a60f39869c251de942c3ef53fd583b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 17 Dec 2018 19:17:29 +0000 Subject: [PATCH 03/12] Revert "Merge pull request #259 from neilalexander/semver" This reverts commit 51b3746df682b50f5d6a3f6c5bcd10b36e4dc8b1, reversing changes made to 6e87791e50f38fe310771858888b661831a0fd61. --- contrib/semver/version.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index eab5ab86..331046f3 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -3,7 +3,7 @@ # Merge commits from this branch are counted DEVELOPBRANCH="yggdrasil-network/develop" -# Get the last tag that denotes moving to a major version number +# Get the last tag TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.0" 2>/dev/null) # Get last merge to master @@ -33,6 +33,9 @@ if [ $? != 0 ]; then exit 1 fi +# Get the number of merges on the current branch since the last tag +BUILD=$(git rev-list $TAG..HEAD --count --merges) + # Split out into major, minor and patch numbers MAJOR=$(echo $TAG | cut -c 2- | cut -d "." -f 1) MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2) @@ -53,10 +56,6 @@ fi # Add the build tag on non-master branches if [ $BRANCH != "master" ]; then - # Get the number of merges on the current branch since the last tag - BUILDTAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null) - BUILD=$(git rev-list $BUILDTAG..HEAD --count --merges) - if [ $BUILD != 0 ]; then printf -- "-%04d" "$BUILD" fi From a22da8009ff2057332d5cd4dbd9c08e601dcd5be Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 17 Dec 2018 22:07:28 +0000 Subject: [PATCH 04/12] Hopefully fix semver versioning breakage caused by non-master merge commits --- contrib/semver/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index 331046f3..a53ed32c 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -10,7 +10,7 @@ TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.0" 2>/dev/null) MERGE=$(git rev-list $TAG..master --grep "from $DEVELOPBRANCH" 2>/dev/null | head -n 1) # Get the number of merges since the last merge to master -PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" 2>/dev/null) +PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" --first-parent master 2>/dev/null) # Decide whether we should prepend the version with "v" - the default is that # we do because we use it in git tags, but we might not always need it From 429d014d1c2f4921c9406cd83acb0da5960b721a Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 11:16:27 +0000 Subject: [PATCH 05/12] Fix addgroup/groupadd --- contrib/deb/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index 0eb21882..ed2c1c96 100644 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -73,7 +73,7 @@ cat > /tmp/$PKGNAME/debian/postinst << EOF #!/bin/sh if ! getent group yggdrasil 2>&1 > /dev/null; then - addgroup --system --quiet yggdrasil + groupadd --system --force yggdrasil || echo "Failed to create group 'yggdrasil' - please create it manually and reinstall" fi if [ -f /etc/yggdrasil.conf ]; From 56842794032bfea2cabe0a38fe725b9979724fe9 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 11:47:46 +0000 Subject: [PATCH 06/12] CircleCI: don't recreate tags that already exist --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3092ba1..907aa8b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ jobs: name: Create tags (master branch only) command: > if [ "${CIRCLE_BRANCH}" == "master" ]; then - git tag -f -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push -f --tags; + git tag -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push --tags; else echo "Only runs for master branch (this is ${CIRCLE_BRANCH})"; fi; From bfdb079b791a532af3a3a7ce3d6d742fca89d7c7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 11:52:22 +0000 Subject: [PATCH 07/12] Append suffix to master releaser releases if they are not the first merge (package revisions) --- contrib/semver/version.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index a53ed32c..a17cf6fe 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -59,4 +59,8 @@ if [ $BRANCH != "master" ]; then if [ $BUILD != 0 ]; then printf -- "-%04d" "$BUILD" fi +else + if [ $BUILD != 0 ]; then + printf -- "-%d" "$BUILD" + fi fi From 3ea33c9fa72ae0dcdf04e6d0fc2872aae28cdc68 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 12:03:23 +0000 Subject: [PATCH 08/12] Fix build tags maybe? --- contrib/semver/version.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index a17cf6fe..2b3c4bc3 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -33,9 +33,6 @@ if [ $? != 0 ]; then exit 1 fi -# Get the number of merges on the current branch since the last tag -BUILD=$(git rev-list $TAG..HEAD --count --merges) - # Split out into major, minor and patch numbers MAJOR=$(echo $TAG | cut -c 2- | cut -d "." -f 1) MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2) @@ -54,6 +51,10 @@ else printf '%s%d.%d.%d' "$PREPEND" "$MAJOR" "$MINOR" "$PATCH" fi +# Get the number of merges on the current branch since the last tag +TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null) +BUILD=$(git rev-list $TAG..$BRANCH --count) + # Add the build tag on non-master branches if [ $BRANCH != "master" ]; then if [ $BUILD != 0 ]; then From 09ea9a166f988fdc784727a3f0134b854960a221 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 12:14:47 +0000 Subject: [PATCH 09/12] More tweaks to semver --- contrib/semver/version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index 2b3c4bc3..03b5da2c 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -52,8 +52,8 @@ else fi # Get the number of merges on the current branch since the last tag -TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null) -BUILD=$(git rev-list $TAG..$BRANCH --count) +TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" --first-parent master 2>/dev/null) +BUILD=$(git rev-list $TAG.. --count) # Add the build tag on non-master branches if [ $BRANCH != "master" ]; then @@ -62,6 +62,6 @@ if [ $BRANCH != "master" ]; then fi else if [ $BUILD != 0 ]; then - printf -- "-%d" "$BUILD" + printf -- "-%d" "$(($BUILD+1))" fi fi From ace956898193e50e10a50a9f593b4e792ad3ce04 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Tue, 18 Dec 2018 11:36:15 -0500 Subject: [PATCH 10/12] Added compile support for Arm v6 Support for older raspberry pis and Pi Zero --- contrib/deb/generate.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index ed2c1c96..aea9cd91 100644 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -26,9 +26,10 @@ elif [ $PKGARCH = "i386" ]; then GOARCH=386 GOOS=linux ./build elif [ $PKGARCH = "mipsel" ]; then GOARCH=mipsle GOOS=linux ./build elif [ $PKGARCH = "mips" ]; then GOARCH=mips64 GOOS=linux ./build elif [ $PKGARCH = "armhf" ]; then GOARCH=arm GOOS=linux GOARM=7 ./build +elif [ $PKGARCH = "armv6" ]; then export PKGARCH="armhf"; GOARCH=arm GOOS=linux GOARM=6 ./build; elif [ $PKGARCH = "arm64" ]; then GOARCH=arm64 GOOS=linux ./build else - echo "Specify PKGARCH=amd64,i386,mips,mipsel,armhf,arm64" + echo "Specify PKGARCH=amd64,i386,mips,mipsel,armv6,armhf,arm64" exit 1 fi From f91fb1045c5364fbd944a26d839fe271e7e42178 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Tue, 18 Dec 2018 12:28:15 -0500 Subject: [PATCH 11/12] Downgraded all armhf builds to v6 --- contrib/deb/generate.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index aea9cd91..6c8f955d 100644 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -25,11 +25,10 @@ if [ $PKGARCH = "amd64" ]; then GOARCH=amd64 GOOS=linux ./build elif [ $PKGARCH = "i386" ]; then GOARCH=386 GOOS=linux ./build elif [ $PKGARCH = "mipsel" ]; then GOARCH=mipsle GOOS=linux ./build elif [ $PKGARCH = "mips" ]; then GOARCH=mips64 GOOS=linux ./build -elif [ $PKGARCH = "armhf" ]; then GOARCH=arm GOOS=linux GOARM=7 ./build -elif [ $PKGARCH = "armv6" ]; then export PKGARCH="armhf"; GOARCH=arm GOOS=linux GOARM=6 ./build; +elif [ $PKGARCH = "armhf" ]; then GOARCH=arm GOOS=linux GOARM=6 ./build elif [ $PKGARCH = "arm64" ]; then GOARCH=arm64 GOOS=linux ./build else - echo "Specify PKGARCH=amd64,i386,mips,mipsel,armv6,armhf,arm64" + echo "Specify PKGARCH=amd64,i386,mips,mipsel,armhf,arm64" exit 1 fi From 3283de17d5c6235e223033e5edd09d150044f688 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 19 Dec 2018 00:15:12 +0000 Subject: [PATCH 12/12] Don't fail if tag exists --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 907aa8b0..e548aa1f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ jobs: name: Create tags (master branch only) command: > if [ "${CIRCLE_BRANCH}" == "master" ]; then - git tag -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push --tags; + (git tag -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push --tags) || true; else echo "Only runs for master branch (this is ${CIRCLE_BRANCH})"; fi;