This repository was archived by the owner on Jul 20, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (51 loc) · 2.9 KB
/
Makefile
File metadata and controls
70 lines (51 loc) · 2.9 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
# =============
# This file is automatically generated from the templates in stackabletech/operator-templating
# DO NOT MANUALLY EDIT THIS FILE
# =============
# This script requires https://github.com/mikefarah/yq (not to be confused with https://github.com/kislyuk/yq)
# It is available from Nixpkgs as `yq-go` (`nix shell nixpkgs#yq-go`)
.PHONY: docker chart-lint compile-chart
TAG := $(shell git rev-parse --short HEAD)
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-spark-operator") | .version')
IS_NIGHTLY := $(shell echo "${VERSION}" | grep -- '-nightly$$')
# When rendering docs we want to simplify the version number slightly, only rendering "nightly" for nightly branches
# (since we only render nightlies for the active development trunk anyway) and chopping off the semver patch version otherwise
DOCS_VERSION := $(if ${IS_NIGHTLY},nightly,$(shell echo "${VERSION}" | sed 's/^\([0-9]\+\.[0-9]\+\)\..*$$/\1/'))
export VERSION IS_NIGHTLY DOCS_VERSION
SHELL=/bin/bash -euo pipefail
## Docker related targets
docker-build:
docker build --force-rm --build-arg VERSION=${VERSION} -t "docker.stackable.tech/stackable/spark-operator:${VERSION}" -f docker/Dockerfile .
docker-build-latest: docker-build
docker tag "docker.stackable.tech/stackable/spark-operator:${VERSION}" \
"docker.stackable.tech/stackable/spark-operator:latest"
docker-publish:
echo "${NEXUS_PASSWORD}" | docker login --username github --password-stdin docker.stackable.tech
docker push --all-tags docker.stackable.tech/stackable/spark-operator
docker: docker-build docker-publish
docker-release: docker-build-latest docker-publish
## Chart related targets
compile-chart: version crds config
chart-clean:
rm -rf deploy/helm/spark-operator/configs
rm -rf deploy/helm/spark-operator/crds
version:
yq eval -i '.version = strenv(VERSION) | .appVersion = strenv(VERSION)' /dev/stdin < deploy/helm/spark-operator/Chart.yaml
yq eval -i '.version = strenv(DOCS_VERSION) | .prerelease = strenv(IS_NIGHTLY) != ""' /dev/stdin < docs/antora.yml
config:
if [ -d "deploy/config-spec/" ]; then\
mkdir -p deploy/helm/spark-operator/configs;\
cp -r deploy/config-spec/* deploy/helm/spark-operator/configs;\
fi
crds:
mkdir -p deploy/helm/spark-operator/crds
cargo run --bin stackable-spark-operator -- crd | yq eval '.metadata.annotations["helm.sh/resource-policy"]="keep"' - > deploy/helm/spark-operator/crds/crds.yaml
chart-lint: compile-chart
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint --config deploy/helm/ct.yaml
## Manifest related targets
clean-manifests:
mkdir -p deploy/manifests
rm -rf $$(find deploy/manifests -maxdepth 1 -mindepth 1 -not -name Kustomization)
generate-manifests: clean-manifests compile-chart
./scripts/generate-manifests.sh
regenerate-charts: chart-clean clean-manifests compile-chart generate-manifests