compile_vars

package module
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 2 Imported by: 0

README

Библиотека используется для автоматического версионирования GO-приложения с использованием переменных gitlab

В dockerfile надо изменить строку билда на такую:

RUN go build -ldflags "-X github.com/PCManiac/compile_vars.version=${CI_PIPELINE_IID} -X github.com/PCManiac/compile_vars.build_time=`date +%FT%T%z`" -o server ./...

Ну и в .gitlab-ci.yml собирать докер с подстановкой переменных

- docker build --build-arg CI_PIPELINE_IID="$CI_PIPELINE_IID" --build-arg GITLAB_TOKEN="$CI_JOB_TOKEN" --pull -t "$CI_REGISTRY_IMAGE" .

При инициализации модуля в log будет добавлена строка с номером версии и временем билда. При необходимости эти значения также можно получить с помощью функций GetVersion() и GetBuildTime()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuildTime

func GetBuildTime() string

func GetVersion

func GetVersion() string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL