-
Notifications
You must be signed in to change notification settings - Fork 685
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
Reduce XML reformatting #11641
Reduce XML reformatting #11641
Conversation
These files are interim built artifects and aren't shipped or packaged, therefore they don't need to look nice.
If we have Python 3.9 or newer, we use the ElementTree.indent method which formats the output which means the output doesn't have to be reformatted.
Use the ET.indent() method if it's available (ie. on Python 3.9 and newer) for building OCIL documents.
If we have Python 3.9 or newer, we use the ElementTree.indent method which formats the output which means the output doesn't have to be reformatted.
Format output with 2 spaces and add XML header when building the ssg-$product-xccdf.xml.
If we have Python 3.9 or newer, we use the ElementTree.indent method which formats the output which means the output doesn't have to be reformatted.
Skipping CI for Draft Pull Request. |
🤖 A k8s content image for this PR is available at: Click here to see how to deploy itIf you alread have Compliance Operator deployed: Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and: |
Reduce code duplication by unifying the code of macros ssg_build_xccdf_final, ssg_build_oval_final and ssg_build_ocil_final into a single macro ssg_build_xml_final.
Code Climate has analyzed commit d8b86b7 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 20.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 59.8% (0.0% change). View more on Code Climate. |
Waving the coverage as this code is ran in the build steps. |
Description:
This PR removes xmllint reformat steps when they are not needed.
First, we don't need to reformat the XMLs of the internal steps that aren't shipped to the users, ie. oval-unlinked.xml and ocil-unlinked.xml. Second, if we use Python 3.9 or newer, the outputs are generated already formatted so we don't need to reformat them.
For more details, please read commit messages of all commits.
Rationale:
small speed up (1 - 2 seconds)