-
Notifications
You must be signed in to change notification settings - Fork 68
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
dispatcher, builder: filter args
against allowedArgs
while processing FROM
, ADD
and RUN
#232
Conversation
@nalind PTAL |
builder.go
Outdated
if argNode.Value == command.Arg { | ||
// extract declared variable | ||
s := strings.SplitN(argNode.Original, " ", 2) | ||
if len(s) == 2 && (strings.ToLower(s[0]) == strings.ToLower("ARG")) { |
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.
strings.ToLower("ARG") versus "arg"?
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.
Yes, switched this to an already defined constant here https://github.com/openshift/imagebuilder/blob/master/dockerfile/command/command.go#L7
Resolution of `FROM ${SOMEARG}` should happen only if `SOMEARG` was declared in the Containerfile. Signed-off-by: Aditya R <arajan@redhat.com>
Filter args against allowed args while processing flags for instruction `ADD` and `RUN`. Signed-off-by: Aditya R <arajan@redhat.com>
cc642fa
to
054a051
Compare
LGTM |
1 similar comment
LGTM |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@flouthoc: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Following PR adds two commits to make sure we expand variables while processing
FROM
,ADD
andRUN
only if they are declared. See individual commits for detail.FROM: only resolve arg in
FROM
if declared anywhereResolution of
FROM ${SOMEARG}
should happen only ifSOMEARG
wasdeclared in the Containerfile.
dispatcher: filter args against allowed args while processing flags for
ADD
andRUN
Closes: #231