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

[DEVHAS-418]add dockerfile as an alternate name for Dockerfile #382

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

yangcao77
Copy link
Contributor

@yangcao77 yangcao77 commented Aug 21, 2023

What does this PR do?:

This PR adds dockerfile as an alternate name for Dockerfile

also added unit test for it, and update existing test repo for the controller tests.

Which issue(s)/story(ies) does this PR fixes:

https://issues.redhat.com/browse/DEVHAS-418

PR acceptance criteria:

  • Unit/Functional tests

  • Documentation

  • Client Impact

How to test changes / Special notes to the reviewer:

@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Patch coverage: 82.66% and project coverage change: -0.73% ⚠️

Comparison is base (1afd7ae) 84.61% compared to head (0294107) 83.89%.
Report is 84 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #382      +/-   ##
==========================================
- Coverage   84.61%   83.89%   -0.73%     
==========================================
  Files          27       31       +4     
  Lines        3530     4235     +705     
==========================================
+ Hits         2987     3553     +566     
- Misses        402      515     +113     
- Partials      141      167      +26     
Files Changed Coverage Δ
pkg/devfile/errors.go 100.00% <ø> (ø)
controllers/component_controller_finalizer.go 69.23% <41.66%> (-5.77%) ⬇️
pkg/util/ioutils/ioutils.go 86.95% <50.00%> (-13.05%) ⬇️
controllers/component_controller.go 73.15% <60.56%> (-4.45%) ⬇️
cdq-analysis/pkg/devfile.go 68.30% <68.30%> (ø)
cdq-analysis/pkg/componentdetectionquery.go 69.28% <69.28%> (ø)
controllers/componentdetectionquery_controller.go 74.51% <71.42%> (+3.97%) ⬆️
pkg/github/token_mock.go 75.67% <75.67%> (-24.33%) ⬇️
controllers/application_controller.go 78.46% <76.81%> (-3.07%) ⬇️
cdq-analysis/pkg/detect.go 73.78% <83.92%> (ø)
... and 17 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -122,21 +122,22 @@ func search(log logr.Logger, a Alizer, localpath string, devfileRegistryURL stri
}
}
}
} else if f.Name() == DockerfileName {
// Check for Dockerfile
} else if f.Name() == DockerfileName || f.Name() == AlternateDockerfileName {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion: Rather than checking for alternate types of Dockerfile names, what if we convert the name to lower case and check against "dockerfile"?

Copy link
Contributor Author

@yangcao77 yangcao77 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then any other mix-case names are also allowed? i.e. DoCKerFiLE?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so? I don’t see the harm in allowing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we still need to check the exact allowed name, due to

for _, path := range validDockerfileLocations {
dockerfilePath := dir + "/" + path
dockerfileBytes, err = DownloadFile(dockerfilePath)
if err == nil {
// if we get a 200, return
return dockerfileBytes, path, err
}

When looking for the files using endpoint, we still need to check for supported names.

But in the cdq analysis here, when we have the repo downloaded on disk, I can convert to lower case and check against that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@openshift-ci
Copy link

openshift-ci bot commented Aug 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maysunfaisal, yangcao77

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [maysunfaisal,yangcao77]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yangcao77 yangcao77 merged commit d13e567 into redhat-appstudio:main Aug 22, 2023
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants