Skip to content

Commit

Permalink
Merge pull request #557 from eclipse-tractusx/quality_dashboard/enabl…
Browse files Browse the repository at this point in the history
…e_checks

Quality dashboard enhancement with additional automated checks
  • Loading branch information
tomaszbarwicki authored Apr 18, 2024
2 parents 997431f + cb707d3 commit 602c6f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
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

0 comments on commit 602c6f2

Please sign in to comment.