Skip to content
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

refactor: Use Git branch / tag for versioning #385

Merged
merged 3 commits into from
Nov 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Operating systems and versions tested with the project:
> Required plugins are automatically downloaded and initialized when using `./build.sh`. For dark sites, you may download the plugins and place these same directory as your Packer executable `/usr/local/bin` or `$HOME/.packer.d/plugins`.

- HashiCorp [Packer Plugin for VMware vSphere][packer-plugin-vsphere] (`vsphere-iso`) 1.1.0 or higher.
- [Packer Plugin for Git][packer-plugin-git] 0.3.2 or higher - a community plugin for HashiCorp Packer.
- [Packer Plugin for Windows Updates][packer-plugin-windows-update] 0.14.1 or higher - a community plugin for HashiCorp Packer.

**Additional Software Packages**:
Expand Down Expand Up @@ -271,42 +272,49 @@ The following additional software packages must be installed on the operating sy

### Step 1 - Download the Source

You can choose between two options to get the source code. Either via the checkout of a Git repository or the download of a release archive.
You can choose between two options to get the source code:

1. [Download the Release Archive](#download-the-latest-release)
1. [Clone the Repository](#clone-the-repository)

> **Warning**
>
> A branch is mandatory because it is used for the build version and the virtual machine name. It does not matter if it is based on the HEAD or a release tag.
> **Warning**
tenthirtyam marked this conversation as resolved.
Show resolved Hide resolved
>
> A branch is mandatory because it is used for the build version and the virtual machine name. It does not matter if it is based on the HEAD or a release tag.

#### Clone the Repository

```shell
#### Download the Latest Release

```console
TAG_NAME=$(curl -s https://api.github.com/repos/vmware-samples/packer-examples-for-vsphere/releases | jq -r '.[0].tag_name')
TARBALL_URL=$(curl -s https://api.github.com/repos/vmware-samples/packer-examples-for-vsphere/releases | jq -r '.[0].tarball_url')

git clone https://github.com/vmware-samples/packer-examples-for-vsphere.git
mkdir packer-examples-for-vsphere
cd packer-examples-for-vsphere
git switch -c $TAG_NAME $TAG_NAME
curl -sL $TARBALL_URL | tar xvfz - --strip-components 1
git init -b main
git add .
git commit -m "Initial commit"
git switch -c $TAG_NAME HEAD
```

#### Clone the Repository

> **Note**
>
> You may also clone `main` for the latest prerelease updates.

#### Download the latest release

```shell
```console
TAG_NAME=$(curl -s https://api.github.com/repos/vmware-samples/packer-examples-for-vsphere/releases | jq -r '.[0].tag_name')
TARBALL_URL=$(curl -s https://api.github.com/repos/vmware-samples/packer-examples-for-vsphere/releases | jq -r '.[0].tarball_url')

mkdir packer-examples-for-vsphere
git clone https://github.com/vmware-samples/packer-examples-for-vsphere.git
cd packer-examples-for-vsphere
curl -sL $TARBALL_URL | tar xvfz - --strip-components 1
git init -b main
git add .
git commit -m "Initial commit"
git switch -c $TAG_NAME HEAD
git switch -c $TAG_NAME $TAG_NAME
```

> **Warning**
>
> A branch is mandatory because it is used for the build version and the virtual machine name. It does not matter if it is based on the HEAD or a release tag.

The directory structure of the repository.

```console
Expand Down Expand Up @@ -1050,6 +1058,7 @@ Happy building!!!
[packer]: https://www.packer.io
[packer-debug]: https://developer.hashicorp.com/packer/docs/debugging
[packer-install]: https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-install-cli
[packer-plugin-git]: https://github.com/ethanmdavidson/packer-plugin-git
[packer-plugin-vsphere]: https://developer.hashicorp.com/packer/plugins/builders/vsphere/vsphere-iso
[packer-plugin-windows-update]: https://github.com/rgl/packer-plugin-windows-update
[packer-variables]: https://developer.hashicorp.com/packer/docs/templates/hcl_templates/variables
Expand Down