-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathenv.mk
More file actions
87 lines (71 loc) · 2.19 KB
/
env.mk
File metadata and controls
87 lines (71 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Common Makefile environment variable definitions
SHELL := /bin/bash
colon := :
comma := ,
# GOPATH might not be exported in the current shell but is available in the
# Go environment.
ifeq ($(GOPATH),)
GOPATH=$(shell go env GOPATH)
export GOPATH
endif
# GOPATH might actually be a colon-separated list of paths. For the purposes of
# this makefile, work with the first element only.
ifeq ($(findstring :, $(GOPATH)), $(colon))
GOPATH := $(firstword $(subst :, ,$(GOPATH)))
endif
export CGO_ENABLED ?= 1
export DEFAULT_GOOS GOARCH GOTAGS GO111MODULE GOBIN GOPROXY
# Update the arch to arm64 but only for Macs running on Apple Silicon (M1)
ifeq ($(GOARCH),)
ifeq ($(shell uname -ms),Darwin arm64)
GOARCH := arm64
else ifeq ($(shell uname -ms),Linux aarch64)
GOARCH := arm64
else ifeq ($(shell uname -ms),Linux ppc64le)
GOARCH := ppc64le
else ifeq ($(shell uname -ms),Linux s390x)
GOARCH := s390x
else
GOARCH := amd64
endif
endif
DEFAULT_GOOS := linux
GO111MODULE := on
GOPROXY := https://proxy.golang.org|https://goproxy.io|direct
ifeq ($(GOBIN),)
GOBIN := $(GOPATH)/bin
endif
TAG := # make sure tag is never injectable as an env var
RELEASE_GOTAGS := release
# Use a release go -tag when CI is targeting a tag
ifdef CI
ifneq ($(BUILD_TAG),)
# Preserve existing GOTAGS and append release tags
GOTAGS := $(if $(GOTAGS),$(GOTAGS)$(comma))$(RELEASE_GOTAGS)
endif
endif
ifneq ($(BUILD_TAG),)
TAG := $(BUILD_TAG)
endif
ifeq ($(TAG),)
TAG=$(shell git describe --tags --abbrev=10 --dirty --long --exclude '*-nightly-*')
endif
# Set expiration on Quay.io for non-release tags.
ifeq ($(findstring x,$(TAG)),x)
QUAY_TAG_EXPIRATION=13w
else
QUAY_TAG_EXPIRATION=never
endif
ROX_PRODUCT_BRANDING ?= STACKROX_BRANDING
# ROX_IMAGE_FLAVOR is an ARG used in Dockerfiles that defines the default registries for main, scanner, and collector images.
# ROX_IMAGE_FLAVOR valid values are: development_build, rhacs, opensource.
ROX_IMAGE_FLAVOR ?= $(shell \
if [[ "$(ROX_PRODUCT_BRANDING)" == "STACKROX_BRANDING" ]]; then \
echo "opensource"; \
else \
echo "development_build"; \
fi)
DEFAULT_IMAGE_REGISTRY := quay.io/stackrox-io
ifeq ($(ROX_PRODUCT_BRANDING),RHACS_BRANDING)
DEFAULT_IMAGE_REGISTRY := quay.io/rhacs-eng
endif