-
Notifications
You must be signed in to change notification settings - Fork 293
Add sprig templating functions #559
Add sprig templating functions #559
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
d97cb56
to
0cf7205
Compare
0cf7205
to
830179f
Compare
Codecov Report
@@ Coverage Diff @@
## master #559 +/- ##
======================================
Coverage 37.7% 37.7%
======================================
Files 51 51
Lines 3302 3302
======================================
Hits 1245 1245
Misses 1854 1854
Partials 203 203 Continue to review full report at Codecov.
|
glide.lock
Outdated
- name: gopkg.in/yaml.v2 | ||
version: a5b47d31c556af34a302ce5d659e6fea44d90de0 | ||
version: a83829b6f1293c91addabc89d0571c246397bbf4 |
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.
go-yaml seems to be reverted to an older version here according to https://github.com/go-yaml/yaml/commits/v2
Did you intend to do so?
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.
how do you add new dependency without re-resolving everything?
what I do:
- add new dependency to "import" block in a source code where I need it
glide get <dependency>
git add vendor; git commit -a -m "added <depepndency>"
but this process still updates glide.lock and vendor even of unrelated packages.
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.
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.
Ah! If I remember correctly, although the gopkg.in is just a proxy for the repo in GitHub, the go-yaml v2 package served by gopkg.in has been a bit out-dated.
I believe I had manually modified the version
after I ran glide update
last time.
I guess it will be safe to rewrite the version manually back to a5b47d31c556af34a302ce5d659e6fea44d90de0
after you run glide get
.
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.
Other than that, your approach seems good to me.
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.
Hm, sorry for the back and forth but even go-ini seems to be reverted to an older version
https://github.com/kubernetes-incubator/kube-aws/pull/559/files#diff-f16a80eae23d5b298c2652448ec420cfR53
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 can't reproduce your result by just running glide get github.com/Masterminds/sprig
.
Mine does change the version of go-yaml as expected but doesn't change the version of go-ini for example.
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've manually rewritten the version's back locally and it builds, so if you're happy with that then i suggest we stick with those:
- name: gopkg.in/yaml.v2
version: a5b47d31c556af34a302ce5d659e6fea44d90de0
- name: github.com/go-ini/ini
version: 6e4869b434bd001f6983749881c7ead3545887d8
@tyrannasaurusbanks Thanks for the PR! |
No worries, great project, I thought it was about time I got on board and contributed, I'll refactor the templates after this one! |
@redbaron @tyrannasaurusbanks Which versions of glide are you using? For me:
|
I'm using the latest brew'ed glide:
Where did you get 0.13.0-dev from, did you build it from source? |
@tyrannasaurusbanks Thanks for the confirmation! |
@tyrannasaurusbanks Even with v0.12.3, It seems like I can't reproduce your result Could you provide me your output of |
Yeah sure, I've just reverted the changes on my local branch and re-added the dependency: My colleagues each get a different version - how is this version hash created? I'd assumed it was a reference to a commit in the target-dependency's git repo - but this assumption is obviously wrong! |
@tyrannasaurusbanks Thanks for the info! For me, it printed the commit id which equals to the one seen in the updated glide.yaml.
I guess that it prints The issue in glide which seemed relevant to me is: Masterminds/glide#592 |
@tyrannasaurusbanks I guess running Would you mind running it in your machine and confirming your result is equivalent to the one shown in my gist? |
@mumoshu yes, I've got some newer commit id's for github.com/aws/aws-sdk-go, but that makes sense given the updated timestamp in my log/run. |
830179f
to
ecbc542
Compare
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
be4ee9f
to
70ab533
Compare
…ove unused 'sha1' function
bee950f
to
f7fe467
Compare
@@ -13,12 +12,8 @@ func GetBytesBuffer(filename string, data interface{}) (*bytes.Buffer, error) { | |||
if err != nil { | |||
return nil, err | |||
} | |||
funcMap := template.FuncMap{ | |||
"sha1": func(v string) string { return fmt.Sprintf("%x", sha1.Sum([]byte(v))) }, |
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.
Seems like we used the sha1
func nowhere in templates. Good catch 👍
@tyrannasaurusbanks Great! Thanks a lot for taking your time to finish this 👍 |
@mumoshu no worries, thanks for taking the time to help me get my first commit merged - and for teaching me a bit about glide! |
…ture/add-sprig-templating-functions Add sprig templating functions
The sprig library will give us some more functionality in the templates, and the next step would be to refactor the usage of the 2 custom template functions (minus and sha1) to make use of sprig implementations