Skip to content

Commit

Permalink
fix(release-automation): web errors format of non root container check
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszbarwicki committed Mar 6, 2024
1 parent ecf7b85 commit 2d26217
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package container
import (
"fmt"
"regexp"

"strings"
"tractusx-release-automation/internal/tractusx"
)

Expand Down Expand Up @@ -52,7 +52,7 @@ func (n NonRootContainer) ExternalDescription() string {

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

for _, dockerfilePath := range dockerfiles {
Expand All @@ -63,10 +63,9 @@ 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
errorDescription += "\nInvalid user specified in Dockerfile: " + strings.Split(dockerfilePath, n.baseDir)[1][1:]
if tractusx.CliErrOutputFormat == tractusx.WebErrOutputFormat {
errorDescription += "<br>"
}
}
}
Expand Down

0 comments on commit 2d26217

Please sign in to comment.