This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/universe.dagger.io/x/vgjm456@qq.com/helm/install.cue
vgjm fe5496b3ff feat: support helm
Signed-off-by: vgjm <vgjm456@qq.com>
2022-04-16 14:10:01 +08:00

65 lines
1.1 KiB
CUE

package helm
import (
"dagger.io/dagger"
"universe.dagger.io/docker"
)
#Install: {
// Name of your release
name: string | *""
kubeconfig: dagger.#Secret
source: *"repository" | "URL"
{
source: "repository"
chart: string
repoName: string
repository: string
run: {
env: {
CHART: chart
REPO_NAME: repoName
REPOSITORY: repository
}
_script: #"""
helm repo add $REPO_NAME $REPOSITORY
helm repo update
helm install $NAME $REPO_NAME/$CHART $GENERATE_NAME
"""#
}
} | {
source: "URL"
URL: string
run: {
env: "URL": URL
_script: #"""
helm install $NAME $URL $GENERATE_NAME
"""#
}
}
_base: #Image
run: docker.#Run & {
input: _base.output
env: {
NAME: name
GENERATE_NAME: _generateName
}
mounts: "/root/.kube/config": {
dest: "/root/.kube/config"
type: "secret"
contents: kubeconfig
}
entrypoint: ["/bin/sh"]
command: {
name: "-c"
args: [run._script]
}
}
_generateName: string | *""
if name == "" {
_generateName: "--generate-name"
}
}