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

fix: Fill IMAGE_TAG,etc on Docker builds #7788

Merged
merged 2 commits into from
Aug 30, 2022

Conversation

0xADD1E
Copy link
Contributor

@0xADD1E 0xADD1E commented Aug 19, 2022

Fixes: #4295

Description
Docs have long stated that these fields are available when using the local docker builder. This makes is to they actually are.

@0xADD1E 0xADD1E marked this pull request as draft August 24, 2022 12:39
@aaron-prindle
Copy link
Contributor

aaron-prindle commented Aug 24, 2022

Thanks for the PR here! Can you rebase this PR, I think recently one of the issues seen in the tests:

panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0

was fixed -
#7774

Additionally I believe there are some legitimate test failures where some expected values in tests might have to be changed in relation to the change made here. To run the full set of unit tests locally you can use make test. After we get these tests green we should be able to merge this!

Resolves GoogleContainerTools#4295
Docs have long stated that these fields are available when
using the local docker builder, now they actually are.
@pull-request-size pull-request-size bot added size/M and removed size/S labels Aug 30, 2022
@0xADD1E
Copy link
Contributor Author

0xADD1E commented Aug 30, 2022

Right - so finally got a chance to get back around to this. Looks like it was just "used to be mocking EvalBuildArgs (as we were only using EvalBuildArgs) but need to also mock EvalBuildArgsWithEnv in some places"

It does feel like there should be a more elegant way of doing this, particularly with the caching bits (perhaps using EvalBuildArgsWithEnv everywhere? That's not how Kaniko is doing it though) -- but I don't think I have a complete enough picture to know exactly what that would be.

In the mean while, I believe the tests should be passing, and the docs match the actual behaviour

@codecov
Copy link

codecov bot commented Aug 30, 2022

Codecov Report

Merging #7788 (fbf342f) into main (290280e) will decrease coverage by 3.91%.
The diff coverage is 53.59%.

@@            Coverage Diff             @@
##             main    #7788      +/-   ##
==========================================
- Coverage   70.48%   66.57%   -3.92%     
==========================================
  Files         515      593      +78     
  Lines       23150    28696    +5546     
==========================================
+ Hits        16317    19104    +2787     
- Misses       5776     8177    +2401     
- Partials     1057     1415     +358     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/credits/export.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/deploy.go 40.90% <0.00%> (-12.94%) ⬇️
cmd/skaffold/app/cmd/test.go 44.44% <0.00%> (ø)
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/render.go 35.48% <18.18%> (-5.90%) ⬇️
cmd/skaffold/app/cmd/lsp.go 28.12% <28.12%> (ø)
cmd/skaffold/app/cmd/run.go 64.28% <33.33%> (-9.63%) ⬇️
cmd/skaffold/app/cmd/fix.go 56.41% <37.50%> (-20.07%) ⬇️
cmd/skaffold/app/cmd/verify.go 41.17% <41.17%> (ø)
... and 362 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@aaron-prindle
Copy link
Contributor

aaron-prindle commented Aug 30, 2022

Thanks so much for your work here @0xADD1E! Re:

It does feel like there should be a more elegant way of doing this, particularly with the caching bits (perhaps using EvalBuildArgsWithEnv everywhere? That's not how Kaniko is doing it though) -- but I don't think I have a complete enough picture to know exactly what that would be.

I've created an issue - #7824 to explore refactoring this as I agree.

Tests look good now, enabling auto-merge! Thanks again!

@aaron-prindle aaron-prindle enabled auto-merge (squash) August 30, 2022 19:10
@aaron-prindle aaron-prindle disabled auto-merge August 30, 2022 19:11
Copy link
Contributor

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make IMAGE_REPO, IMAGE_NAME, IMAGE_TAG available in build.artifacts[i].docker.buildArgs
2 participants