Skip to content

Commit

Permalink
runtime/docker: Don't add to env comments
Browse files Browse the repository at this point in the history
docker.run wont tolerate in env variable any comments or empty data,
as it will try to interpret it as variable with unacceptable name.
So we can just skip comments and empty lines.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed Sep 29, 2023
1 parent c6178bd commit 7806942
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion kernelci/runtime/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ def __init__(self, *args, **kwargs):
def _load_env(self):
if self.config.env_file and os.path.isfile(self.config.env_file):
with open(self.config.env_file, encoding='utf-8') as env:
return [line.strip() for line in env.readlines()]
env_list = []
for line in env.readlines():
env_line = line.strip()
# Skip empty lines and comments
if not env_line or env_line.startswith('#'):
continue
env_list.append(env_line)

return env_list
return None

@classmethod
Expand Down

0 comments on commit 7806942

Please sign in to comment.