Skip to content

Commit 23b3d92

Browse files
authored
Merge pull request #15 from unifio/yl-wip
Update to circleCI 2.0
2 parents a6b7324 + b93d416 commit 23b3d92

File tree

6 files changed

+106
-15
lines changed

6 files changed

+106
-15
lines changed

.circleci/config.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
version: 2
2+
3+
common_steps: &common_steps
4+
- checkout
5+
- run:
6+
name: "Setup cache key"
7+
command: |
8+
echo $TF_VERSION > /tmp/tf_version
9+
- restore_cache:
10+
keys:
11+
- terraform-{{ checksum "/tmp/tf_version" }}
12+
# if this breaks later due to some updated ruby docker version we can deal with cache-busting scenarios then.
13+
- ruby-{{ checksum "/tmp/tf_version" }}-bundle
14+
- run:
15+
name: "Install terraform"
16+
command: |
17+
if [ ! -f "/tmp/terraform" ]; then
18+
wget -O "/tmp/tf.zip" https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip && unzip -o -d "/tmp/terraform" "/tmp/tf.zip"
19+
fi
20+
chmod +x /tmp/terraform/terraform
21+
sudo cp /tmp/terraform/terraform /usr/local/bin/
22+
- run:
23+
name: "Test: terraform version"
24+
command: terraform version
25+
- run:
26+
name: "Test: style check"
27+
command: "[ $(terraform fmt -write=false | wc -l) -eq 0 ]"
28+
- run:
29+
name: "Test: verify plan"
30+
command: |
31+
bundle install
32+
33+
if [ "$TF_LEGACY" != "true" ]; then
34+
for example in $(ls -d examples/*/); do
35+
pushd $example
36+
terraform init
37+
popd
38+
done
39+
fi
40+
41+
bundle exec rake
42+
43+
- save_cache:
44+
key: terraform-{{ checksum "/tmp/tf_version" }}
45+
paths:
46+
- /tmp/terraform
47+
- save_cache:
48+
key: ruby-{{ checksum "/tmp/tf_version" }}-bundle
49+
paths:
50+
- /usr/local/bundle
51+
52+
jobs:
53+
0.8.8:
54+
docker:
55+
- image: circleci/ruby
56+
environment:
57+
- TF_VERSION: 0.8.8
58+
- TF_LEGACY: true
59+
steps: *common_steps
60+
0.9.11:
61+
docker:
62+
- image: circleci/ruby
63+
environment:
64+
- TF_VERSION: 0.9.11
65+
- TF_LEGACY: true
66+
steps: *common_steps
67+
0.10.7:
68+
docker:
69+
- image: circleci/ruby
70+
environment:
71+
- TF_VERSION: 0.10.7
72+
steps: *common_steps
73+
0.11.5:
74+
docker:
75+
- image: circleci/ruby
76+
environment:
77+
- TF_VERSION: 0.11.5
78+
steps: *common_steps
79+
80+
workflows:
81+
version: 2
82+
83+
some_flow:
84+
jobs:
85+
- 0.8.8
86+
- 0.9.11
87+
- 0.10.7
88+
- 0.11.5
89+
90+
91+
#experimental:
92+
#notify:
93+
#branches:
94+
#only:
95+
#- master

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
source "http://rubygems.org"
22

33
gem "rake"
4+
gem "semantic", "~> 1.6.1"

Gemfile.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ GEM
22
remote: http://rubygems.org/
33
specs:
44
rake (11.1.2)
5+
semantic (1.6.1)
56

67
PLATFORMS
78
ruby
89

910
DEPENDENCIES
1011
rake
12+
semantic (~> 1.6.1)
1113

1214
BUNDLED WITH
13-
1.11.2
15+
1.12.5

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
# Terraform AWS OpenVPN Module
2+
3+
[![CircleCI](https://circleci.com/gh/unifio/terraform-aws-openvpn/tree/master.svg?style=svg)](https://circleci.com/gh/unifio/terraform-aws-openvpn/tree/master)

Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'rake'
2+
require 'semantic'
23

34
inputs = {
45
'stack_item_label' => 'expl-tst',
@@ -34,6 +35,10 @@ end
3435
desc "Remove existing local state if present"
3536
task :clean, [:stack] do |t, args|
3637
sh "cd examples/#{args['stack']} && rm -fr .terraform *.tfstate*"
38+
terraform_version = `terraform version`.split("\n", 2)[0].gsub('Terraform v','')
39+
if Semantic::Version.new(terraform_version) >= Semantic::Version.new("0.10.0")
40+
sh "cd examples/#{args['stack']} && terraform init"
41+
end
3742
end
3843

3944
desc "Create execution plan"

circle.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)