mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 01:44:43 +01:00
build: parametrized pipeline (no more approval for release build), embed exact go version info in artifacts
refs #378 refs #377
This commit is contained in:
parent
0f4143c0e0
commit
b9503685f0
@ -127,10 +127,25 @@ commands:
|
||||
-d '{"context":"'"$CONTEXT"'", "state": "success", "description":"'"$DESCRIPTION"'", "target_url":"'"$TARGETURL"'"}'
|
||||
|
||||
|
||||
parameters:
|
||||
|
||||
do_ci:
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
do_release:
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
release_docker_baseimage_tag:
|
||||
type: string
|
||||
default: "latest"
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
|
||||
ci:
|
||||
when: << pipeline.parameters.do_ci >>
|
||||
jobs:
|
||||
- quickcheck-docs
|
||||
- quickcheck-go: &quickcheck-go-smoketest
|
||||
@ -159,18 +174,10 @@ workflows:
|
||||
goos: freebsd
|
||||
goarch: arm64
|
||||
|
||||
- request-release-build:
|
||||
type: approval
|
||||
requires:
|
||||
- quickcheck-docs
|
||||
- quickcheck-go-amd64-linux-1.15 #quickcheck-go-smoketest.name
|
||||
- quickcheck-go-matrix
|
||||
- test-go-on-latest-go-release
|
||||
|
||||
- release-build:
|
||||
requires:
|
||||
- request-release-build
|
||||
|
||||
release:
|
||||
when: << pipeline.parameters.do_release >>
|
||||
jobs:
|
||||
- release-build
|
||||
- release-deb:
|
||||
requires:
|
||||
- release-build
|
||||
@ -249,7 +256,7 @@ jobs:
|
||||
machine: true
|
||||
steps:
|
||||
- checkout
|
||||
- run: make release-docker
|
||||
- run: make release-docker RELEASE_DOCKER_BASEIMAGE_TAG=<<pipeline.parameters.release_docker_baseimage_tag>>
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: [.]
|
||||
|
8
Makefile
8
Makefile
@ -28,6 +28,8 @@ GO_BUILDFLAGS := $(GO_MOD_READONLY) $(GO_EXTRA_BUILDFLAGS)
|
||||
GO_BUILD := $(GO_ENV_VARS) $(GO) build $(GO_BUILDFLAGS) -ldflags $(GO_LDFLAGS)
|
||||
GOLANGCI_LINT := golangci-lint
|
||||
GOCOVMERGE := gocovmerge
|
||||
RELEASE_DOCKER_BASEIMAGE_TAG ?= 1.15
|
||||
RELEASE_DOCKER_BASEIMAGE ?= golang:$(RELEASE_DOCKER_BASEIMAGE_TAG)
|
||||
|
||||
ifneq ($(GOARM),)
|
||||
ZREPL_TARGET_TUPLE := $(GOOS)-$(GOARCH)v$(GOARM)
|
||||
@ -57,8 +59,9 @@ ifeq (SIGN, 1)
|
||||
endif
|
||||
@echo "ZREPL RELEASE ARTIFACTS AVAILABLE IN artifacts/release"
|
||||
|
||||
release-docker:
|
||||
docker build -t zrepl_release --pull -f build.Dockerfile .
|
||||
release-docker: $(ARTIFACTDIR)
|
||||
sed 's/FROM.*!SUBSTITUTED_BY_MAKEFILE/FROM $(RELEASE_DOCKER_BASEIMAGE)/' build.Dockerfile > artifacts/release-docker.Dockerfile
|
||||
docker build -t zrepl_release --pull -f artifacts/release-docker.Dockerfile .
|
||||
docker run --rm -i -v $(CURDIR):/src -u $$(id -u):$$(id -g) \
|
||||
zrepl_release \
|
||||
make release GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM)
|
||||
@ -319,6 +322,7 @@ $(ARTIFACTDIR)/_zrepl.zsh_completion:
|
||||
|
||||
$(ARTIFACTDIR)/go_env.txt:
|
||||
$(GO_ENV_VARS) $(GO) env > $@
|
||||
$(GO) version >> $@
|
||||
|
||||
docs: $(ARTIFACTDIR)/docs
|
||||
# https://www.sphinx-doc.org/en/master/man/sphinx-build.html
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:latest
|
||||
FROM !SUBSTITUTED_BY_MAKEFILE
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3-pip \
|
||||
|
@ -13,6 +13,7 @@ var (
|
||||
|
||||
type ZreplVersionInformation struct {
|
||||
Version string
|
||||
RuntimeGo string
|
||||
RuntimeGOOS string
|
||||
RuntimeGOARCH string
|
||||
RUNTIMECompiler string
|
||||
@ -21,6 +22,7 @@ type ZreplVersionInformation struct {
|
||||
func NewZreplVersionInformation() *ZreplVersionInformation {
|
||||
return &ZreplVersionInformation{
|
||||
Version: zreplVersion,
|
||||
RuntimeGo: runtime.Version(),
|
||||
RuntimeGOOS: runtime.GOOS,
|
||||
RuntimeGOARCH: runtime.GOARCH,
|
||||
RUNTIMECompiler: runtime.Compiler,
|
||||
@ -28,8 +30,8 @@ func NewZreplVersionInformation() *ZreplVersionInformation {
|
||||
}
|
||||
|
||||
func (i *ZreplVersionInformation) String() string {
|
||||
return fmt.Sprintf("zrepl version=%s GOOS=%s GOARCH=%s Compiler=%s",
|
||||
i.Version, i.RuntimeGOOS, i.RuntimeGOARCH, i.RUNTIMECompiler)
|
||||
return fmt.Sprintf("zrepl version=%s go=%s GOOS=%s GOARCH=%s Compiler=%s",
|
||||
i.Version, i.RuntimeGo, i.RuntimeGOOS, i.RuntimeGOARCH, i.RUNTIMECompiler)
|
||||
}
|
||||
|
||||
var prometheusMetric = prometheus.NewUntypedFunc(
|
||||
|
Loading…
Reference in New Issue
Block a user