Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gitignore file to skip system files #395

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -594,11 +594,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