Skip to content
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

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

flouthoc
Copy link
Contributor

Following PR adds two commits to make sure we expand variables while processing FROM, ADD and RUN only if they are declared. See individual commits for detail.

  • FROM: only resolve arg in FROM if declared anywhere
    Resolution of FROM ${SOMEARG} should happen only if SOMEARG was
    declared in the Containerfile.

  • dispatcher: filter args against allowed args while processing flags for ADD and RUN

Closes: #231

@flouthoc
Copy link
Contributor Author

@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")) {
Copy link
Contributor

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"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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>
@rhatdan
Copy link
Contributor

rhatdan commented Jun 27, 2022

LGTM
@nalind PTAL

1 similar comment
@TomSweeneyRedHat
Copy link
Contributor

LGTM
@nalind PTAL

@rhatdan
Copy link
Contributor

rhatdan commented Jul 11, 2022

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 11, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 11, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 11, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 11, 2022

@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.

@openshift-ci openshift-ci bot merged commit 4151e43 into openshift:master Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Imagebuilder expands ARGS which are not declared
3 participants