Adapt Makefile and boardvoting.go to new ldflags
This commit is contained in:
parent
4d87e35ec2
commit
975f3c0837
4 changed files with 12 additions and 8 deletions
|
@ -7,12 +7,14 @@ before:
|
|||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=1
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.build={{.Env.BUILD}}
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
flags:
|
||||
- -buildmode=pie
|
||||
- -trimpath
|
||||
- -v
|
||||
archives:
|
||||
- replacements:
|
||||
linux: Linux
|
||||
|
@ -38,7 +40,7 @@ nfpms:
|
|||
- libsqlite3-0
|
||||
- adduser
|
||||
priority: optional
|
||||
bindir: /src/cacert-boardvoting
|
||||
bindir: /srv/cacert-boardvoting
|
||||
contents:
|
||||
- src: config.yaml.example
|
||||
dst: /usr/share/doc/cacert-boardvoting/examples/config.yaml.example
|
||||
|
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
|
@ -24,7 +24,7 @@ pipeline {
|
|||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh "make distclean && make BUILD='${env.BUILD_TAG}'"
|
||||
sh "make distclean && make"
|
||||
}
|
||||
}
|
||||
stage('Create build output') {
|
||||
|
|
5
Makefile
5
Makefile
|
@ -1,11 +1,12 @@
|
|||
VERSION := $(shell git describe --always --dirty=-dev)
|
||||
BUILD := $(shell date --iso-8601=seconds --utc)
|
||||
COMMIT := $(shell git show-ref --hash refs/heads/master)
|
||||
DATE := $(shell date --iso-8601=seconds --utc)
|
||||
GOFILES = $(shell find . -type f -name '*.go')
|
||||
|
||||
all: cacert-boardvoting
|
||||
|
||||
cacert-boardvoting: ${GOFILES}
|
||||
go build -o $@ -buildmode=pie -trimpath -x -ldflags " -s -w -X 'main.version=${VERSION}' -X 'main.build=${BUILD}'"
|
||||
go build -o $@ -buildmode=pie -trimpath -x -ldflags " -s -w -X 'main.version=${VERSION}' -X 'main.commit=${COMMIT}' -X 'main.date=${DATE}'"
|
||||
|
||||
clean:
|
||||
rm -f cacert-boardvoting
|
||||
|
|
|
@ -52,7 +52,8 @@ var config *Config
|
|||
var store *sessions.CookieStore
|
||||
var csrfKey []byte
|
||||
var version = "undefined"
|
||||
var build = "undefined"
|
||||
var commit = "undefined"
|
||||
var date = "undefined"
|
||||
|
||||
const (
|
||||
cookieSecretMinLen = 32
|
||||
|
@ -1014,7 +1015,7 @@ func setupTLSConfig() (tlsConfig *tls.Config) {
|
|||
|
||||
func main() {
|
||||
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
|
||||
log.Infof("CAcert Board Voting version %s, build %s", version, build)
|
||||
log.Infof("CAcert Board Voting version %s, commit %s built at %s", version, commit, date)
|
||||
|
||||
flag.StringVar(
|
||||
&configFile, "config", "config.yaml", "Configuration file name")
|
||||
|
|
Loading…
Reference in a new issue