diff --git a/Makefile b/Makefile index 3f1c3dec..58e23745 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ manifests-create: controller-gen ## Generate WebhookConfiguration, ClusterRole a $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases manifests-clean: yq - @for file in testworkflows.testkube.io_testworkflows.yaml testworkflows.testkube.io_testworkflowtemplates.yaml; do \ + @for file in testworkflows.testkube.io_testworkflows.yaml testworkflows.testkube.io_testworkflowtemplates.yaml testworkflows.testkube.io_testworkflowexecutions.yaml; do \ for key in securityContext volumes dnsPolicy affinity tolerations hostAliases dnsConfig topologySpreadConstraints schedulingGates resourceClaims volumeMounts fieldRef resourceFieldRef configMapKeyRef secretKeyRef; do \ yq --no-colors -i "del(.. | select(has(\"$$key\")).$$key | .. | select(has(\"description\")).description)" "config/crd/bases/$$file"; \ done; \ diff --git a/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml b/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml index 1d8661a3..af0075e7 100644 --- a/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml +++ b/config/crd/bases/testworkflows.testkube.io_testworkflowexecutions.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.15.0 name: testworkflowexecutions.testworkflows.testkube.io spec: group: testworkflows.testkube.io @@ -15,252 +14,168 @@ spec: singular: testworkflowexecution scope: Namespaced versions: - - name: v1 - schema: - openAPIV3Schema: - description: TestWorkflowExecution is the Schema for the workflows API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: TestWorkflowExecution specification - properties: - executionRequest: - description: TestWorkflowExecutionRequest contains TestWorkflow execution - parameters - properties: - config: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - name: - description: custom execution name - type: string - testWorkflowExecutionName: - description: test workflow execution name started the test workflow - execution - type: string - type: object - testWorkflow: - description: |- - LocalObjectReference contains enough information to let you locate the - referenced object inside the same namespace. - properties: - name: - description: |- - Name of the referent. - More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid? - type: string - type: object - x-kubernetes-map-type: atomic - required: - - testWorkflow - type: object - status: - description: TestWorkflowExecutionStatus specification - properties: - generation: - description: test workflow execution generation - format: int64 - type: integer - latestExecution: - description: |- - INSERT ADDITIONAL STATUS FIELD - define observed state of cluster - Important: Run "make" to regenerate code after modifying this file - properties: - id: - description: unique execution identifier - type: string - name: - description: execution name - type: string - namespace: - description: execution namespace - type: string - number: - description: sequence number for the execution - format: int32 - type: integer - output: - description: additional information from the steps, like referenced - executed tests or artifacts - items: - description: TestWorkflowOutput defines output of TestWorkflow - properties: - name: - description: output kind name - type: string - ref: - description: step reference - type: string - value: - description: value returned - type: object - x-kubernetes-preserve-unknown-fields: true - type: object - type: array - reports: - description: generated reports from the steps, like junit - items: - description: TestWorkflowStepReport contains report of TestWorkflow - properties: - file: - description: file path to full report in artifact storage - type: string - kind: - description: report kind/type - type: string - ref: - description: step reference - type: string - summary: - description: TestWorkflowStepReportSummary contains report - summary of TestWorkflow - properties: - duration: - description: total duration of all test cases in milliseconds - format: int64 - type: integer - errored: - description: number of error test cases - format: int32 - type: integer - failed: - description: number of failed test cases - format: int32 - type: integer - passed: - description: number of passed test cases - format: int32 - type: integer - skipped: - description: number of skipped test cases - format: int32 - type: integer - tests: - description: total number of test cases - format: int32 - type: integer - type: object + - name: v1 + schema: + openAPIV3Schema: + description: TestWorkflowExecution is the Schema for the workflows API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: TestWorkflowExecution specification + properties: + executionRequest: + description: TestWorkflowExecutionRequest contains TestWorkflow execution parameters + properties: + config: + additionalProperties: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true type: object - type: array - resolvedWorkflow: - x-kubernetes-preserve-unknown-fields: true - result: - description: TestWorkflowResult contains result of TestWorkflow - properties: - duration: - description: Go-formatted (human-readable) duration - type: string - durationMs: - description: Duration in milliseconds - format: int32 - type: integer - finishedAt: - description: when the pod has been completed - format: date-time - type: string - initialization: - description: TestWorkflowStepResult contains step result of - TestWorkflow + name: + description: custom execution name + type: string + testWorkflowExecutionName: + description: test workflow execution name started the test workflow execution + type: string + type: object + testWorkflow: + description: |- + LocalObjectReference contains enough information to let you locate the + referenced object inside the same namespace. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic + required: + - testWorkflow + type: object + status: + description: TestWorkflowExecutionStatus specification + properties: + generation: + description: test workflow execution generation + format: int64 + type: integer + latestExecution: + description: |- + INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + Important: Run "make" to regenerate code after modifying this file + properties: + id: + description: unique execution identifier + type: string + name: + description: execution name + type: string + namespace: + description: execution namespace + type: string + number: + description: sequence number for the execution + format: int32 + type: integer + output: + description: additional information from the steps, like referenced executed tests or artifacts + items: + description: TestWorkflowOutput defines output of TestWorkflow properties: - errorMessage: + name: + description: output kind name type: string - exitCode: - format: int64 - type: integer - finishedAt: - description: when the container was finished - format: date-time + ref: + description: step reference type: string - queuedAt: - description: when the container was created - format: date-time + value: + description: value returned + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + type: array + reports: + description: generated reports from the steps, like junit + items: + description: TestWorkflowStepReport contains report of TestWorkflow + properties: + file: + description: file path to full report in artifact storage type: string - startedAt: - description: when the container was started - format: date-time + kind: + description: report kind/type type: string - status: - description: TestWorkfloStepwStatus has step status of - TestWorkflow + ref: + description: step reference type: string + summary: + description: TestWorkflowStepReportSummary contains report summary of TestWorkflow + properties: + duration: + description: total duration of all test cases in milliseconds + format: int64 + type: integer + errored: + description: number of error test cases + format: int32 + type: integer + failed: + description: number of failed test cases + format: int32 + type: integer + passed: + description: number of passed test cases + format: int32 + type: integer + skipped: + description: number of skipped test cases + format: int32 + type: integer + tests: + description: total number of test cases + format: int32 + type: integer + type: object type: object - pausedMs: - description: Pause duration in milliseconds - format: int32 - type: integer - pauses: - items: - description: TestWorkflowPause defines pause of TestWorkflow - properties: - pausedAt: - description: when the pause has started - format: date-time - type: string - ref: - description: step at which it was paused - type: string - resumedAt: - description: when the pause has ended - format: date-time - type: string - required: - - pausedAt - - ref - type: object - type: array - predictedStatus: - description: TestWorkflowStatus has status of TestWorkflow - enum: - - queued - - running - - paused - - passed - - failed - - aborted - type: string - queuedAt: - description: when the pod was created - format: date-time - type: string - startedAt: - description: when the pod has been successfully assigned - format: date-time - type: string - status: - description: TestWorkflowStatus has status of TestWorkflow - enum: - - queued - - running - - paused - - passed - - failed - - aborted - type: string - steps: - additionalProperties: - description: TestWorkflowStepResult contains step result - of TestWorkflow + type: array + resolvedWorkflow: + x-kubernetes-preserve-unknown-fields: true + result: + description: TestWorkflowResult contains result of TestWorkflow + properties: + duration: + description: Go-formatted (human-readable) duration + type: string + durationMs: + description: Duration in milliseconds + format: int32 + type: integer + finishedAt: + description: when the pod has been completed + format: date-time + type: string + initialization: + description: TestWorkflowStepResult contains step result of TestWorkflow properties: errorMessage: type: string @@ -280,72 +195,145 @@ spec: format: date-time type: string status: - description: TestWorkfloStepwStatus has step status - of TestWorkflow + description: TestWorkfloStepwStatus has step status of TestWorkflow type: string type: object - type: object - totalDuration: - description: Go-formatted (human-readable) total duration - (incl. pause) - type: string - totalDurationMs: - description: Total duration in milliseconds (incl. pause) - format: int32 - type: integer - required: - - predictedStatus - - status - type: object - scheduledAt: - description: when the execution has been scheduled to run - format: date-time - type: string - signature: - description: structured tree of steps - items: - description: TestWorkflowSignature has signature of TestWorkflow - properties: - category: - description: step category, that may be used as name fallback + pausedMs: + description: Pause duration in milliseconds + format: int32 + type: integer + pauses: + items: + description: TestWorkflowPause defines pause of TestWorkflow + properties: + pausedAt: + description: when the pause has started + format: date-time + type: string + ref: + description: step at which it was paused + type: string + resumedAt: + description: when the pause has ended + format: date-time + type: string + required: + - pausedAt + - ref + type: object + type: array + predictedStatus: + description: TestWorkflowStatus has status of TestWorkflow + enum: + - queued + - running + - paused + - passed + - failed + - aborted + type: string + queuedAt: + description: when the pod was created + format: date-time type: string - children: - x-kubernetes-preserve-unknown-fields: true - name: - description: step name + startedAt: + description: when the pod has been successfully assigned + format: date-time type: string - negative: - description: is the step/group meant to be negative - type: boolean - optional: - description: is the step/group meant to be optional - type: boolean - ref: - description: step reference + status: + description: TestWorkflowStatus has status of TestWorkflow + enum: + - queued + - running + - paused + - passed + - failed + - aborted + type: string + steps: + additionalProperties: + description: TestWorkflowStepResult contains step result of TestWorkflow + properties: + errorMessage: + type: string + exitCode: + format: int64 + type: integer + finishedAt: + description: when the container was finished + format: date-time + type: string + queuedAt: + description: when the container was created + format: date-time + type: string + startedAt: + description: when the container was started + format: date-time + type: string + status: + description: TestWorkfloStepwStatus has step status of TestWorkflow + type: string + type: object + type: object + totalDuration: + description: Go-formatted (human-readable) total duration (incl. pause) type: string + totalDurationMs: + description: Total duration in milliseconds (incl. pause) + format: int32 + type: integer + required: + - predictedStatus + - status type: object - type: array - statusAt: - description: when the execution result's status has changed last - time (queued, passed, failed) - format: date-time - type: string - testWorkflowExecutionName: - description: test workflow execution name started the test workflow - execution - type: string - workflow: - x-kubernetes-preserve-unknown-fields: true - required: - - id - - name - - workflow - type: object - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} + scheduledAt: + description: when the execution has been scheduled to run + format: date-time + type: string + signature: + description: structured tree of steps + items: + description: TestWorkflowSignature has signature of TestWorkflow + properties: + category: + description: step category, that may be used as name fallback + type: string + children: + x-kubernetes-preserve-unknown-fields: true + name: + description: step name + type: string + negative: + description: is the step/group meant to be negative + type: boolean + optional: + description: is the step/group meant to be optional + type: boolean + ref: + description: step reference + type: string + type: object + type: array + statusAt: + description: when the execution result's status has changed last time (queued, passed, failed) + format: date-time + type: string + testWorkflowExecutionName: + description: test workflow execution name started the test workflow execution + type: string + workflow: + x-kubernetes-preserve-unknown-fields: true + required: + - id + - name + - workflow + type: object + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/internal/controller/testworkflowexecution/testworkflowexecution_controllller.go b/internal/controller/testworkflowexecution/testworkflowexecution_controller.go similarity index 100% rename from internal/controller/testworkflowexecution/testworkflowexecution_controllller.go rename to internal/controller/testworkflowexecution/testworkflowexecution_controller.go