Files
homelab/magefiles/magefile.go
T
2026-04-17 20:49:37 -04:00

50 lines
1.1 KiB
Go

package main
import (
"danicos.dev/daniel/homelab/pkg/root"
"danicos.dev/daniel/homelab/pkg/target"
// "github.com/magefile/mage/mg" // mg contains helpful utility functions, like Deps
/*
NOTE: Mage https://github.com/magefile/mage
Mage other packages
"github.com/magefile/mage/mage"
"github.com/magefile/mage/parse"
"github.com/magefile/mage/target"
*/)
var r target.Runner
var Default = Build
var Aliases = map[string]any{
"b": Build,
}
func init() {
Env := map[string]string{
"LINUX_ADMIN": "arch",
"CLUSTER_NAME": root.HYDRA_CLUSTER,
"CLUSTER_HOST": root.HYDRA_HOSTNAME,
"GITEA_HOST": root.GITEA_HOST,
}
r = target.NewRunner(Env, nil)
}
func Build() error {
t := target.NewA("go", "run", ".")
return r.RunV("run", t)
}
func InstallK3S() error {
t := target.New("./scripts/install_k3s.sh")
return r.RunV("Install k3s", t)
}
func GetKubeconfig() error {
t := target.New("./scripts/get_kubeconfig.sh")
return r.RunV("Get Kubeconfig", t)
}
func InstallFlux() error {
t := target.New("./scripts/install_flux.sh")
return r.RunV("Install Flux", t)
}