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

Integration of the OVAL object model into the combine_ovals.py script #11236

Merged

Conversation

Honny1
Copy link
Collaborator

@Honny1 Honny1 commented Nov 1, 2023

Description:

This PR integrates the use of the OVAL object model into the combine_ovals.py file. To do this, the build_ovals.py file is rebuilt and cleaned up, as many functions have been integrated into the object model.

Rationale:

This PR is part of the integration of the OVAL object model into the build system.

Review Hints:

To check the functionality of the changes, you can build content using ./build_product and run a test suite using the tox command.

Depends on: #11235

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Nov 1, 2023
Copy link

openshift-ci bot commented Nov 1, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@Honny1 Honny1 added enhancement General enhancements to the project. Infrastructure Our content build system OVAL OVAL update. Related to the systems assessments. labels Nov 1, 2023
Copy link

github-actions bot commented Nov 1, 2023

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@Honny1 Honny1 force-pushed the oval-object-model-in-build-ovals branch from 1ea3fb0 to 66e4e20 Compare November 1, 2023 09:44
@Honny1
Copy link
Collaborator Author

Honny1 commented Nov 1, 2023

/test all

@jan-cerny
Copy link
Collaborator

@Honny1 #11235 has been merged, you're unblocked, please rebase on the top of the latest master branch

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

It looks amazing, I like the way the model clicks into combine_ovals.py.


def _read_oval_file(self, file_path, context, from_benchmark):
if not file_path.endswith(".xml"):
logging.warning("File '{}' is't ends with '.xml'.".format(file_path))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
logging.warning("File '{}' is't ends with '.xml'.".format(file_path))
logging.warning("File name '{}' doesn't end with '.xml'.".format(file_path))

def _read_oval_file(self, file_path, context, from_benchmark):
if not file_path.endswith(".xml"):
logging.warning("File '{}' is't ends with '.xml'.".format(file_path))
return ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it return something different than an empty string? Raise an exception?



def parse_args():
p = argparse.ArgumentParser()
p.add_argument(
"--build-config-yaml", required=True, dest="build_config_yaml",
"--build-config-yaml",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Although the style updates surely make the code better, they also make the diff larger and therefore the PR becomes harder review. The reviewers when they see the diff they need to evaluate if the change is a code style change or actual behavior change. Next time, please don't do style updates unless necessary or requested by Code Climate. The best commits are small commits that do only necessary things.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I've moved these changes to at least a separate commit.


return p.parse_args()


def setup_logging(args):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it would be better to pass args.log instead of args.

@jan-cerny jan-cerny self-assigned this Nov 2, 2023
@jan-cerny jan-cerny added this to the 0.1.71 milestone Nov 2, 2023
@Honny1 Honny1 force-pushed the oval-object-model-in-build-ovals branch 3 times, most recently from 143c3fa to f5187ad Compare November 8, 2023 10:52
@Honny1 Honny1 marked this pull request as ready for review November 8, 2023 10:56
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Nov 8, 2023
@jan-cerny
Copy link
Collaborator

The CI fail on Fedora latest is now caused by upgrade of the underlying image to f39. The problem has been fixed by #11256. Please rebase on the top of the latest master branch to bring the changes in and unblock the job.

@Honny1 Honny1 force-pushed the oval-object-model-in-build-ovals branch from f5187ad to 9d369ba Compare November 8, 2023 13:45
@Honny1
Copy link
Collaborator Author

Honny1 commented Nov 8, 2023

@jan-cerny Rebased, let's see if CI passes.

Copy link

codeclimate bot commented Nov 8, 2023

Code Climate has analyzed commit 9d369ba and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 81.5% (50% is the threshold).

This pull request will bring the total coverage in the repository to 58.8%.

View more on Code Climate.

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

I have built RHEL9 content from this PR's branch and from the current upstream master branch and I have compared the built oval-unlinked.xml from both builds and I haven't noticed any major offenses, the differences were different order of attributes and explicit setting of some attributes to the default values. In terms of content validity and these changes in the built OVAL are fine and they shouldn't have impact on the meaning of the checks therefore I won't insist on making the artifacts identical.

The fail of the Ansible lint job is caused by upgrade of the job to Fedora 39 which brings a different rule set in the linter and therefore isn't caused by changes in this PR.

In general, I find this integration successful.

@jan-cerny jan-cerny merged commit aa40761 into ComplianceAsCode:master Nov 8, 2023
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement General enhancements to the project. Infrastructure Our content build system OVAL OVAL update. Related to the systems assessments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants