-
Notifications
You must be signed in to change notification settings - Fork 60
Bug 1842982: preserve ARG values that come before the first FROM #132
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
Conversation
a193302 to
480c819
Compare
Some of the helper functions that addBuildParameters() calls modify the parsed tree, discarding ARG instructions that precede the first FROM instruction. The replacement Dockerfile that we generate from that tree would be missing those instructions. Knowing that this will happen, walk the parsed tree beforehand, recording ARG instructions that precede the first FROM instruction, and then re-prepend them to the Dockerfile that we generate from our tree after we've finished manipulating it. If we've got BuildArgs in a DockerStrategy, populate the BuildArgs map that we pass to imagebuilder functions that might have a use for them. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
We usually try to pull images that are referenced in the Dockerfile ourselves, so that we can record the time required to pull them. If we looked for the image and encounter a problem other than image-hasn't-been-pulled, we would previously have failed, but instead, we now let the build stage handle attempting to pull the image. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
480c819 to
6a5f838
Compare
| } | ||
|
|
||
| if err := replaceImagesFromSource(node, build.Spec.Source.Images); err != nil { | ||
| var buildArgs []corev1.EnvVar |
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.
Looks like you discovered a separate issue from the ARG one where docker strategy ENVs were getting lost as well @nalind
I'm I reading that correctly?
If so, would a comment, analogous to your ARG explanation above, placed here, and a tweak to the PR title/commit, seem prudent?
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.
And some new unit tests as well, again assuming I'm reading this correctly.
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.
They're still build args. The API struct is just called an EnvVar, I'm guessing because inventing a new type for every key-value pairing would have been excessive.
I'm not sure this added logic buys us anything, since we don't do any substitutions when we're walking the parsed tree, but I added it for completeness. I wouldn't object if we wanted to drop it.
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 clarification.
I don't feel either way about keeping it at the moment, though perhaps a unit test would prove one way or the other whether it buys us anything.
Unless other chime in with stronger opinions, I'll leave it at that.
|
/test e2e-aws-builds |
|
Can we please get some attention here, this bug is affecting us, see: https://access.redhat.com/support/cases/#/case/02630699 |
|
is there a bug associated with that case @danielkucera ? ... it would need to be associated with this PR in order for it to merge tests are green and my review comment was addressed at least /assign @adambkaplan |
|
@gabemontero this was the original issue: (registry was starred-out by me) so now it depends on one of yours: |
I see ... thanks for the info @danielkucera .... I think we need to let @nalind make the call on which BZ he thinks should be associated with this PR. After that is done, we'll need an approve from @adambkaplan and then either he or I to lgtm this |
|
@nalind @gabemontero based on the discussion in this PR, I'm going to create a separate BZ to cover this specific case. There seem to be separate issues wrt args in Buildah that may need to be addressed. |
adambkaplan
left a comment
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.
/approve
Going to create an appropriate BZ so we can try and get this into 4.5.0
|
/retitle |
|
/retitle Bug 1842982: preserve ARG values that come before the first FROM |
|
@nalind: This pull request references Bugzilla bug 1842982, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
adambkaplan
left a comment
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.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adambkaplan, nalind The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-4.5 |
|
@adambkaplan: once the present PR merges, I will cherry-pick it on top of release-4.5 in a new PR and assign it to you. DetailsIn response to this:
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. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
@nalind: All pull requests linked via external trackers have merged: openshift/builder#132. Bugzilla bug 1842982 has been moved to the MODIFIED state. DetailsIn response to this:
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. |
|
@adambkaplan: new pull request created: #156 DetailsIn response to this:
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. |
Some of the helper functions that
addBuildParameters()calls modify the parsed tree, discardingARGinstructions that precede the firstFROMinstruction. The replacement Dockerfile that we generate from that tree would be missing those instructions.Knowing that this will happen, walk the parsed tree beforehand, recording
ARGinstructions that precede the firstFROMinstruction, and then re-prepend them to the Dockerfile that we generate from our tree after we've finished manipulating it.If we've got
BuildArgsin aDockerStrategy, populate theBuildArgsmap that we pass to imagebuilder functions that might have a use for them.We usually try to pull images that are referenced in the Dockerfile ourselves, so that we can record the time required to pull them. If we looked for the image and encounter a problem other than image-hasn't-been-pulled (attempting to use an argument in the name would often lead to invalid-image-reference errors), we would previously have failed, but instead, we now let the build stage handle attempting to pull the image.