Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
133 lines (106 loc) · 4.88 KB
/
Copy pathjustfile
File metadata and controls
133 lines (106 loc) · 4.88 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
export DOCKER_PROGRESS := env_var_or_default('DOCKER_PROGRESS', 'auto')
features := ""
libc := "libc"
arch := "" # use the default architecture
os := "" # use the default os
image := "ghcr.io/restatedev/restate-operator:local"
_features := if features == "all" {
"--all-features"
} else if features != "" {
"--features=" + features
} else { "" }
_arch := if arch == "" {
arch()
} else if arch == "amd64" {
"x86_64"
} else if arch == "x86_64" {
"x86_64"
} else if arch == "arm64" {
"aarch64"
} else if arch == "aarch64" {
"aarch64"
} else {
error("unsupported arch=" + arch)
}
_os := if os == "" {
os()
} else {
os
}
_os_target := if _os == "macos" {
"apple-darwin"
} else if _os == "linux" {
"unknown-linux"
} else {
error("unsupported os=" + _os)
}
_default_target := `rustc -vV | sed -n 's|host: ||p'`
target := _arch + "-" + _os_target + if _os == "linux" { "-" + libc } else { "" }
_resolved_target := if target != _default_target { target } else { "" }
_target-option := if _resolved_target != "" { "--target " + _resolved_target } else { "" }
# Code generation. Everything under crd/ is generated from the Rust structs in src/resources/*.rs.
# Never hand-edit files under crd/ -- always regenerate. See AGENTS.md for the full workflow.
# The pkl CLI version the committed Pkl bindings/examples were generated with. The generator *package*
# is hash-pinned in crd/pklgen/*.pkl, but the pkl CLI that runs it is not, and other versions may emit
# spurious diffs (formatting, type naming). Regenerate with this version, or bump this pin deliberately.
pkl_version := "0.31.1"
# Regenerate every generated artifact after a CRD struct change (CRD YAML, then Pkl, then examples).
# Requires `pkl` on PATH for the pkl/examples steps.
generate-all: generate generate-pkl generate-examples
# Warn (don't fail) if the local pkl CLI differs from the pinned version used to generate the bindings.
_check-pkl:
@pkl --version | grep -q "{{pkl_version}}" || echo "WARNING: this repo's Pkl artifacts were generated with pkl {{pkl_version}}; you have '$(pkl --version)'. Regenerated output may differ -- see AGENTS.md."
# Regenerate the CRD YAML schemas -- the authoritative contract shipped in the Helm chart.
# Always run and commit this after changing a CRD struct. Pure Rust codegen; no external tools.
generate:
cargo run --bin cluster_crdgen | grep -vF 'categories: []' > crd/restateclusters.yaml
cargo run --bin deployment_crdgen | grep -vF 'categories: []' > crd/restatedeployments.yaml
cargo run --bin cloud_crdgen | grep -vF 'categories: []' > crd/restatecloudenvironments.yaml
# Regenerate the Pkl bindings (a convenience for Pkl users) from the CRD YAML. Requires `pkl`;
# run `just generate` first so the YAML is current. The generator package is pinned by version and
# sha256 in crd/pklgen/*.pkl for reproducibility. Use the pinned pkl CLI (see pkl_version above).
generate-pkl: _check-pkl
pkl eval crd/pklgen/generate-cluster.pkl -m crd
pkl eval crd/pklgen/generate-deployment.pkl -m crd
pkl eval crd/pklgen/generate-cloud.pkl -m crd
# pkl resolves the relative `source` to an absolute file:// URI in the generated header comment;
# rewrite it back to the repo-relative form so the committed files stay portable.
sed -i.bak -E 's#<file://[^ ]*/\./crd/#<file:./crd/#' crd/RestateCluster.pkl crd/RestateDeployment.pkl crd/RestateCloudEnvironment.pkl
rm -f crd/*.pkl.bak
generate-examples: _check-pkl
pkl eval crd/examples/restatedeployment.pkl > crd/examples/restatedeployment.yaml
pkl eval crd/examples/restatecluster.pkl > crd/examples/restatecluster.yaml
install-crds: generate
kubectl create -f crd/restateclusters.yaml
kubectl create -f crd/restatedeployments.yaml
# Extract dependencies
chef-prepare:
cargo chef prepare --recipe-path recipe.json
# Compile dependencies
chef-cook *flags:
cargo chef cook --recipe-path recipe.json {{ _target-option }} {{ _features }} {{ flags }}
print-target:
@echo {{ _resolved_target }}
build *flags:
cargo build {{ _target-option }} {{ _features }} {{ flags }}
docker:
docker build . -f docker/Dockerfile --tag={{ image }} --progress='{{ DOCKER_PROGRESS }}' --load
kind_cluster := "restate-operator"
# Create the kind cluster (if absent) and start Tilt. See the repo-root Tiltfile.
tilt-up:
kind get clusters | grep -qx {{ kind_cluster }} || kind create cluster --name {{ kind_cluster }} --config tilt/kind.yaml
tilt up
# Stop Tilt and tear the kind cluster down.
tilt-down:
-tilt down
-kind delete cluster --name {{ kind_cluster }}
fmt:
cargo fmt --all
lint:
cargo clippy
test:
cargo test --all-targets
# Docker-backed RestateDeployment introspection compatibility tests.
test-e2e:
cargo test --lib controllers::restatedeployment::e2e -- --ignored --nocapture --test-threads=1
check: fmt lint