-
Notifications
You must be signed in to change notification settings - Fork 28
feat: multi build tool detection #179
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
Conversation
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
if not build_tool or isinstance(build_tool, NoneBuildTool): | ||
logger.info("Unable to find a valid build tool.") | ||
build_tools = main_ctx.dynamic_data["build_spec"]["tools"] | ||
if len(build_tools) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just use if build_tools
in Python to check if a list is empty or not, no need to check the length.
break | ||
|
||
if not analyze_ctx.dynamic_data["build_spec"].get("tool"): | ||
if len(analyze_ctx.dynamic_data["build_spec"].get("tools")) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about checking lists.
# Get the build tool identified by the mcn_version_control_system_1, which we depend on. | ||
build_tools = ctx.dynamic_data["build_spec"].get("tools") | ||
|
||
if len(build_tools) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about lists.
return CheckResultType.FAILED | ||
ci_services = ctx.dynamic_data["ci_services"] | ||
|
||
# Check for each build tool if its built as code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Check for each build tool if its built as code | |
Check if "build as code" holds for each build tool. |
def run_check(self, ctx: AnalyzeContext, check_result: CheckResult) -> CheckResultType: | ||
"""Implement the check in this method. | ||
|
||
def _tool_check( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _tool_check( | |
def _check_build_tool( |
check_result: CheckResult | ||
) -> CheckResultType | None: | ||
""" | ||
Run the check for a single build tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add why we need to do that?
ctx.commit_sha, | ||
ci_service.api_client.get_relative_path_of_workflow(os.path.basename(bash_cmd["CI_path"])), | ||
|
||
def _build_tool_check( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def _build_tool_check( | |
def _check_build_tool( |
ctx: AnalyzeContext, | ||
check_result: CheckResult, | ||
ci_services: list[CIInfo] | ||
) -> CheckResultType | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docstring.
4244d5e
to
2d1c840
Compare
0719624
to
fe20e75
Compare
res = self._check_build_tool(tool, ctx, ci_services, check_result) | ||
|
||
# Divide up build tool outputs | ||
check_result["justification"].append("\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to add a "\n" character to divide up the outputs. The content of each element of check_result["justification"]
is not used for rendering the reports. So if you add "\n" here, the string "\n"
will appear instead of a new line.
Furthermore, in the HTML reports each element in check_result["justification"]
is rendered as a separated bullet point in the justification column.
fe20e75
to
8003e8e
Compare
fc50afb
to
d87d970
Compare
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
53073e1
to
c21963e
Compare
src/macaron/resources/.gitignore
Outdated
@@ -3,7 +3,7 @@ | |||
|
|||
# Ignore Gradle project-specific cache directory | |||
.gradle | |||
gradle-* | |||
.gradle-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.gradle-* | |
gradle-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These updates can be reverted as they don't change the expected results anymore.
Same comment for micronaut-core.json
and sl4j.sjon
.
c21963e
to
d643898
Compare
d643898
to
e3f72af
Compare
Signed-off-by: Tim Yarkov <timdyarkov@gmail.com>
e3f72af
to
875164b
Compare
Signed-off-by: Tim Yarkov <timdyarkov@gmail.com>
Basic multiple build tool detection (essentially converting the tool part of BuildSpec to a list)
TODO before final PR: