-
Notifications
You must be signed in to change notification settings - Fork 81
Offer installation option for specific version #73
Conversation
To improve upon the reproducibility of my setup, I figured out this way of installing a specific version and think it may be useful for others.
README.md
Outdated
To install a specific version, execute the following: | ||
|
||
```shell | ||
export GIT_REF=v1.4.1 |
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.
Love this addition! One thing -- could we make it a little more flexible to support not just different versions from the primary repo, but from any fork as well? Such as this example from the Kubernetes image builder. It might look like this below:
To install a specific version, use the following environment variables to customize the source of the install script:
Name | Description | Default |
---|---|---|
GIT_USER |
The name of a GitHub user or organization. | vmware |
GIT_REPO |
The name of the GitHub repository. | cloud-init-vmware-guestinfo |
GIT_SLUG |
A / delimited combination of a GitHub user/organization and repository, prefixed with the GitHub raw content URL. |
https://raw.githubusercontent.com/${GIT_USER}/${GIT_REPO} |
GIT_REF |
A git branch name, tag name, or commit ID. | v1.4.1 |
GIT_URL |
The full path to the datasource installation script. | ${GIT_SLUG}/${GIT_REF}/install.sh |
The following command uses the above environment variables in such a way that if an environment variable is already set, its existing value will be used, otherwise the value will default to the value from the above table:
GIT_USER="${GIT_USER:-vmware}" \
GIT_REPO="${GIT_REPO:-cloud-init-vmware-guestinfo}" \
GIT_SLUG="${GIT_SLUG:-https://raw.githubusercontent.com/${GIT_USER}/${GIT_REPO}}" \
GIT_REF="${GIT_REF:-v.1.4.1}" \
GIT_URL="${GIT_URL:-${GIT_SLUG}/${GIT_REF}/install.sh}" \
curl -sSL "${GIT_URL}" | sh -
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 am also fine accepting this as-is if you think the above overcomplicates things.
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.
One small nit though would be that you should not need to export the env var:
GIT_REF="v1.4.1" && \
curl -sSL "https://raw.githubusercontent.com/vmware/cloud-init-vmware-guestinfo/${GIT_REF}/install.sh" | sh -
The above will keep the shell free of an additional, exported env var; almost always a good thing.
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.
A guide on how to install from a fork might be suitable for CONTRIBUTING.md
. As of now, I think whoever decides to fork and install their own version should be deep enough into the weeds to figure out the installation.
This issue is being closed because this datasource has been merged into cloud-init (canonical/cloud-init#953):
In order to participate in the growth of this datasource moving forward, please:
Once again, many thanks to the wonderful community that has grown around this datasource, and I look forward to seeing everyone in the new cloud-init forums! |
To improve upon the reproducibility of my setup, I figured out this way of installing a specific version and think it may be useful for others.