From 340b24d862844c150e59f56d2af327440c580d40 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sat, 2 Sep 2017 21:37:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B5=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 8 +++++++- bootstrap/bootstrap.go | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad80dc0..79d11f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,13 @@ build executable: <<: *setup_go_environment stage: build script: - - env GOOS=linux go build -o $CI_PROJECT_DIR/minecraft-skinsystem main.go + - export VERSION="${CI_BUILD_TAG:-dev-$CI_BUILD_REF_NAME-${CI_BUILD_REF:0:8}+build-$CI_BUILD_ID}" + - > + env GOOS=linux + go build + -o $CI_PROJECT_DIR/minecraft-skinsystem + -ldflags "-X ${CI_PROJECT_NAMESPACE}/bootstrap.version=${VERSION}" + main.go artifacts: name: "${CI_JOB_STAGE} executable" paths: diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index 0a35f1b..e0048a1 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -15,6 +15,12 @@ import ( "elyby/minecraft-skinsystem/logger/receivers/sentry" ) +var version = "" + +func GetVersion() string { + return version +} + func CreateLogger(statsdAddr string, sentryAddr string) (wd.Watchdog, error) { wd.AddReceiver(ansi.New(true, true, false)) if statsdAddr != "" { @@ -38,9 +44,12 @@ func CreateLogger(statsdAddr string, sentryAddr string) (wd.Watchdog, error) { return nil, err } - ravenClient.SetRelease("1.3.2") // TODO: нужно как-то записывать версию во время билда ravenClient.SetEnvironment("production") ravenClient.SetDefaultLoggerName("sentry-watchdog-receiver") + programVersion := GetVersion() + if programVersion != "" { + raven.SetRelease(programVersion) + } sentryReceiver, err := sentry.NewReceiverWithCustomRaven(ravenClient, &sentry.Config{ MinLevel: "warn",