Skip to content

Commit

Permalink
Merge branch 'main' into vsukhin/feature/run-workflow-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
vsukhin committed Nov 18, 2024
2 parents 6d2e076 + 481c968 commit 4cad37a
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 73 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/docker-build-api-executors-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up Docker Buildx
id: buildx
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up Docker Buildx
id: buildx
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -249,7 +249,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -317,7 +317,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -442,7 +442,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -510,7 +510,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -669,7 +669,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -741,7 +741,7 @@ jobs:
uses: docker/setup-qemu-action@v3

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up Docker Buildx
id: buildx
Expand Down Expand Up @@ -790,7 +790,7 @@ jobs:
uses: actions/checkout@v4

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -863,7 +863,7 @@ jobs:
fetch-depth: 0

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ jobs:
with:
fetch-depth: 0
- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7
- name: Download Artifacts for Linux
uses: actions/download-artifact@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ jobs:
with:
fetch-depth: 0
- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected].6
- uses: anchore/sbom-action/[email protected].7
- name: Download Artifacts for Linux
uses: actions/download-artifact@master
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Send coverage report to Codecov
if: always()
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: ./coverage.out
flags: unittests
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:

- name: Send coverage report to Codecov
if: always()
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: ./coverage.out
flags: integrationtests
Expand Down
33 changes: 26 additions & 7 deletions cmd/kubectl-testkube/commands/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package common
import (
"fmt"
"os"
"strings"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -52,13 +53,14 @@ const (
const helpUrl = "https://testkubeworkspace.slack.com"

type CLIError struct {
Code ErrorCode
Title string
Description string
ActualError error
StackTrace string
MoreInfo string
Telemetry *ErrorTelemetry
Code ErrorCode
Title string
Description string
ActualError error
StackTrace string
MoreInfo string
ExecutedCommand string
Telemetry *ErrorTelemetry
}

type ErrorTelemetry struct {
Expand Down Expand Up @@ -86,6 +88,15 @@ func (e *CLIError) Print() {

pterm.DefaultSection.Println("Error Details")

cmd := ""
if e.ExecutedCommand != "" {
pterm.FgDarkGray.Printfln("Executed command: %s", e.ExecutedCommand)
params := strings.Split(e.ExecutedCommand, " ")
if len(params) > 0 {
cmd = params[0]
}
}

items := []pterm.BulletListItem{
{Level: 0, Text: pterm.Sprintf("[%s]: %s", e.Code, e.Title), TextStyle: pterm.NewStyle(pterm.FgRed)},
{Level: 0, Text: pterm.Sprintf("%s", e.Description), TextStyle: pterm.NewStyle(pterm.FgLightWhite)},
Expand All @@ -94,6 +105,9 @@ func (e *CLIError) Print() {
items = append(items, pterm.BulletListItem{Level: 0, Text: pterm.Sprintf("%s", e.MoreInfo), TextStyle: pterm.NewStyle(pterm.FgGray)})
}
pterm.DefaultBulletList.WithItems(items).Render()
if cmd != "" {
pterm.DefaultBox.Printfln("Error description is provided in context of binary execution %s", cmd)
}

pterm.Println()
pterm.Println("Let us help you!")
Expand All @@ -111,6 +125,11 @@ func NewCLIError(code ErrorCode, title, moreInfoURL string, err error) *CLIError
}
}

func (err *CLIError) WithExecutedCommand(executedCommand string) *CLIError {
err.ExecutedCommand = executedCommand
return err
}

// HandleCLIError checks does the error exist, and if it does, prints the error and exits the program.
func HandleCLIError(err *CLIError) {
if err != nil {
Expand Down
Loading

0 comments on commit 4cad37a

Please sign in to comment.