add the docker specific arg primitive. #334
add the docker specific arg primitive. #334aavbsouza wants to merge 4 commits intoNVIDIA:masterfrom aavbsouza:docker_arg_keyword
Conversation
… string for the shell and singularity container types
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.
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.
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. |
samcmill
left a comment
There was a problem hiding this comment.
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.
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