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
allow image updates to be forced if container not present #181 #189
Conversation
Codecov Report
@@ Coverage Diff @@
## master #189 +/- ##
==========================================
+ Coverage 67.10% 67.12% +0.01%
==========================================
Files 19 19
Lines 1456 1466 +10
==========================================
+ Hits 977 984 +7
- Misses 388 391 +3
Partials 91 91
Continue to review full report at Codecov.
|
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.
Thank you @iamnoah for taking the time and effort to submit this new feature!
Your PR looks awesome, and I have no formal request for change. Just some items up for discussion - please see below.
pkg/argocd/argocd.go
Outdated
func parseImageList(updateImage string) []string { | ||
return strings.Split(updateImage, ",") | ||
} |
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.
I like that this becomes externalized in its own method. Maybe it would make sense to also pull in the white-space trimming into this method, what do you think? Also, I think it could be worth to spend this method its own unit test :)
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.
Once I pulled in the white space, I noticed the next step was to convert to a ContainerImage so I pulled that in as well. I just focused tests on the string parsing since NewFromIdentifier seems well covered.
@@ -56,6 +56,26 @@ func Test_GetImagesFromApplication(t *testing.T) { | |||
imageList := GetImagesFromApplication(application) | |||
assert.Empty(t, imageList) | |||
}) | |||
|
|||
t.Run("Get list of images from application that has force-update", func(t *testing.T) { |
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.
Tests are always appreciated, thank you! 👍
@@ -61,6 +61,21 @@ of the [Semver library](https://github.com/Masterminds/semver) we're using. | |||
[filtering tags](#filtering-tags) | |||
below. | |||
|
|||
|
|||
### Forcing Image Updates |
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.
+1 for documentation update :)
|
||
func Test_parseImageList(t *testing.T) { | ||
assert.Equal(t, []string{"foo", "bar"}, parseImageList(" foo, bar ").Originals()) | ||
// should whitespace inside the spec be preserved? |
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.
I think whitespace stripping should be done here, but let's do that in another PR:
argocd-image-updater/pkg/image/image.go
Line 133 in f1cc8e4
func getImageTagFromIdentifier(identifier string) (string, string, *tag.ImageTag) { |
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, thank you @iamnoah !
Supports #187. I've tested against my deployment of a PodTemplate it works wonderfully :)