Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Conversation

tyrannasaurusbanks
Copy link
Contributor

@tyrannasaurusbanks tyrannasaurusbanks commented Apr 19, 2017

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

@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Apr 19, 2017
@tyrannasaurusbanks tyrannasaurusbanks force-pushed the feature/add-sprig-templating-functions branch from d97cb56 to 0cf7205 Compare April 19, 2017 15:47
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 19, 2017
@tyrannasaurusbanks tyrannasaurusbanks force-pushed the feature/add-sprig-templating-functions branch from 0cf7205 to 830179f Compare April 19, 2017 15:54
@codecov-io
Copy link

codecov-io commented Apr 19, 2017

Codecov Report

Merging #559 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7db8629...f7fe467. Read the comment docs.

glide.lock Outdated
- name: gopkg.in/yaml.v2
version: a5b47d31c556af34a302ce5d659e6fea44d90de0
version: a83829b6f1293c91addabc89d0571c246397bbf4
Copy link
Contributor

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?

Copy link
Contributor

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:

  1. add new dependency to "import" block in a source code where I need it
  2. glide get <dependency>
  3. git add vendor; git commit -a -m "added <depepndency>"

but this process still updates glide.lock and vendor even of unrelated packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@redbaron Yes this was the approach I used.
@mumoshu No i did not intend to pull in an older version - I'm quite surprised and a bit confused by this. Would you like me to revert the go-yaml version change?

Copy link
Contributor

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.

Copy link
Contributor

@mumoshu mumoshu Apr 21, 2017

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.

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

@mumoshu
Copy link
Contributor

mumoshu commented Apr 20, 2017

@tyrannasaurusbanks Thanks for the PR!
The eventual goal of refactoring templates sounds good to me.
One minor comment for now.
Would you mind confirming it?

@tyrannasaurusbanks
Copy link
Contributor Author

No worries, great project, I thought it was about time I got on board and contributed, I'll refactor the templates after this one!

@mumoshu
Copy link
Contributor

mumoshu commented Apr 21, 2017

@redbaron @tyrannasaurusbanks Which versions of glide are you using?

For me:

$ glide --version
glide version 0.13.0-dev

@tyrannasaurusbanks
Copy link
Contributor Author

tyrannasaurusbanks commented Apr 21, 2017

I'm using the latest brew'ed glide:

$ glide --version
glide version 0.12.3

Where did you get 0.13.0-dev from, did you build it from source?

@mumoshu
Copy link
Contributor

mumoshu commented Apr 21, 2017

Where did you get 0.13.0-dev from, did you build it from source?

@tyrannasaurusbanks Thanks for the confirmation!
Yes - However I don't remeber the exact reason why I had done so.
According to the full changelog, I believe I don't need to stick with the dev version. Please let me confirm how it works for me with v0.12.3

@mumoshu
Copy link
Contributor

mumoshu commented Apr 21, 2017

@tyrannasaurusbanks Even with v0.12.3, It seems like I can't reproduce your result
https://gist.github.com/mumoshu/5e5ccec4e9c3b88637680411dd9d127a

Could you provide me your output of glide get?

@tyrannasaurusbanks
Copy link
Contributor Author

tyrannasaurusbanks commented Apr 21, 2017

Yeah sure, I've just reverted the changes on my local branch and re-added the dependency:
https://gist.github.com/tyrannasaurusbanks/b139abcc787aa2a5e20cc8c4926dc022

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!

@mumoshu
Copy link
Contributor

mumoshu commented Apr 26, 2017

@tyrannasaurusbanks Thanks for the info!
Could you run cd ~/.glide/cache/src/https-gopkg.in-yaml.v2 && git branch and share me the commit id for the HEAD?

For me, it printed the commit id which equals to the one seen in the updated glide.yaml.

$ cd ~/.glide/cache/src/https-gopkg.in-yaml.v2
$ git branch
* (HEAD detached at a3f3340)
  v2

I guess that it prints a83829b for you?

The issue in glide which seemed relevant to me is: Masterminds/glide#592

@mumoshu
Copy link
Contributor

mumoshu commented Apr 26, 2017

@tyrannasaurusbanks I guess running glide cc & glide get github.com/Masterminds/sprig allows us to produce equivalent results.

Would you mind running it in your machine and confirming your result is equivalent to the one shown in my gist?
// Yours may contain newer commit ids if one or more dependencies are updated after this comment

@tyrannasaurusbanks
Copy link
Contributor Author

@mumoshu yes, glide cc & glide get github.com/Masterminds/sprig has done the trick.

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.
Thanks for taking the time to get to the bottom of this! I'll update my PR now

@tyrannasaurusbanks tyrannasaurusbanks force-pushed the feature/add-sprig-templating-functions branch from 830179f to ecbc542 Compare May 2, 2017 15:56
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 2, 2017
@tyrannasaurusbanks tyrannasaurusbanks force-pushed the feature/add-sprig-templating-functions branch from be4ee9f to 70ab533 Compare May 2, 2017 16:13
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 2, 2017
@tyrannasaurusbanks tyrannasaurusbanks force-pushed the feature/add-sprig-templating-functions branch from bee950f to f7fe467 Compare May 3, 2017 15:12
@@ -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))) },
Copy link
Contributor

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 👍

@mumoshu
Copy link
Contributor

mumoshu commented May 8, 2017

@tyrannasaurusbanks Great! Thanks a lot for taking your time to finish this 👍

@mumoshu mumoshu merged commit 0cf3475 into kubernetes-retired:master May 8, 2017
@mumoshu mumoshu added this to the v0.9.7-rc.1 milestone May 8, 2017
@tyrannasaurusbanks
Copy link
Contributor Author

tyrannasaurusbanks commented May 15, 2017

@mumoshu no worries, thanks for taking the time to help me get my first commit merged - and for teaching me a bit about glide!
Hopefully I can start looking at some more meatier/impactful ones now!

kylehodgetts pushed a commit to HotelsDotCom/kube-aws that referenced this pull request Mar 27, 2018
…ture/add-sprig-templating-functions

Add sprig templating functions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants