Skip to content

Commit

Permalink
Merge pull request #524 from Praqma/helmsman_labels
Browse files Browse the repository at this point in the history
fix: helm test resets release labels
  • Loading branch information
luisdavim authored Oct 8, 2020
2 parents 51edea0 + 7a4ac46 commit 43d2ca7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ update-deps: ## Update depdendencies. Runs `go get -u` internally.
@GOFLAGS="" go mod tidy
@GOFLAGS="" go mod vendor

build: vet deps ## Build the package
build: deps vet ## Build the package
@go build -o helmsman -ldflags '-X main.version="${TAG}-${DATE}" -extldflags "-static"' cmd/helmsman/main.go

generate:
Expand All @@ -65,6 +65,7 @@ generate:

repo:
@helm repo list | grep -q "^stable " || helm repo add stable https://kubernetes-charts.storage.googleapis.com
@helm repo update
.PHONY: repo

test: deps vet repo ## Run unit tests
Expand Down
13 changes: 9 additions & 4 deletions internal/app/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ func releaseWithHooks(cmd orderedCommand, wg *sync.WaitGroup, sem chan struct{},
wg.Done()
<-sem
}()
if cmd.targetRelease == nil && !flags.destroy {
err := fmt.Errorf("nil target release")
errors <- err
log.Verbose(err.Error())
return
}
for _, c := range cmd.beforeCommands {
if err := execOne(c, cmd.targetRelease); err != nil {
errors <- err
Expand All @@ -145,16 +151,15 @@ func releaseWithHooks(cmd orderedCommand, wg *sync.WaitGroup, sem chan struct{},
log.Verbose(err.Error())
return
}
if cmd.targetRelease != nil && !flags.dryRun && !flags.destroy {
cmd.targetRelease.label()
}
for _, c := range cmd.afterCommands {
if err := execOne(c, cmd.targetRelease); err != nil {
errors <- err
log.Verbose(err.Error())
return
}
}
if !flags.dryRun && !flags.destroy {
cmd.targetRelease.label()
}
}

// execOne executes a single ordered command
Expand Down

0 comments on commit 43d2ca7

Please sign in to comment.