18F / fedramp-automation

FedRAMP Automation
https://federalist-2372d2fd-fc94-42fe-bcc7-a8af4f664a51.app.cloud.gov/site/18f/fedramp-automation/
Other
16 stars 6 forks source link

Remove Python build dependency #417

Open danielnaab opened 2 years ago

danielnaab commented 2 years ago

Extended Description In order to simplify build environments on Windows, it would be helpful to not require Python installation. Consider replacing a validations test - src/validations/bin/assert-svrl.py - with a bash script.

This is low priority.

Acceptance Criteria

Story Tasks

Definition of Done

wesley-dean-gsa commented 2 years ago

When attempting to run make test on a Linux system with python 3.8 installed, I received a build error:

+ '/var/lib/jenkins/workspace/Source Code Tests/ASAP/src/validations/bin/assert-svrl.py' src/validations/report/test/sch.svrl.xml
  File "/var/lib/jenkins/workspace/Source Code Tests/ASAP/src/validations/bin/assert-svrl.py", line 18
    """)
      ^
SyntaxError: invalid syntax

The aforementioned system has 3.8 and 3.9 installed; however, the system-level default is 3.8. When running on a system with 3.9 as the default, make test works great. No problems.

My plan was to request to update evaluate-compiled-schematron.sh to accept as a parameter the Python binary (e.g., if "${BASE_DIR}/src/validations .... => if "${PYTHON_BIN:-python} ${BASE_DIR}/src/validations ...)

However, if the plan is to refactor this as a shell script, then none of this matters...

wesley-dean-gsa commented 2 years ago

I added a step in my Jenkins configuration to "fix" the script (i.e., tell it to use Python 3.9) before it runs make test:

sed -i~ -Ee 's|if[[:space:]]*"[[:space:]]*(\$\{BASE_DIR\}/src/validations/bin/assert-svrl\.py")|if python3.9 "\1|' src/validations/bin/evaluate-compiled-schematron.sh

This allows make test to complete successfully.