-
Notifications
You must be signed in to change notification settings - Fork 94
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
add the docker specific arg primitive. #334
base: master
Are you sure you want to change the base?
Conversation
… string for the shell and singularity container types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
hpccm/primitives/arg.py
Outdated
"""String representation of the primitive""" | ||
if self.__variables: | ||
|
||
if hpccm.config.g_ctype == container_type.SINGULARITY or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: apptainer/singularity#1676
It is possible to get something like the Dockerfile ARG
functionality in Singularity with this approach:
SINGULARITYENV_FOO=bar singularity build foo.sif Singularity.def
where Singularity.def contains
%post
echo $FOO >> /bar
So I wonder if the "nodefault" case is applicable to Singularity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to simulate that use case for Singularity. But since for singularity is not as clear the difference of ARG and ENV I do not know if it is better to treat the build time variables using the environment primitive
Hello @samcmill. I have changed the PR to also work with singularity and bash containers. For the Singularity case I have used your suggestion for the bash syntax to define a variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, lost track of this over the holidays. Looking good.
string += "%post" + "\n" | ||
for count, (key, val) in enumerate(sorted(variables.items())): | ||
eol = "" if count == num_vars - 1 else "\n" | ||
string += ' {0}=${{{0}:-"{1}"}}'.format(key, val) + eol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the bash and Singularity args need to be exported? (I'm not sure)
Hello @samcmill any toughs on the current state of the PR ? |
@aavbsouza did you see #334 (comment)? Otherwise, this looks good to me. |
Hello @samcmill sorry for the delay. I will update the pull request. thanks |
… string for the shell and singularity container types
Pull Request Description
Add the the arg primitive that is docker specific. This primitive return a empty string for the bash and singularity container types.
Environment variables for these containers are already treated by the environment primitive.
Author Checklist
pydocmd generate
) if any docstrings have been modified