Skip to content

Commit 0f467e6

Browse files
hayk99Hayk Kocharyan
andauthored
feat(ci): Add kitchen test to the project and create Github workflow for this test (#18)
* feat: Kitchen test to verify ecs cluster and services deployment * feat: Add kitchen test to github action * fix: Remove log directory * fix: Add kitchen log directory to gitignore * fix: Remove unused package from Gemfile * chore: Modify action env vars and document kitchen test * fix: Fix typo * fix: fix api token var name * fix: fix precommit * fix: remove unnecessary provider * fix: try action with empty provider * fix: add kitchen destroy * fix: run destroy even previews step failed * fix: try just running destroy * fix: remove conditional * fix: revert changes * chore: Add backend * fix: remove bench from kitchen test and add terraform backend support * fix: remove unused package * fix: sleep 1 minute before testing * fix: increse sleep * Delete kitchen.log Co-authored-by: Hayk Kocharyan <hayk@MacBook-Pro-de-Hayk-Work.local>
1 parent 6b81903 commit 0f467e6

File tree

17 files changed

+1923
-3
lines changed

17 files changed

+1923
-3
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: kitchen-test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
test:
10+
name: Test-Kitchen
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- uses: actions/setup-ruby@v1
16+
with:
17+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
18+
- name: Install bundle
19+
run: bundle install
20+
- name: Run test
21+
run: bundle exec kitchen test
22+
env:
23+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
24+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25+
AWS_REGION: ${{ secrets.AWS_REGION }}
26+
TF_VAR_sysdig_secure_endpoint: https://secure.sysdig.com
27+
TF_VAR_sysdig_secure_api_token: ${{secrets.KUBELAB_SECURE_API_TOKEN}}
28+
- name: Destroy resources
29+
if: ${{ failure() }}
30+
run: bundle exec kitchen destroy
31+
env:
32+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
33+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
34+
AWS_REGION: ${{ secrets.AWS_REGION }}
35+
TF_VAR_sysdig_secure_endpoint: https://secure.sysdig.com
36+
TF_VAR_sysdig_secure_api_token: ${{secrets.KUBELAB_SECURE_API_TOKEN}}

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ crash.log
1616
#
1717
# example.tfvars
1818
terraform.tfvars
19+
*.tfvars
1920

2021
# Ignore override files as they are usually used to override resources locally and so
2122
# are not checked in
@@ -31,3 +32,14 @@ override.tf.json
3132

3233
# MacOS
3334
.DS_Store
35+
36+
## Ruby
37+
## Environment normalization:
38+
/.bundle/
39+
/vendor/bundle
40+
/lib/bundler/man/
41+
42+
43+
#Kitchen test
44+
.kitchen/*
45+
test/fixtures/tf_module/.kitchen/

.kitchen.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
driver:
3+
name: terraform
4+
root_module_directory: test/fixtures/tf_module
5+
# ################
6+
# Uncomment the following two lines if you are deploying /test/fixture/tf_module/main.tf
7+
# using custom tfvars file
8+
# variable_files:
9+
# - test/fixtures/tf_module/test.tfvars
10+
# ################
11+
parallelism: 4
12+
13+
provisioner:
14+
name: terraform
15+
16+
verifier:
17+
name: "awspec"
18+
19+
platforms:
20+
- name: "aws"
21+
22+
suites:
23+
- name: kt_suite
24+
verifier:
25+
name: "awspec"
26+
patterns:
27+
- "test/integration/kt_suite/single-account.rb"

Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source "https://rubygems.org/" do
2+
gem "kitchen-terraform", "~> 6.0.0"
3+
gem 'aws-sdk', '~> 3.0.1'
4+
gem 'awspec', '~> 1.24.0'
5+
gem 'kitchen-verifier-awspec', '~> 0.2.0'
6+
gem 'rhcl', '~> 0.1.0' # ruby hcl parser
7+
end

0 commit comments

Comments
 (0)