From 0485e2ba615a6282cde422ce8aaa56b1adf15b4b Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Fri, 27 Jan 2023 13:55:01 -0500 Subject: [PATCH 1/3] Fix deprecated method of setting output --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 71bb52a..4a682ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: Release Gem on: workflow_dispatch @@ -11,7 +11,9 @@ jobs: - name: Get Version id: gv run: | - echo "::set-output name=ver::$(grep VERSION lib/vmpooler-provider-vsphere/version.rb |rev |cut -d "'" -f2 |rev)" + ver=$(grep VERSION lib/vmpooler-provider-vsphere/version.rb |rev |cut -d "'" -f2 |rev) + echo "ver=$ver" >> $GITHUB_OUTPUT + echo "Found version $ver from lib/vmpooler-provider-vsphere/version.rb" - name: Tag Release uses: ncipollo/release-action@v1 with: From c7d24001c54034aa24ec48c97bc0e4fa23df5296 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Fri, 27 Jan 2023 14:08:34 -0500 Subject: [PATCH 2/3] Add custom VM attribute information to the docs --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 57bd71e..be6485b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # vmpooler-provider-vsphere +- [vmpooler-provider-vsphere](#vmpooler-provider-vsphere) + - [Usage](#usage) + - [Custom VM Config Attribute](#custom-vm-config-attribute) + - [License](#license) + This is a provider for [VMPooler](https://github.com/puppetlabs/vmpooler) allows using vSphere as a source of machines. This provider was originally part of the main VMPooler code base but was extracted to be a standalone gem so that development could be done independently of VMPooler itself. ## Usage @@ -8,6 +13,15 @@ Include this gem in the same Gemfile that you use to install VMPooler itself and Examples of deploying VMPooler with this provider can be found in the [puppetlabs/vmpooler-deployment](https://github.com/puppetlabs/vmpooler-deployment) repository. +### Custom VM Config Attribute + +This provider sets a custom attribute on the VM called `guestinfo.hostname` to the name of the generated VM, which can be queried from inside the guest OS if VMware Tools is isntalled. For example: + +macOS: `"/Library/Application Support/VMware Tools/vmware-tools-daemon" --cmd "info-get guestinfo.hostname"` +Linux or Windows Guest: `vmtoolsd --cmd "info-get guestinfo.hostname"` + +See the [VMware Tools Administration docs](https://docs.vmware.com/en/VMware-Tools/12.1.0/com.vmware.vsphere.vmwaretools.doc/GUID-D026777B-606D-4442-957A-B953C2049659.html) for more information about querying information from the GuestInfo variable. + ## License vmpooler-provider-vsphere is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details. From e87b4255736eb95a25491e3fd4a81958b81ad4f3 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Fri, 27 Jan 2023 14:22:57 -0500 Subject: [PATCH 3/3] Add changelog generation and release instructions --- .github/workflows/release.yml | 49 ++++++++++++++++++++++++++++++----- .github_changelog_generator | 3 +++ CHANGELOG.md | 48 ++++++++++++++++++++++++++++++++++ README.md | 10 +++++++ update-changelog | 5 ++++ 5 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 .github_changelog_generator create mode 100644 CHANGELOG.md create mode 100755 update-changelog diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a682ea..2a1cb5b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,27 +7,64 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'puppetlabs/vmpooler-provider-vsphere' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Get Version id: gv run: | - ver=$(grep VERSION lib/vmpooler-provider-vsphere/version.rb |rev |cut -d "'" -f2 |rev) - echo "ver=$ver" >> $GITHUB_OUTPUT - echo "Found version $ver from lib/vmpooler-provider-vsphere/version.rb" + version=$(grep VERSION lib/vmpooler-provider-vsphere/version.rb |rev |cut -d "'" -f2 |rev) + echo "version=$version" >> $GITHUB_OUTPUT + echo "Found version $version from lib/vmpooler-provider-vsphere/version.rb" + + - name: Generate Changelog + uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2 + with: + args: >- + --future-release ${{ steps.nv.outputs.version }} + env: + CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate Changelog + run : | + set -e + if [[ -n $(git status --porcelain) ]]; then + echo "Here is the current git status:" + git status + echo + echo "The following changes were detected:" + git --no-pager diff + echo "Uncommitted PRs found in the changelog. Please submit a release prep PR of changes after running 'docker run -it --rm -e CHANGELOG_GITHUB_TOKEN -v "\$\(pwd\)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator:1.16.2 github_changelog_generator --future-release ${{ steps.nv.outputs.version }}'" + exit 1 + fi + + - name: Generate Release Notes + uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2 + with: + args: >- + --since-tag ${{ steps.cv.outputs.result }} + --future-release ${{ steps.nv.outputs.version }} + --output release-notes.md + env: + CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Tag Release uses: ncipollo/release-action@v1 with: - tag: ${{ steps.gv.outputs.ver }} + tag: ${{ steps.nv.outputs.version }} token: ${{ secrets.GITHUB_TOKEN }} + bodyfile: release-notes.md draft: false prerelease: false - generateReleaseNotes: true + + # This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment - name: Install Ruby jruby-9.3.6.0 uses: ruby/setup-ruby@v1 with: ruby-version: 'jruby-9.3.6.0' + - name: Build gem run: gem build *.gemspec + - name: Publish gem run: | mkdir -p $HOME/.gem diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 0000000..db01582 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,3 @@ +project=vmpooler-provider-vsphere +user=puppetlabs +exclude_labels=maintenance \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cf63c29 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,48 @@ +# Changelog + +## [Unreleased](https://github.com/puppetlabs/vmpooler-provider-vsphere/tree/HEAD) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-vsphere/compare/1.6.0...HEAD) + +**Merged pull requests:** + +- \(RE-15111\) Migrate Snyk to Mend Scanning [\#22](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/22) ([yachub](https://github.com/yachub)) +- \(RE-14811\) Remove DIO as codeowners [\#21](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/21) ([yachub](https://github.com/yachub)) +- Add Snyk action [\#20](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/20) ([yachub](https://github.com/yachub)) +- Add release-engineering to codeowners [\#19](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/19) ([yachub](https://github.com/yachub)) +- Update rubocop requirement from ~\> 1.1.0 to ~\> 1.28.2 [\#17](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/17) ([dependabot[bot]](https://github.com/apps/dependabot)) + +## [1.6.0](https://github.com/puppetlabs/vmpooler-provider-vsphere/tree/1.6.0) (2022-07-25) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-vsphere/compare/1.5.0...1.6.0) + +**Merged pull requests:** + +- pin to vmpooler 2.4 [\#18](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/18) ([sbeaulie](https://github.com/sbeaulie)) + +## [1.5.0](https://github.com/puppetlabs/vmpooler-provider-vsphere/tree/1.5.0) (2021-12-13) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-vsphere/compare/1.4.0...1.5.0) + +**Merged pull requests:** + +- Bump version to 1.5.0, require vmpooler \>= 2.1 [\#5](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/5) ([genebean](https://github.com/genebean)) +- Move vsphere specific methods out of vmpooler [\#4](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/4) ([sbeaulie](https://github.com/sbeaulie)) + +## [1.4.0](https://github.com/puppetlabs/vmpooler-provider-vsphere/tree/1.4.0) (2021-12-08) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-vsphere/compare/1.3.0...1.4.0) + +**Merged pull requests:** + +- Prep for initial standalone release: v1.4.0 [\#3](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/3) ([genebean](https://github.com/genebean)) +- Add GH Action for releasing gems [\#2](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/2) ([genebean](https://github.com/genebean)) +- Fix naming, add docs, add missing test file [\#1](https://github.com/puppetlabs/vmpooler-provider-vsphere/pull/1) ([genebean](https://github.com/genebean)) + +## [1.3.0](https://github.com/puppetlabs/vmpooler-provider-vsphere/tree/1.3.0) (2021-11-29) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-vsphere/compare/a08cba099f867b1db01a50940ec3ae9239245db5...1.3.0) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/README.md b/README.md index be6485b..f5af6ce 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ - [vmpooler-provider-vsphere](#vmpooler-provider-vsphere) - [Usage](#usage) - [Custom VM Config Attribute](#custom-vm-config-attribute) + - [Releasing](#releasing) - [License](#license) This is a provider for [VMPooler](https://github.com/puppetlabs/vmpooler) allows using vSphere as a source of machines. This provider was originally part of the main VMPooler code base but was extracted to be a standalone gem so that development could be done independently of VMPooler itself. @@ -22,6 +23,15 @@ Linux or Windows Guest: `vmtoolsd --cmd "info-get guestinfo.hostname"` See the [VMware Tools Administration docs](https://docs.vmware.com/en/VMware-Tools/12.1.0/com.vmware.vsphere.vmwaretools.doc/GUID-D026777B-606D-4442-957A-B953C2049659.html) for more information about querying information from the GuestInfo variable. +## Releasing + +Follow these steps to publish a new GitHub release, and build and push the gem to . + +1. Run `./update-changelog` to update `CHANGELOG.md`. +2. Bump the "VERSION" in `lib/vmpooler-provider-vsphere/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release. +3. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label. +4. After the pull request is approved and merged, then navigate to Actions --> Release Gem --> run workflow --> Branch: main --> Run workflow. + ## License vmpooler-provider-vsphere is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details. diff --git a/update-changelog b/update-changelog new file mode 100755 index 0000000..a7bc056 --- /dev/null +++ b/update-changelog @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +docker run -it --rm -e CHANGELOG_GITHUB_TOKEN -v $(pwd):/usr/local/src/your-app \ + githubchangeloggenerator/github-changelog-generator:1.16.2 \ + github_changelog_generator --future-release $(grep VERSION lib/vmpooler-provider-vsphere/version.rb |rev |cut -d "'" -f2 |rev)