From 64243382cfc171b582f2815be12cbdee29b66297 Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Tue, 5 Jul 2016 21:03:37 +0200 Subject: [PATCH] Add codename Signed-off-by: Emile Vauge --- .travis.yml | 1 + Makefile | 3 ++- script/binary | 6 +++++- script/crossbinary | 8 ++++++-- traefik.go | 3 +++ version.go | 2 ++ 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index adcc5e2c8..a1ae99059 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ env: - secure: btt4r13t09gQlHb6gYrvGC2yGCMMHfnp1Mz1RQedc4Mpf/FfT8aE6xmK2a2i9CCvskjrP0t/BFaS4yxIURjnFRn+ugQIEa0pLspB9UJArW/vgOSpIWM9/OQ/fg8z5XuMxN6Md4DL1/iLypMNSageA1x0TRdt89+D1N1dALpg5XRCXLFbC84TLi0gjlFuib9ibPKzEhLT+anCRJ6iZMzeupDSoaCVbAtJMoDvXw4+4AcRZ1+k4MybBLyCib5boaEOt4pTT88mz4Kk0YaMwPVJyg9Qv36VqyUcPS09Yd95LuyVQ4+tZt8Y1ccbIzULsK+sLM3hLCzxlmlpN3dQBlZJiiRtQde0mgGAKyC0P0A1XjuDTywcsa5edB+fTk1Dsewz9xZ9V0NmMz8t+UNZnaSsAPga9i86jULbXUUwMVSzVRc+Xgx02liB/8qI1xYC9FM6ilStt7rn7mF0k3KbiWhcptgeXjO6Lah9FjEKd5w4MXsdUSTi/86rQaLo+kj+XdaTrXCTulKHyRyQEUj+8V1w0oVz7pcGjePHd7y5oU9ByifVQy6sytuFBfRZvugM5bKHo+i0pcWvixrZS42DrzwxZJsspANOvqSe5ifVbvOkfUppQdCBIwptxV5N1b49XPKU3W/w34QJ8xGmKp3TFA7WwVCztriFHjPgiRpB3EG99Bg= - REPO: $TRAVIS_REPO_SLUG - VERSION: $TRAVIS_TAG + - CODENAME: reblochon matrix: - DOCKER_VERSION=1.9.1 - DOCKER_VERSION=1.10.1 diff --git a/Makefile b/Makefile index 8ca374210..7ddb7564d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ TRAEFIK_ENVS := \ -e OS_PLATFORM_ARG \ -e TESTFLAGS \ -e VERBOSE \ - -e VERSION + -e VERSION \ + -e CODENAME SRCS = $(shell git ls-files '*.go' | grep -v '^external/') diff --git a/script/binary b/script/binary index fe69c9d56..9ed9225a5 100755 --- a/script/binary +++ b/script/binary @@ -17,9 +17,13 @@ if [ -z "$VERSION" ]; then VERSION=$(git rev-parse HEAD) fi +if [ -z "$CODENAME" ]; then + CODENAME=cheddar +fi + if [ -z "$DATE" ]; then DATE=$(date -u '+%Y-%m-%d_%I:%M:%S%p') fi # Build binaries -CGO_ENABLED=0 GOGC=off go build $FLAGS -ldflags "-s -w -X main.Version=$VERSION -X main.BuildDate=$DATE" -a -installsuffix nocgo -o dist/traefik . +CGO_ENABLED=0 GOGC=off go build $FLAGS -ldflags "-s -w -X main.Version=$VERSION -X main.Codename=$CODENAME -X main.BuildDate=$DATE" -a -installsuffix nocgo -o dist/traefik . diff --git a/script/crossbinary b/script/crossbinary index 055dc5210..11537f8e0 100755 --- a/script/crossbinary +++ b/script/crossbinary @@ -10,6 +10,10 @@ if [ -z "$VERSION" ]; then VERSION=$(git rev-parse HEAD) fi +if [ -z "$CODENAME" ]; then + CODENAME=cheddar +fi + if [ -z "$DATE" ]; then DATE=$(date -u '+%Y-%m-%d_%I:%M:%S%p') fi @@ -23,7 +27,7 @@ OS_ARCH_ARG=(386 amd64) for OS in ${OS_PLATFORM_ARG[@]}; do for ARCH in ${OS_ARCH_ARG[@]}; do echo "Building binary for $OS/$ARCH..." - GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=$VERSION -X main.BuildDate=$DATE" -o "dist/traefik_$OS-$ARCH" . + GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=$VERSION -X main.Codename=$CODENAME -X main.BuildDate=$DATE" -o "dist/traefik_$OS-$ARCH" . done done @@ -34,6 +38,6 @@ OS_ARCH_ARG=(arm arm64) for OS in ${OS_PLATFORM_ARG[@]}; do for ARCH in ${OS_ARCH_ARG[@]}; do echo "Building binary for $OS/$ARCH..." - GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=$VERSION -X main.BuildDate=$DATE" -o "dist/traefik_$OS-$ARCH" . + GOARCH=$ARCH GOOS=$OS CGO_ENABLED=0 go build -ldflags "-s -w -X main.Version=$VERSION -X main.Codename=$CODENAME -X main.BuildDate=$DATE" -o "dist/traefik_$OS-$ARCH" . done done \ No newline at end of file diff --git a/traefik.go b/traefik.go index f870cffd4..a471796ff 100644 --- a/traefik.go +++ b/traefik.go @@ -20,6 +20,7 @@ import ( ) var versionTemplate = `Version: {{.Version}} +Codename: {{.Codename}} Go version: {{.GoVersion}} Built: {{.BuildTime}} OS/Arch: {{.Os}}/{{.Arch}}` @@ -57,12 +58,14 @@ Complete documentation is available at https://traefik.io`, v := struct { Version string + Codename string GoVersion string BuildTime string Os string Arch string }{ Version: Version, + Codename: Codename, GoVersion: runtime.Version(), BuildTime: BuildDate, Os: runtime.GOOS, diff --git a/version.go b/version.go index 10f7cdb3c..73892b697 100644 --- a/version.go +++ b/version.go @@ -3,6 +3,8 @@ package main var ( // Version holds the current version of traefik. Version = "dev" + // Codename holds the current version codename of traefik. + Codename = "cheddar" // beta cheese // BuildDate holds the build date of traefik. BuildDate = "I don't remember exactly" )