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

Quality dashboard enhancement with additional automated checks #557

Merged
merged 4 commits into from
Apr 18, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package container
import (
"fmt"
"regexp"
"strings"
"tractusx-release-automation/internal/tractusx"
)

Expand Down Expand Up @@ -55,7 +56,7 @@ func (n NonRootContainer) BaseDir() string {

func (n NonRootContainer) Test() *tractusx.QualityResult {
checkPassed := true
var errorDescription string
errorDescription := ""
dockerfiles := findDockerfilesAt(n.baseDir)

for _, dockerfilePath := range dockerfiles {
Expand All @@ -66,10 +67,12 @@ func (n NonRootContainer) Test() *tractusx.QualityResult {

if !validateUser(file.user()) {
checkPassed = false
if len(errorDescription) > 0 {
errorDescription = errorDescription + "\nInvalid user specified in Dockerfile: " + dockerfilePath
} else {
errorDescription = "Invalid user specified in Dockerfile: " + dockerfilePath
if n.baseDir != "./" {
dockerfilePath = strings.Split(dockerfilePath, n.baseDir)[1]
}
errorDescription += "\nInvalid user specified in Dockerfile: " + dockerfilePath[1:]
if tractusx.CliErrOutputFormat == tractusx.WebErrOutputFormat {
errorDescription += "<br>"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions release-automation/internal/dashboard/tractusx.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ func initializeChecksForDirectory(dir string) []tractusx.QualityGuideline {
checks = append(checks, docs.NewReadmeExists(dir))
checks = append(checks, docs.NewInstallExists(dir))
checks = append(checks, docs.NewChangelogExists(dir))
checks = append(checks, repo.NewDefaultBranch(dir))
checks = append(checks, repo.NewRepoStructureExists(dir))
checks = append(checks, repo.NewLeadingRepositoryDefined(dir))
checks = append(checks, container.NewAllowedBaseImage(dir))
checks = append(checks, container.NewNonRootContainer(dir))
checks = append(checks, helm.NewHelmStructureExists(dir))
checks = append(checks, helm.NewResourceMgmt(dir))
checks = append(checks, helm.NewHelmWorkflowCheck(dir))
return checks
}
Expand Down
Loading