Skip to content

Commit

Permalink
Update gitignore file to skip OS files
Browse files Browse the repository at this point in the history
Signed-off-by: Edmund Ochieng <[email protected]>
  • Loading branch information
OchiengEd authored and komish committed Aug 1, 2023
1 parent 8c331d0 commit 38653a5
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 6,971 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,33 @@
**/reports/
__pycache__
.vscode/
.DS_Store

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin
testbin/*
Dockerfile.cross

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~

# omit coverage files
coverage.out
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bin_win:

.PHONY: test
test:
go test -v ./...
go test -v -coverprofile=coverage.out ./...

# Build the container image. Usage: make build-image IMAGE_TAG=my_tag
# If IMAGE_TAG is not provided, use the COMMIT_ID
Expand Down
Binary file removed internal/chartverifier/checks/.DS_Store
Binary file not shown.
10 changes: 4 additions & 6 deletions internal/chartverifier/checks/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ func SignatureIsValid(opts *CheckOptions) (Result, error) {
resp, err := http.Get(provFile)
if err != nil {
return NewResult(false, fmt.Sprintf("%s : get error was %v", SignatureFailure, err)), nil
} else if resp.StatusCode == 404 {
}

if resp.StatusCode == 404 {
return NewSkippedResult(fmt.Sprintf("%s : %s", ChartNotSigned, SignatureIsNotPresentSuccess)), nil
} else if resp.StatusCode != 200 {
return NewResult(false, fmt.Sprintf("%s. get prov file response code was %d", SignatureFailure, resp.StatusCode)), nil
Expand Down Expand Up @@ -467,12 +469,8 @@ func getOCPRange(kubeVersionRange string) (string, error) {
}

func downloadFile(fileURL *url.URL, directory string) (string, error) {
urlPath := fileURL.Path
segments := strings.Split(urlPath, "/")
fileName := segments[len(segments)-1]

// Create blank file
filePath := path.Join(directory, fileName)
filePath := path.Join(directory, path.Base(fileURL.Path))
// #nosec G304
file, err := os.Create(filePath)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions internal/chartverifier/checks/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,13 @@ func TestSignatureIsValid(t *testing.T) {
},
}

config := viper.New()
var base64Key string
var encodeErr error

for _, tc := range testCases {
t.Run(tc.description, func(t *testing.T) {
config := viper.New()
base64Key := ""
var encodeErr error
base64Key = ""
if len(tc.keyFile) > 0 {
base64Key, encodeErr = tool.GetEncodedKey(tc.keyFile)
require.NoError(t, encodeErr)
Expand Down
Loading

0 comments on commit 38653a5

Please sign in to comment.