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

Adds detection logging messages at info level #344

Merged
merged 2 commits into from
May 18, 2023
Merged
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
6 changes: 4 additions & 2 deletions tomcat/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ type Detect struct {
}

func (d Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error) {
cr, err := libpak.NewConfigurationResolver(context.Buildpack, nil)
cr, err := libpak.NewConfigurationResolver(context.Buildpack, &d.Logger)
if err != nil {
return libcnb.DetectResult{}, fmt.Errorf("unable to create configuration resolver\n%w", err)
}

appServer, _ := cr.Resolve("BP_JAVA_APP_SERVER")
if appServer != "" && appServer != JavaAppServerTomcat {
d.Logger.Debugf("failed to match requested app server of [%s], buildpack supports [%s]", appServer, JavaAppServerTomcat)
d.Logger.Infof("SKIPPED: buildpack does not match requested app server of [%s], buildpack supports [%s]", appServer, JavaAppServerTomcat)
return libcnb.DetectResult{Pass: false}, nil
}

Expand All @@ -58,6 +58,7 @@ func (d Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error
}

if _, ok := m.Get("Main-Class"); ok {
d.Logger.Info("SKIPPED: Manifest attribute 'Main-Class' was found")
return libcnb.DetectResult{Pass: false}, nil
}

Expand All @@ -84,6 +85,7 @@ func (d Detect) Detect(context libcnb.DetectContext) (libcnb.DetectResult, error
if _, err := os.Stat(file); err != nil && !os.IsNotExist(err) {
return libcnb.DetectResult{}, fmt.Errorf("unable to stat file %s\n%w", file, err)
} else if os.IsNotExist(err) {
d.Logger.Info("PASSED: a WEB-INF directory was not found, this is normal when building from source")
return result, nil
}

Expand Down