Skip to content

Conversation

@aibaars
Copy link
Contributor

@aibaars aibaars commented Apr 14, 2023

Previously, environment variables like:

env:
    LD_PRELOAD: /__w/_tool/CodeQL/2.12.6-20230403/x64/codeql/tools/linux64/${LIB}_${PLATFORM}_trace.so    

would wrongly get expanded by the shell when running a job via the k8s scripts. This may lead to errors like:

ERROR: ld.so: object '/__w/_tool/CodeQL/2.12.6-20230403/x64/codeql/tools/linux64/__trace.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

See a complete log for context: https://github.com/matihost/monorepo/actions/runs/4638170156/jobs/8207744339

This pull request:

  • throws an error when a $ is used in the name of an environment variable
  • escapes any $ symbols in the value of an environment variable

This behaviour is the same as other special shell characters such as ' and ".

@aibaars aibaars force-pushed the k8s-env branch 2 times, most recently from 9c16145 to 7016bf8 Compare April 14, 2023 10:31
@aibaars aibaars force-pushed the k8s-env branch 2 times, most recently from afc3810 to 0ad0f12 Compare April 14, 2023 14:20
@aibaars aibaars changed the title Add test cases Handle $ symbols in environment variable names and values Apr 14, 2023
@aibaars aibaars changed the title Handle $ symbols in environment variable names and values k8s: handle $ symbols in environment variable names and values Apr 14, 2023
@aibaars aibaars marked this pull request as ready for review April 14, 2023 14:32
@aibaars aibaars requested review from a team as code owners April 14, 2023 14:32
Copy link
Collaborator

@nikola-jokic nikola-jokic left a comment

Choose a reason for hiding this comment

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

LGTM!

@nikola-jokic nikola-jokic merged commit c37c5ca into actions:main Apr 18, 2023
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.

2 participants