-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 issue where default-repo wasn't being added to artifact tags (#5341) #5397
Fix issue where default-repo wasn't being added to artifact tags (#5341) #5397
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5397 +/- ##
==========================================
- Coverage 71.60% 71.49% -0.11%
==========================================
Files 397 398 +1
Lines 14434 14642 +208
==========================================
+ Hits 10335 10468 +133
- Misses 3333 3398 +65
- Partials 766 776 +10
Continue to review full report at Codecov.
|
cmd/skaffold/app/cmd/util.go
Outdated
for _, artifact := range buildArtifacts { | ||
tag, err := r.ApplyDefaultRepo(artifact.Tag) | ||
for i := range buildArtifacts { | ||
updatedTag, err := r.ApplyDefaultRepo(buildArtifacts[i].Tag) |
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.
renamed the variable because it was colliding with the tag
package.
Thanks for your contribution @dan-j
You can modify the function signature to: func getBuildArtifactsAndSetTags(artifacts []*latest.Artifact, applyDefaultRepo func(string)(string, error)) ([]build.Artifact, error) {
... and all non-test references look like: buildArtifacts, err := getBuildArtifactsAndSetTags(artifacts, r.ApplyDefaultRepo) That removes the |
Oops, I had forgotten about this and then just ran into the problem this solves 😬 I got halfway through the tests but then sidetracked, will finish this off this week at some point |
hey @dan-j, have you had any time to work on this? Not meaning to pressure, just want to make sure that you have bandwith to finish this :) If not, I'm sure someone on the team could pick it up |
Hey! Yeah I got completely sidetracked by other stuff and forgot, until I've just hit the exact same issue again when running a manual deployment 😅 I was already halfway through the tests, will try finish them tonight, if not it will be this week. |
64d7727
to
e0feb13
Compare
OK, I've added some tests. The change @gsquared94 suggested wasn't completely straight forward because that function also uses the global flags for merging build artifacts. I've refactored the problematic code into a new function and have added tests for this new function. |
e0feb13
to
a202f68
Compare
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 good to me! Thanks @dan-j for this :)
Fixes: #5341, #5463
Description
Using the
--default-repo
option ondeploy
commands wasn't being honoured and the default tag was being deployed.It's a simple bug... The for-loop in
getBuildArtifactsAndSetTags
is correctly prefixing the tag with the --default-repo option but was setting it on the for-loop variable (which is a pointer re-used in each loop), and not updating the actualbuildArtifacts
slice.I haven't added any tests, this is my first contribution and not sure how to get a
runner.Runner
in a test environment. If you want tests adding for this change could somebody give me a point in the right direction 🙂