♻️ Lifecycle¶
Lifecycle defines scripts that are triggered by helmwave.
Flow hooks for helmwave up --build
flowchart LR
subgraph build
global_pre_build --> pre_build
subgraph release context
pre_build --> post_build
end
post_build --> global_post_build
end
global_post_build --> global_pre_up
subgraph up
global_pre_up --> pre_up
subgraph release context
pre_up --> post_up
end
post_up --> global_post_up
end
helmwave.yml
# Global hooks
lifecycle:
pre_build:
- cmd: "ls"
args: ["-l", "-a"]
show: false
- echo "global pre_build"
post_build:
- echo "global post_build"
pre_up:
- echo "global pre_up"
post_up:
- echo "global post_up"
pre_down:
- echo "global pre_down"
post_down:
- echo "global post_down"
pre_rollback:
- echo "global pre_rollback"
post_rollback:
- echo "global post_rollback"
registries:
- host: registry-1.docker.io
.options: &options
namespace: my-namespace
create_namespace: true
offline_kube_version: 1.22.0
wait: true
timeout: 1m
max_history: 3 # best practice
chart:
# For example, we will use bitnami/nats chart, because it's small and fast
name: oci://registry-1.docker.io/bitnamicharts/nats
version: 7.8.3 # best practice
releases:
- name: nats
<<: *options
# Special hooks for nats release
lifecycle:
pre_up:
- echo "pre_up for nats"
post_up:
- echo "post_up for nats"
pre_build:
- echo "pre_build for nats"
post_build:
- echo "post_build for nats"
pre_down:
- echo "pre_down for nats"
post_down:
- echo "post_down for nats"
pre_rollback:
- echo "pre_rollback for nats"
post_rollback:
- echo "post_rollback for nats"
$ helmwave build --diff-mode none
[🙃 aka INFO]: 🩼 Running pre-build hooks...
[🙃 aka INFO]: 🩼 running hook...
args:
- "global
- pre_build"
cmd: echo
[🙃 aka INFO]: "global pre_build"
[🙃 aka INFO]: 🔨 Building releases...
[🙃 aka INFO]: 🔨 Building graphs...
[🙃 aka INFO]: show graph:
┌────────────────┐
│ nats@my-nam... │
└────────────────┘
[🙃 aka INFO]: 🔨 Building values...
[🙃 aka INFO]: 🔨 no values provided
release: nats@my-namespace
[🙃 aka INFO]: 🔨 Building repositories...
[🙃 aka INFO]: 🔨 Building registries...
[🙃 aka INFO]: 🗄 registry has been added to the plan
registry: registry-1.docker.io
[🙃 aka INFO]: 🔨 Building charts...
[🙃 aka INFO]: Pulled: registry-1.docker.io/bitnamicharts/nats:7.8.3
[🙃 aka INFO]: Digest: sha256:5f80350b8a85177e4a9c7ed968f77c47bedcc461418172fb66594bc61fa1ffac
[🙃 aka INFO]: 🔨 Building manifests...
[🙃 aka INFO]: ❎ skipping updating dependencies for remote chart
release: nats@my-namespace
[🙃 aka INFO]: 🩼 Running pre-build hooks...
[🙃 aka INFO]: 🩼 running hook...
args:
- "pre_build
- for
- nats"
cmd: echo
[🙃 aka INFO]: "pre_build for nats"
[🙃 aka INFO]: Pulled: registry-1.docker.io/bitnamicharts/nats:7.8.3
[🙃 aka INFO]: Digest: sha256:5f80350b8a85177e4a9c7ed968f77c47bedcc461418172fb66594bc61fa1ffac
[🙃 aka INFO]: 🩼 Running post-build hooks...
[🙃 aka INFO]: 🩼 running hook...
args:
- "post_build
- for
- nats"
cmd: echo
[🙃 aka INFO]: "post_build for nats"
[🙃 aka INFO]: ✅ manifest done
release: nats@my-namespace
[🙃 aka INFO]: 🩼 Running post-build hooks...
[🙃 aka INFO]: 🩼 running hook...
cmd: echo
args:
- "global
- post_build"
[🙃 aka INFO]: "global post_build"
[🙃 aka INFO]: 🏗 Plan
repositories:
-
registries:
- registry-1.docker.io
releases:
- nats@my-namespace
[🙃 aka INFO]: 🆚 Skip diffing
[🙃 aka INFO]: 🏗 Planfile is ready!