-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (52 loc) · 2.14 KB
/
Makefile
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
# Copyright 2023 Canonical Ltd.
# Licensed under the AGPLv3, see LICENCE file for details.
SKIP_VERSIONS=3.2.0
JUJU_VERSIONS=bash -c '. "./make_functions.sh"; juju_versions "$$@"' juju_versions
CACHE_VERSION=bash -c '. "./make_functions.sh"; cache_version "$$@"' cache_version
PREPARE_BUILD=bash -c '. "./make_functions.sh"; prepare_build "$$@"' prepare_build
VALIDATE_BUILD=bash -c '. "./make_functions.sh"; validate_build "$$@"' validate_build
VERSIONS ?= $(shell $(JUJU_VERSIONS) $(SKIP_VERSIONS))
OCI_IMAGE_PLATFORMS ?= linux/amd64 linux/arm64 linux/s390x linux/ppc64el
OCI_REPOSITORIES ?= public.ecr.aws/juju ghcr.io/juju docker.io/jujusolutions
BOOTSTRAP_CLOUD ?= minikube
export OCI_BUILDER ?= $(shell (which podman 2>&1 > /dev/null && echo podman) || echo docker )
default: build
release: validate
## release: validate and push
+$(MAKE) push
build: SUBMAKE_TARGET = "operator-image"
build: $(VERSIONS)
## push: for all VERSIONS build the operator-image target.
push: SUBMAKE_TARGET = "push-release-operator-image"
push: $(VERSIONS)
## push: for all VERSIONS build the push-release-operator-image target.
local: SUBMAKE_TARGET = "operator-image"
local: OCI_IMAGE_PLATFORMS = linux/amd64
local: $(VERSIONS)
## local: for all VERSIONS build the operator-image target with the local platform.
validate: $(addprefix _validate/,$(VERSIONS))
## validate: validate all VERSIONS
_validate/%: TEST_REPOSITORY=$(wordlist 1, 1, $(OCI_REPOSITORIES))
_validate/%: VERSION=$(@:_validate/%=%)
_validate/%: local
## _validate/%: validates a version of juju for the first repository.
$(VALIDATE_BUILD) "$(VERSION)" "$(TEST_REPOSITORY)/jujud-operator:$(VERSION)" "$(BOOTSTRAP_CLOUD)" "$(TEST_REPOSITORY)"
%:
## %: SUBMAKE_TARGET a version of juju for each repository.
$(CACHE_VERSION) "$@"
$(PREPARE_BUILD) "$@"
+cd "_build/$@/" && \
$(foreach DOCKER_USERNAME,$(OCI_REPOSITORIES),\
$(MAKE) $(SUBMAKE_TARGET) OPERATOR_IMAGE_BUILD_SRC=false OCI_IMAGE_PLATFORMS="$(OCI_IMAGE_PLATFORMS)" DOCKER_USERNAME="$(DOCKER_USERNAME)";\
)
check:
shellcheck ./*.sh
.PHONY: default
.PHONY: build
.PHONY: release
.PHONY: push
.PHONY: local
.PHONY: check
.PHONY: validate
.PHONY: _validate/%
.PHONY: %