Skip to content

Commit

Permalink
Merge branch 'main' into pr-enhanced-security
Browse files Browse the repository at this point in the history
  • Loading branch information
llaszkie authored Dec 23, 2023
2 parents c5b85b2 + 1d97a47 commit 16d1a91
Show file tree
Hide file tree
Showing 21 changed files with 636 additions and 55 deletions.
7 changes: 6 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ body:
label: k6-operator version or image
validations:
required: true
- type: input
attributes:
label: Helm chart version (if applicable)
validations:
required: false
- type: textarea
attributes:
label: K6 YAML
label: TestRun / PrivateLoadZone YAML
validations:
required: true
- type: input
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Current Operator version
VERSION ?= 0.0.11
VERSION ?= 0.0.12
# Default bundle image tag
BUNDLE_IMG ?= k6-controller-bundle:$(VERSION)
# Options for 'bundle-build'
Expand Down
15 changes: 11 additions & 4 deletions api/v1alpha1/k6conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ func Initialize(k6 TestRunI) {
},
}

UpdateCondition(k6, CloudTestRunAborted, metav1.ConditionFalse)

// PLZ test run case
if len(k6.GetSpec().TestRunID) > 0 {
UpdateCondition(k6, CloudTestRun, metav1.ConditionTrue)
UpdateCondition(k6, CloudPLZTestRun, metav1.ConditionTrue)
UpdateCondition(k6, CloudTestRunCreated, metav1.ConditionTrue)
UpdateCondition(k6, CloudTestRunFinalized, metav1.ConditionFalse)
UpdateCondition(k6, CloudTestRunAborted, metav1.ConditionFalse)

k6.GetStatus().TestRunID = k6.GetSpec().TestRunID
} else {
Expand Down Expand Up @@ -151,17 +152,23 @@ func (k6status *TestRunStatus) SetIfNewer(proposedStatus TestRunStatus) (isNewer
isNewer = true
}
case "created":
if proposedStatus.Stage == "started" || proposedStatus.Stage == "finished" || proposedStatus.Stage == "error" {
if proposedStatus.Stage == "started" ||
proposedStatus.Stage == "finished" ||
proposedStatus.Stage == "error" ||
proposedStatus.Stage == "stopped" {
k6status.Stage = proposedStatus.Stage
isNewer = true
}
case "started":
if proposedStatus.Stage == "stopped" || proposedStatus.Stage == "finished" || proposedStatus.Stage == "error" {
if proposedStatus.Stage == "stopped" ||
proposedStatus.Stage == "finished" ||
proposedStatus.Stage == "error" {
k6status.Stage = proposedStatus.Stage
isNewer = true
}
case "stopped":
if proposedStatus.Stage == "finished" || proposedStatus.Stage == "error" {
if proposedStatus.Stage == "finished" ||
proposedStatus.Stage == "error" {
k6status.Stage = proposedStatus.Stage
isNewer = true
}
Expand Down
11 changes: 11 additions & 0 deletions api/v1alpha1/testruni.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,14 @@ type TestRunI interface {
GetSpec() *TestRunSpec
NamespacedName() types.NamespacedName
}

// TestRunID is a tiny helper to get k6 Cloud test run ID.
// PLZ test run will have test run ID as part of spec
// while cloud output test run as part of status.
func TestRunID(k6 TestRunI) string {
specId := k6.GetSpec().TestRunID
if len(specId) > 0 {
return specId
}
return k6.GetStatus().TestRunID
}
1 change: 0 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 16d1a91

Please sign in to comment.