feat: run UCC in an isolated environment#23
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for a UCC_VERSION file that allows users to specify a particular version of the splunk-add-on-ucc-framework to install and use, rather than relying on the default ucc-gen executable. When the UCC_VERSION file is present, the action installs pip-run and uses it to run the specified version of the UCC framework.
- Adds conditional logic to check for UCC_VERSION file existence
- Dynamically sets the UCC executable based on whether a version file is present
- Replaces hardcoded ucc-gen command with a variable UCC_EXECUTABLE
Comments suppressed due to low confidence (1)
action.yml:63
- The if statement is missing a closing bracket. It should be
if [ -f "UCC_VERSION" ]followed bythenon the same line or add a semicolon:if [ -f "UCC_VERSION" ]; then
if [ -f "UCC_VERSION" ]
| run: pip install -r requirements_dev.txt | ||
| - shell: bash | ||
| run: | | ||
| if [ -f "requirements_ucc.txt" ] |
There was a problem hiding this comment.
You are missing closing brackets for the if statement
| if [ -f "requirements_ucc.txt" ] | |
| if [ -f "requirements_ucc.txt" ] ; |
| ./.ucc_venv/bin/python -m pip install -r requirements_ucc.txt | ||
|
|
||
| # if file does not exist, show an error | ||
| if [ ! -f "./.ucc_venv/bin/ucc-gen" ] |
There was a problem hiding this comment.
| if [ ! -f "./.ucc_venv/bin/ucc-gen" ] | |
| if [ ! -f "./.ucc_venv/bin/ucc-gen" ] ; |
| echo running ucc-gen $ARG_VERSION | ||
| ucc-gen $ARG_VERSION | ||
|
|
||
| if [ -f "./.ucc_venv/bin/ucc-gen" ] |
There was a problem hiding this comment.
| if [ -f "./.ucc_venv/bin/ucc-gen" ] | |
| if [ -f "./.ucc_venv/bin/ucc-gen" ] ; |
| echo "ucc-gen not found, please check your requirements_ucc.txt file" | ||
| exit 1 | ||
| fi | ||
| fi |
There was a problem hiding this comment.
WDYT about adding here an else condition with warning message to migrate ucc dependency to a separate file?
|
@kkedziak-splunk I like the idea. I'd suggest we define a policy that says all TA repositories should use the ucc dependency consistently. During a transition period, the action could support both |
|
@mbruzda-splunk, I think this solution would require some adjustments in template repository (i.e. ucc version would need to be parsed from requirements_ucc.txt. Also there might be some changes needed in local tests execution manuals). |
Document with more info
This PR allows to separate UCC from TA dependencies, in order to avoid dependency conflicts.
UCC version may be specified in
requirements_ucc.txtfile. Then, the action will install UCC in an isolated environment.