Skip to content

Commit

Permalink
feat: Add workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Webb <dan.webb@damacus.io>
  • Loading branch information
damacus committed Nov 27, 2023
1 parent 6798734 commit eaf6390
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 35 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@test-kitchen/maintainers
9 changes: 9 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Lint & Unit

"on":
pull_request:

jobs:
lint-unit:
uses: test-kitchen/.github/.github/workflows/lint-unit.yml@v0.1.2
35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--
name: release-please

Check failure on line 2 in .github/workflows/publish.yaml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

2:5 syntax error: mapping values are not allowed here (syntax)

"on":
push:
branches: [main]

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: ruby
package-name: kitchen-vro
version-file: lib/kitchen/driver/vro_version.rb
token: ${{ secrets.PORTER_GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- name: Build and publish to GitHub Package
uses: actionshub/publish-gem-to-github@main
if: ${{ steps.release.outputs.release_created }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ secrets.OWNER }}

- name: Build and publish to RubyGems
uses: actionshub/publish-gem-to-rubygems@main
if: ${{ steps.release.outputs.release_created }}
with:
token: ${{ secrets.RUBYGEMS_API_KEY }}
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ gem 'kitchen-vro'

And then execute:

$ bundle
```shell
bundle
```

Or install it yourself as:

$ gem install kitchen-vro
```shell
gem install kitchen-vro
```

Or even better, install it via ChefDK:

$ chef gem install kitchen-vro
```shell
chef gem install kitchen-vro
```

## Usage

Expand All @@ -43,21 +49,21 @@ driver:

Additionally, the following parameters are required, either globally or per-platform:

* **create_workflow_name**: The name of the vRO workflow to execute to create a server.
* **destroy_workflow_name**: The name of the vRO workflow to execute to destroy a server.
* **create_workflow_name**: The name of the vRO workflow to execute to create a server.
* **destroy_workflow_name**: The name of the vRO workflow to execute to destroy a server.

There are a number of optional parameters you can configure as well:

* **create_workflow_id**: If your create workflow name is not unique within vRO, you can use
* **create_workflow_id**: If your create workflow name is not unique within vRO, you can use
this parameter to specify the workflow unique ID.
* **destroy_workflow_id**: If your destroy workflow name is not unique within vRO, you can use
* **destroy_workflow_id**: If your destroy workflow name is not unique within vRO, you can use
this parameter to specify the workflow unique ID.
* **create_workflow_parameters**: A hash of key-value pairs of parameters to pass to your
* **create_workflow_parameters**: A hash of key-value pairs of parameters to pass to your
create workflow.
* **destroy_workflow_parameters**: A hash of key-value pairs of parameters to pass to your
* **destroy_workflow_parameters**: A hash of key-value pairs of parameters to pass to your
destroy workflow.
* **request_timeout**: Number of seconds to wait for a vRO workflow to execute. Default: 300
* **vro_disable_ssl_verify**: Disable SSL validation. Default: false
* **request_timeout**: Number of seconds to wait for a vRO workflow to execute. Default: 300
* **vro_disable_ssl_verify**: Disable SSL validation. Default: false

An example `.kitchen.yml` that uses a combination of global and per-platform
settings might look like this:
Expand Down Expand Up @@ -93,20 +99,20 @@ they must meet the following requirements.

### Create Workflow

* Must contain an output parameter called `ip_address` that Test Kitchen can
* Must contain an output parameter called `ip_address` that Test Kitchen can
connect to in order to bootstrap and test your node.
* Must contain an output parameter called `server_id` that is a unique ID of
* Must contain an output parameter called `server_id` that is a unique ID of
the server created. Test Kitchen will provide this value to the Destroy
Workflow in order to request the destruction of the server once testing is
complete.
* Must end the workflow with a raised exception if the creation did not
* Must end the workflow with a raised exception if the creation did not
succeed. The workflow status must not be 'completed.'

### Destroy Workflow

* Must contain an input parameter called `server_id` that Test Kitchen will
* Must contain an input parameter called `server_id` that Test Kitchen will
populate with the unique ID returned from the Create Workflow output.
* Must end the workflow with a raised exception if the creation did not
* Must end the workflow with a raised exception if the creation did not
succeed. The workflow status must not be 'completed.'

## License and Authors
Expand All @@ -120,7 +126,7 @@ License:: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the License at

```
```text
http://www.apache.org/licenses/LICENSE-2.0
```

Expand All @@ -133,7 +139,7 @@ and limitations under the License.

We'd love to hear from you if this doesn't perform in the manner you expect. Please log a GitHub issue, or even better, submit a Pull Request with a fix!

1. Fork it ( https://github.com/chef-partners/kitchen-vro/fork )
1. Fork it ( <https://github.com/chef-partners/kitchen-vro/fork> )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
Expand Down
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:style)

task default: %i[spec style]
task default: %i{spec style}
24 changes: 11 additions & 13 deletions kitchen-vro.gemspec
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'kitchen/driver/vro_version'
require "kitchen/driver/vro_version"

Gem::Specification.new do |spec|
spec.name = 'kitchen-vro'
spec.name = "kitchen-vro"
spec.version = Kitchen::Driver::VRO_VERSION
spec.authors = ['Chef Partner Engineering']
spec.email = ['partnereng@chef.io']
spec.summary = 'A Test Kitchen driver for VMware vRealize Orchestrator (vRO)'
spec.authors = ["Test Kitchen Team"]
spec.email = ["help@sous-chefs.org"]
spec.summary = "A Test Kitchen driver for VMware vRealize Orchestrator (vRO)"
spec.description = spec.summary
spec.homepage = 'https://github.com/chef-partners/kitchen-vro'
spec.license = 'Apache 2.0'
spec.homepage = "https://https://github.com/test-kitchen/kitchen-vro"
spec.license = "Apache 2.0"

spec.files = `git ls-files -z`.split("\x0")
spec.executables = []
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.require_paths = ["lib"]

spec.add_dependency 'test-kitchen', '~> 1.4', '< 4'
spec.add_dependency 'vcoworkflows', '~> 0.2'
spec.add_dependency "test-kitchen", "~> 1.4", "< 4"
spec.add_dependency "vcoworkflows", "~> 0.2"
end

0 comments on commit eaf6390

Please sign in to comment.