Compare commits

..

No commits in common. "0c35993122f5db0d29900ab3197a44eae7281f75" and "95884e14d64a21cecf9fc5735d4c2258f84dad58" have entirely different histories.

8 changed files with 19 additions and 82 deletions

View File

@ -14,12 +14,6 @@ endif
PUBLISH_REPO := "core/oc-deploy"
PUBLISH_BRANCH := main
help:
@echo
@echo 'Usage:'
@echo ' make publish'
@echo ' make clean'
.PHONY: publish
publish:
@echo Publication de : ${OC_VERSION}

View File

@ -11,16 +11,6 @@ BIN_DIR = ../bin/
PLUGINS := $(wildcard ../plugins/*/*.go)
OBJS := ${PLUGINS:.go=.so}
##################
DATE := $(shell date)
GOVERSION := $(shell go version)
VERSION := $(shell git describe --tags --abbrev=8 --dirty --always --long)
PREFIX := "oc-deploy/version"
LDFLAGS := -X '${PREFIX}.Version=${VERSION}'
##################
%.so: %.go
go build -buildmode=plugin -o $@ $<
@ -33,44 +23,35 @@ help:
@echo ' make run BIN_OPTS=... Go run'
@echo ' make run_install BIN_OPTS=... Go run'
@echo ' make run_uninstall BIN_OPTS=... Go run'
@echo ' make run_version Go run'
@echo ' make exec BIN_OPTS=... exécutable'
@echo ' make exec_install BIN_OPTS=... exécutable'
@echo ' make exec_uninstall BIN_OPTS=... exécutable'
@echo ' make exec_version exécutable'
@echo ' make test Test.'
@echo ' make test Test'
@echo ' make clean Clean the directory tree.'
@echo
@echo ' DATE ${DATE}'
@echo ' GOVERSION ${GOVERSION}'
@echo ' VERSION ${VERSION}'
@echo
${BIN_DIR}/${BIN_NAME}: ${SOURCES} $(OBJS)
go build -o ${BIN_DIR}/${BIN_NAME} -ldflags "${LDFLAGS}"
go build -o ${BIN_DIR}/${BIN_NAME}
get-deps:
@go mod tidy
build: ${BIN_DIR}/${BIN_NAME}
run:
run: $(OBJS)
@go run main.go ${BIN_OPTS}
run_generate:
run_generate: $(OBJS)
@go run main.go generate ${BIN_OPTS}
run_install:
run_install: $(OBJS)
@go run main.go install ${BIN_OPTS}
run_uninstall:
run_uninstall: $(OBJS)
@go run main.go uninstall ${BIN_OPTS}
run_version:
@go run main.go version
exec: ${BIN_DIR}/${BIN_NAME} $(OBJS)
@${BIN_DIR}/${BIN_NAME} ${BIN_OPTS}
@ -80,9 +61,6 @@ exec_install: ${BIN_DIR}/${BIN_NAME} $(OBJS)
exec_uninstall: ${BIN_DIR}/${BIN_NAME} $(OBJS)
@${BIN_DIR}/${BIN_NAME} uninstall ${BIN_OPTS}
exec_version: ${BIN_DIR}/${BIN_NAME} $(OBJS)
@${BIN_DIR}/${BIN_NAME} version
clean:
@test ! -e ${BIN_DIR}/${BIN_NAME} || rm ${BIN_DIR}/${BIN_NAME}
@test ! -e .coverage.out || rm .coverage.out

View File

@ -24,7 +24,6 @@ func cobraInstallCmd() *cobra.Command {
Long: `deploy Charts`,
Args: cobra.MaximumNArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
log.Log().Info().Msg("oc-deploy :")
return InstallCmd(context, version, modules)
},
Example: "oc-deploy install --version 0.1.0 --context ex1",
@ -38,7 +37,6 @@ func cobraUninstallCmd() *cobra.Command{
Long: `Undeploy`,
Args: cobra.MaximumNArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
log.Log().Info().Msg("oc-deploy :")
return UninstallCmd(context)
},
Example: "oc-deploy uninstall --context ex1",
@ -50,29 +48,15 @@ func cobraGenerateCmd() *cobra.Command{
return &cobra.Command{
Use: "generate",
Short: "generate",
Long: "generate",
Long: "Value",
Args: cobra.MaximumNArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
log.Log().Info().Msg("oc-deploy :")
return GenerateCmd(context, version)
},
Example: "oc-deploy generate --version 0.1.0 --context ex1",
}
}
func cobraVersionCmd() *cobra.Command{
return &cobra.Command{
Use: "version",
Short: "version",
Long: "Get Version",
Args: cobra.MaximumNArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return VersionCmd()
},
Example: "oc-deploy version",
}
}
func Execute() {
log.Log().Debug().Msg("Execute")
@ -82,7 +66,6 @@ func Execute() {
var cmdInstall = cobraInstallCmd()
var cmdUninstall = cobraUninstallCmd()
var cmdGenerate = cobraGenerateCmd()
var cmdVersion = cobraVersionCmd()
cmdInstall.Flags().StringVarP(&context, "context", "c", "opencloud", "Nom du context")
cmdInstall.Flags().StringVarP(&version, "version", "v", "latest", "Version")
@ -96,7 +79,6 @@ func Execute() {
rootCmd.AddCommand(cmdInstall)
rootCmd.AddCommand(cmdUninstall)
rootCmd.AddCommand(cmdGenerate)
rootCmd.AddCommand(cmdVersion)
cobra.CheckErr(rootCmd.Execute())

View File

@ -31,8 +31,6 @@ func UninstallCmd(context string) error {
log.Log().Fatal().Msg(" >> " + err.Error())
}
obj.SetCommands()
err = obj.K8s(context)
if err != nil {
log.Log().Fatal().Msg(" >> " + err.Error())

View File

@ -1,15 +0,0 @@
package cmd
import (
"fmt"
log "oc-deploy/log_wrapper"
)
func VersionCmd() error {
version := "0.1.0"
log.Log().Debug().Msg(fmt.Sprintf("Version : %s", version))
fmt.Println(version)
return nil
}

View File

@ -163,3 +163,11 @@ func (this HelmCommand) chartExists(data HelmChart) (bool, error) {
return res != "", nil
}
// func (this HelmChart) GetRessources() (map[string]string, error) {
// hs := HelmStatus{Name: this.Name}
// hs.New(this.Bin)
// data, _ := hs.getRessources()
// return data, nil
// }

View File

@ -60,15 +60,13 @@ func (this *InstallClass) InstallCharts(modules []string) (error) {
var wg sync.WaitGroup
for _, v := range this.charts {
repoName := v.Repository.Name
for _, v1 := range v.Charts {
if len(modules) == 0 || utils.StringInSlice(v1.Name, modules) {
wg.Add(1)
go func() {
defer wg.Done()
this.installChart(repoName, v1)
this.installChart(v1)
} ()
}
}
@ -77,19 +75,12 @@ func (this *InstallClass) InstallCharts(modules []string) (error) {
return nil
}
func (this *InstallClass) installChart(repoName string, chart chart.ChartData) {
func (this *InstallClass) installChart(chart chart.ChartData) {
log.Log().Info().Msg(fmt.Sprintf(" << Chart : %s ", chart.Name))
chartName := chart.Chart
if chartName == "" {
chartName = chart.Name
}
if repoName != "" {
chartName = fmt.Sprintf("%s/%s", repoName, chartName)
}
data := helm.HelmChart{Name: chart.Name,
Chart: chartName,
Chart: chart.Chart,
Url: chart.Url,
Version: chart.Version,
Workspace: this.Workspace,

View File

@ -10,6 +10,7 @@ func main() {
log.InitLog(".oc-deploy")
log.Log().Debug().Msg("Start")
log.Log().Info().Msg("oc-deploy :")
cmd.Execute()