Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Version auto discovery#28

Open
evrardjp wants to merge 2 commits intojlund:masterfrom
evrardjp:version-auto-discovery
Open

Version auto discovery#28
evrardjp wants to merge 2 commits intojlund:masterfrom
evrardjp:version-auto-discovery

Conversation

@evrardjp
Copy link

@evrardjp evrardjp commented Oct 2, 2016

This will allow the upgrading of versions automatically, without the
need of changes in the role. Recently, golang made public the
storage bucket where the tar.gz and .sha256 files for releases are
published. This commit makes use of this in an automated fashion

Jean-Philippe Evrard added 2 commits October 2, 2016 11:20
This commits allows deployers to override the golang url. It's useful if
they have a repository with software, and want to target it immediately.

Signed-off-by: Jean-Philippe Evrard <[email protected]>
This will allow the upgrading of versions automatically, without the
need of changes in the role. Recently, golang made public the
storage bucket where the tar.gz and .sha256 files for releases are
published. This commit makes use of this in an automated fashion

Signed-off-by: Jean-Philippe Evrard <[email protected]>
---
- name: Discover the latest version
shell:
curl https://api.github.com/repos/golang/go/git/refs/tags/ | egrep 'ref.*refs/tags/go([0-9.]+)",' | egrep -o "[0-9.]+" | sort | tail -n 1
Copy link

Choose a reason for hiding this comment

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

I just did something similar using curl and jq.

Example: curl -L https://api.github.com/repos/golang/go/tags | jq '[ .[].name ] | sort | reverse | .[0]' --raw-output

You could refactor that and use the Ansible module get_url and Jinja filters like from_json and so on therefor avoiding the use of the shell 😉

Copy link
Author

Choose a reason for hiding this comment

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

that would be more elegant indeed.
jq is absent on my machine, and I didn't want to introduce a dependency. It's not really more readable either.

Copy link

Choose a reason for hiding this comment

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

The jq usage was just an example 😉 The same can be done with Jinja filters in Ansible.

when:
- not go_tarball is defined
- not go_tarball_checksum is defined
- not go_download_location is defined
Copy link

@ypid ypid Oct 3, 2016

Choose a reason for hiding this comment

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

This is bad style according to PEP8 and bad English. Consider changing to is not or is undefined.

- name: Setting facts based on previous autodiscovered facts
set_fact:
go_tarball_checksum: "sha256:{{ lookup('url',go_download_buckets_url+go_tarball+'.sha256') }}"
go_download_location: "{{ go_download_buckets_url }}{{ go_tarball }}"
Copy link

Choose a reason for hiding this comment

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

Checksum and tarball are downloaded from the same origin which basically now only ensures that CRC checksums in TCP did not fail. Consider using OpenGPG to check authenticity of the downloaded tarball.

Copy link
Author

Choose a reason for hiding this comment

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

yes, I'm ensuring everything went fine through the wire.

I don't see the difference between manually checking the SHA on the website and doing the checksum on your machine to see if it was properly downloaded.

Could you be more clear about this?

Copy link

Choose a reason for hiding this comment

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

Refer to the debops.hashicorp for how this should be done (using OpenPGP).

@yogo1212
Copy link

is this PR open for take-over?

@evrardjp
Copy link
Author

Yup anyone can take over this.

@yogo1212
Copy link

@evrardjp and so i went and looked around.

not too easy to find [1].

https://dl.google.com/go/go1.10.linux-amd64.tar.gz.asc
https://dl.google.com/dl/linux/linux_signing_key.pub

will start tomorrow.

[1] golang/go#14739

@yogo1212 yogo1212 mentioned this pull request Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants