mirror of
https://github.com/zrepl/zrepl.git
synced 2025-02-16 10:29:54 +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"'"}'
|
-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:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build:
|
|
||||||
|
ci:
|
||||||
|
when: << pipeline.parameters.do_ci >>
|
||||||
jobs:
|
jobs:
|
||||||
- quickcheck-docs
|
- quickcheck-docs
|
||||||
- quickcheck-go: &quickcheck-go-smoketest
|
- quickcheck-go: &quickcheck-go-smoketest
|
||||||
@ -159,18 +174,10 @@ workflows:
|
|||||||
goos: freebsd
|
goos: freebsd
|
||||||
goarch: arm64
|
goarch: arm64
|
||||||
|
|
||||||
- request-release-build:
|
release:
|
||||||
type: approval
|
when: << pipeline.parameters.do_release >>
|
||||||
requires:
|
jobs:
|
||||||
- quickcheck-docs
|
- release-build
|
||||||
- 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-deb:
|
- release-deb:
|
||||||
requires:
|
requires:
|
||||||
- release-build
|
- release-build
|
||||||
@ -249,7 +256,7 @@ jobs:
|
|||||||
machine: true
|
machine: true
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: make release-docker
|
- run: make release-docker RELEASE_DOCKER_BASEIMAGE_TAG=<<pipeline.parameters.release_docker_baseimage_tag>>
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: .
|
root: .
|
||||||
paths: [.]
|
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)
|
GO_BUILD := $(GO_ENV_VARS) $(GO) build $(GO_BUILDFLAGS) -ldflags $(GO_LDFLAGS)
|
||||||
GOLANGCI_LINT := golangci-lint
|
GOLANGCI_LINT := golangci-lint
|
||||||
GOCOVMERGE := gocovmerge
|
GOCOVMERGE := gocovmerge
|
||||||
|
RELEASE_DOCKER_BASEIMAGE_TAG ?= 1.15
|
||||||
|
RELEASE_DOCKER_BASEIMAGE ?= golang:$(RELEASE_DOCKER_BASEIMAGE_TAG)
|
||||||
|
|
||||||
ifneq ($(GOARM),)
|
ifneq ($(GOARM),)
|
||||||
ZREPL_TARGET_TUPLE := $(GOOS)-$(GOARCH)v$(GOARM)
|
ZREPL_TARGET_TUPLE := $(GOOS)-$(GOARCH)v$(GOARM)
|
||||||
@ -57,8 +59,9 @@ ifeq (SIGN, 1)
|
|||||||
endif
|
endif
|
||||||
@echo "ZREPL RELEASE ARTIFACTS AVAILABLE IN artifacts/release"
|
@echo "ZREPL RELEASE ARTIFACTS AVAILABLE IN artifacts/release"
|
||||||
|
|
||||||
release-docker:
|
release-docker: $(ARTIFACTDIR)
|
||||||
docker build -t zrepl_release --pull -f build.Dockerfile .
|
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) \
|
docker run --rm -i -v $(CURDIR):/src -u $$(id -u):$$(id -g) \
|
||||||
zrepl_release \
|
zrepl_release \
|
||||||
make release GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM)
|
make release GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM)
|
||||||
@ -319,6 +322,7 @@ $(ARTIFACTDIR)/_zrepl.zsh_completion:
|
|||||||
|
|
||||||
$(ARTIFACTDIR)/go_env.txt:
|
$(ARTIFACTDIR)/go_env.txt:
|
||||||
$(GO_ENV_VARS) $(GO) env > $@
|
$(GO_ENV_VARS) $(GO) env > $@
|
||||||
|
$(GO) version >> $@
|
||||||
|
|
||||||
docs: $(ARTIFACTDIR)/docs
|
docs: $(ARTIFACTDIR)/docs
|
||||||
# https://www.sphinx-doc.org/en/master/man/sphinx-build.html
|
# 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 \
|
RUN apt-get update && apt-get install -y \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
|
@ -13,6 +13,7 @@ var (
|
|||||||
|
|
||||||
type ZreplVersionInformation struct {
|
type ZreplVersionInformation struct {
|
||||||
Version string
|
Version string
|
||||||
|
RuntimeGo string
|
||||||
RuntimeGOOS string
|
RuntimeGOOS string
|
||||||
RuntimeGOARCH string
|
RuntimeGOARCH string
|
||||||
RUNTIMECompiler string
|
RUNTIMECompiler string
|
||||||
@ -21,6 +22,7 @@ type ZreplVersionInformation struct {
|
|||||||
func NewZreplVersionInformation() *ZreplVersionInformation {
|
func NewZreplVersionInformation() *ZreplVersionInformation {
|
||||||
return &ZreplVersionInformation{
|
return &ZreplVersionInformation{
|
||||||
Version: zreplVersion,
|
Version: zreplVersion,
|
||||||
|
RuntimeGo: runtime.Version(),
|
||||||
RuntimeGOOS: runtime.GOOS,
|
RuntimeGOOS: runtime.GOOS,
|
||||||
RuntimeGOARCH: runtime.GOARCH,
|
RuntimeGOARCH: runtime.GOARCH,
|
||||||
RUNTIMECompiler: runtime.Compiler,
|
RUNTIMECompiler: runtime.Compiler,
|
||||||
@ -28,8 +30,8 @@ func NewZreplVersionInformation() *ZreplVersionInformation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *ZreplVersionInformation) String() string {
|
func (i *ZreplVersionInformation) String() string {
|
||||||
return fmt.Sprintf("zrepl version=%s GOOS=%s GOARCH=%s Compiler=%s",
|
return fmt.Sprintf("zrepl version=%s go=%s GOOS=%s GOARCH=%s Compiler=%s",
|
||||||
i.Version, i.RuntimeGOOS, i.RuntimeGOARCH, i.RUNTIMECompiler)
|
i.Version, i.RuntimeGo, i.RuntimeGOOS, i.RuntimeGOARCH, i.RUNTIMECompiler)
|
||||||
}
|
}
|
||||||
|
|
||||||
var prometheusMetric = prometheus.NewUntypedFunc(
|
var prometheusMetric = prometheus.NewUntypedFunc(
|
||||||
|
Loading…
Reference in New Issue
Block a user