Skip to content

Commit

Permalink
[Cherry-pick for v1.13.6] (#151)
Browse files Browse the repository at this point in the history
* rm(vendor): removing the vendor directory from litmus-go (#147)

Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>

* chore(env): updated the env getter function & default jobCleanUpPolicy as retain (#144)

* chore(env): improved the env getter function

Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>

* marked default jobCleanupPolicy to retain

Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>

* chore(chaosresult): updating verdict and status in chaosengine and chaosresult (#148)

Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>

* chore(vendors): updating the target details vendors (#149)

Signed-off-by: shubhamchaudhary <shubham@chaosnative.com>

* Fix: Print error for some error events (#150)

Signed-off-by: udit <udit@chaosnative.com>

Co-authored-by: Shubham Chaudhary <shubham.chaudhary@mayadata.io>
Co-authored-by: Udit Gaurav <35391335+uditgaurav@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 15, 2021
1 parent 72ef14c commit 2baa49e
Show file tree
Hide file tree
Showing 2,371 changed files with 341 additions and 944,583 deletions.
33 changes: 6 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,25 @@ IMG_NAME ?= chaos-runner
PACKAGE_VERSION ?= ci
IS_DOCKER_INSTALLED = $(shell which docker >> /dev/null 2>&1; echo $$?)
HOME = $(shell echo $$HOME)
# list only our namespaced directories
PACKAGES = $(shell go list ./... | grep -v '/vendor/')

.PHONY: all
all: godeps format lint build dockerops test

.PHONY: help
help:
@echo ""
@echo "Usage:-"
@echo "\tmake all -- [default] builds the chaos runner container"
@echo "\tmake godeps -- sets up dependencies for image build"
@echo "\tmake build -- builds the chaos runner binary"
@echo "\tmake dockerops -- builds & pushes the chaos runner image"
@echo ""

.PHONY: all
all: godeps build dockerops test

.PHONY: godeps
godeps:
@echo ""
@echo "INFO:\tverifying dependencies for chaos runner build ..."
@go get -u -v golang.org/x/lint/golint
@go get -u -v golang.org/x/tools/cmd/goimports
#@go get -u -v github.com/golang/dep/cmd/dep

_build_check_docker:
@if [ $(IS_DOCKER_INSTALLED) -eq 1 ]; \
Expand All @@ -38,33 +37,13 @@ _build_check_docker:
.PHONY: deps
deps: _build_check_docker godeps

.PHONY: format
format:
@echo "------------------"
@echo "--> Running go fmt"
@echo "------------------"
@go fmt $(PACKAGES)

.PHONY: lint
lint:
@echo "------------------"
@echo "--> Running golint"
@echo "------------------"
@golint $(PACKAGES)
@echo "------------------"
@echo "--> Running go vet"
@echo "------------------"
@go vet $(PACKAGES)

.PHONY: build
build:
@echo "-----------------------------------"
@echo "--> Building Chaos-runner binary..."
@echo "-----------------------------------"
@./build/go-multiarch-build.sh ./bin

.PHONY: gotasks
gotasks: format lint build

.PHONY: test
test:
Expand Down
7 changes: 6 additions & 1 deletion bin/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ func main() {
if err := experiment.SetValueFromChaosResources(&engineDetails, clients); err != nil {
log.Errorf("unable to set values from Chaos Resources, error: %v", err)
experiment.ExperimentSkipped(utils.ExperimentNotFoundErrorReason, engineDetails, clients)
engineDetails.ExperimentSkippedPatchEngine(&experiment, clients)
continue
}
// derive the envs from the chaos experiment and override their values from chaosengine if any
if err := experiment.SetENV(engineDetails, clients); err != nil {
log.Errorf("unable to patch ENV, error: %v", err)
experiment.ExperimentSkipped(utils.ExperimentEnvParseErrorReason, engineDetails, clients)
engineDetails.ExperimentSkippedPatchEngine(&experiment, clients)
continue
}

Expand All @@ -78,6 +80,7 @@ func main() {
if err := experiment.PatchResources(engineDetails, clients); err != nil {
log.Errorf("unable to patch Chaos Resources required for Chaos Experiment: %v, error: %v", experiment.Name, err)
experiment.ExperimentSkipped(utils.ExperimentDependencyCheckReason, engineDetails, clients)
engineDetails.ExperimentSkippedPatchEngine(&experiment, clients)
continue
}
// generating experiment dependency check event inside chaosengine
Expand All @@ -87,6 +90,7 @@ func main() {
if err := utils.BuildingAndLaunchJob(&experiment, clients); err != nil {
log.Errorf("unable to construct chaos experiment job, error: %v", err)
experiment.ExperimentSkipped(utils.ExperimentDependencyCheckReason, engineDetails, clients)
engineDetails.ExperimentSkippedPatchEngine(&experiment, clients)
continue
}

Expand All @@ -97,6 +101,7 @@ func main() {
if err := engineDetails.WatchChaosContainerForCompletion(&experiment, clients); err != nil {
log.Errorf("unable to Watch the chaos container, error: %v", err)
experiment.ExperimentSkipped(utils.ExperimentChaosContainerWatchErrorReason, engineDetails, clients)
engineDetails.ExperimentSkippedPatchEngine(&experiment, clients)
continue
}

Expand All @@ -109,7 +114,7 @@ func main() {

log.Infof("Chaos Engine has been updated with result, Experiment Name: %v", experiment.Name)

// Delete / retain the Job, using the jobCleanUpPolicy
// Delete/Retain the Job, based on the jobCleanUpPolicy
jobCleanUpPolicy, err := engineDetails.DeleteJobAccordingToJobCleanUpPolicy(&experiment, clients)
if err != nil {
log.Errorf("unable to Delete ChaosExperiment Job, error: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ go 1.13

require (
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
github.com/litmuschaos/chaos-operator v0.0.0-20210427130225-719c08eb082a
github.com/litmuschaos/chaos-operator v0.0.0-20210610071657-a58dbd939e73
github.com/litmuschaos/elves v0.0.0-20210325101625-5620f93aed51
github.com/litmuschaos/litmus-go v0.0.0-20201015093552-b88e93ffc452
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.9.0
github.com/openebs/maya v1.12.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.6.0
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
k8s.io/api v0.17.3
k8s.io/apimachinery v0.17.3
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog v1.0.0
)

// Pinned to kubernetes-1.16.2
Expand Down
Loading

0 comments on commit 2baa49e

Please sign in to comment.