Skip to content

Commit e17cd31

Browse files
authored
Merge pull request #82 from cin/81-exit-status
Changes to fix container exit status
2 parents 64ae7c5 + c205631 commit e17cd31

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

controllers/gatling_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga
445445
r.getGenerateLocalReport(gatling))
446446
log.Info("gatlingRunnerCommand:", "comand", gatlingRunnerCommand)
447447

448+
var noRestarts int32 = 0
449+
448450
envVars := gatling.Spec.TestScenarioSpec.Env
449451
if gatling.Spec.GenerateReport {
450452
gatlingTransferResultCommand := commands.GetGatlingTransferResultCommand(
@@ -461,6 +463,7 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga
461463
Labels: labels,
462464
},
463465
Spec: batchv1.JobSpec{
466+
BackoffLimit: &noRestarts,
464467
Parallelism: r.getGatlingRunnerJobParallelism(gatling),
465468
Completions: r.getGatlingRunnerJobParallelism(gatling),
466469
Template: corev1.PodTemplateSpec{
@@ -527,6 +530,7 @@ func (r *GatlingReconciler) newGatlingRunnerJobForCR(gatling *gatlingv1alpha1.Ga
527530
Labels: labels,
528531
},
529532
Spec: batchv1.JobSpec{
533+
BackoffLimit: &noRestarts,
530534
Parallelism: &gatling.Spec.TestScenarioSpec.Parallelism,
531535
Completions: &gatling.Spec.TestScenarioSpec.Parallelism,
532536
Template: corev1.PodTemplateSpec{

pkg/commands/commands.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ if [ ! -d ${RESULTS_DIR_PATH} ]; then
6868
fi
6969
gatling.sh -sf ${SIMULATIONS_DIR_PATH} -s %s -rsf ${RESOURCES_DIR_PATH} -rf ${RESULTS_DIR_PATH} %s
7070
71-
if [ $? -ne 0 ]; then
71+
GATLING_EXIT_STATUS=$?
72+
if [ $GATLING_EXIT_STATUS -ne 0 ]; then
7273
RUN_STATUS_FILE="${RESULTS_DIR_PATH}/FAILED"
7374
echo "gatling.sh has failed!" 1>&2
7475
fi
7576
touch ${RUN_STATUS_FILE}
77+
exit $GATLING_EXIT_STATUS
7678
`
7779
generateLocalReportOption := "-nr"
7880
if generateLocalReport {

0 commit comments

Comments
 (0)