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

implement exportvariable filter #288

Merged
merged 2 commits into from
Dec 6, 2024
Merged

implement exportvariable filter #288

merged 2 commits into from
Dec 6, 2024

Conversation

smoors
Copy link
Contributor

@smoors smoors commented Nov 10, 2024

fixes #281

this implements the approach suggested by @boegel in the issue: if the filter is specified in a comment, file bot/export_vars.sh is created and sourced before running the bot/build.sh script

notes:

  • as is the case with other filters, spaces or colons cannot be used
  • variables have to be specified one by one, which was easier to implement and avoids having to specify another delimiter, which then also cannot be used
  • i used filter name exportvariable instead of the suggested build_env to avoid confusion with other uses of build_env in the code.

example usage:

bot: build arch:zen4 export:MYVAR1=myval1 export:MYVAR2=myval2

UPDATE 2024-11-23

  • added an allowlist of name-value pairs (allowed_exportvars) to app.cfg for increased security. each name-value pair specified in a PR comment must be listed in the allowlist in order to run a build job.
  • moved the export_vars.sh script to the cfg dir

@trz42
Copy link
Contributor

trz42 commented Dec 6, 2024

Works as expected. 👍

Thanks a lot @smoors and sorry for the delay in reviewing it.

Copy link
Contributor

@trz42 trz42 left a comment

Choose a reason for hiding this comment

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

lgtm

else
echo "could not find ${EXPORT_VARS_SCRIPT} script in '${PWD}', skipping" >&2
fi
echo "$EXPORT_VARS_SCRIPT finished"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe move this line into the branch that actually sources the script. If the script couldn't be found, it would first echo that it wasn't found and then that it is finished.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in #291

@trz42 trz42 merged commit b455135 into EESSI:develop Dec 6, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

export environment variables with a "bot: build" comment
2 participants