This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.kitchen.yml
94 lines (80 loc) · 2.02 KB
/
.kitchen.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# <%
if ENV['JENKINS_COPY_CHEF_CREDENTIALS']
require 'chef/knife'
k = Chef::Knife.new
k.configure_chef
# the existence of the node_name can be taken as "this workstation has a chef setup"
def is_configured?
not Chef::Config[:node_name].nil?
end
def client_config
cfg = {}
%w{client_key node_name chef_server_url}.each{|k| cfg[k.to_sym] = Chef::Config[k]}
cfg
end
def client_key_exists?
File.exists?(Chef::Config[:client_key]) && File.readable?(Chef::Config[:client_key])
end
def client_key_contents_escaped
File.read(Chef::Config[:client_key]).gsub(/\n/, "|")
end
elsif ENV['CI']
# nothing...
else
STDERR.puts "To interact with your Chef Server, please set JENKINS_COPY_CHEF_CREDENTIALS=1"
end
%>
---
driver:
name: vagrant
customize:
cpus: 4
memory: 2048
network:
# Allow access to the Jenkins webui which is useful when troubleshooting
- - forwarded_port
- guest: 8080
host: 9090
auto_correct: true
# Use DHCP to be save for multiple instances
- ["private_network", {type: "dhcp"}]
provisioner:
name: chef_zero
verifier:
name: inspec
platforms:
- name: ubuntu-16.04
run_list:
- recipe[apt]
- name: debian-8.8
run_list:
- recipe[apt]
suites:
- name: essentials
run_list:
- recipe[jenkins-chefci::default]
verifier:
inspec_tests:
- test/smoke/default
attributes:
java:
oracle:
accept_oracle_download_terms: true
- name: full
attributes:
jenkins_chefci:
github_credentials:
login: <%= ENV['JENKINS_GITHUB_LOGIN'] %>
token: <%= ENV['JENKINS_GITHUB_TOKEN'] %>
<% if ENV['JENKINS_COPY_CHEF_CREDENTIALS'] and is_configured? %>
knife_config: <%= client_config.to_json %>
knife_client_key: '<%= client_key_contents_escaped %>'
<% end %>
java:
oracle:
accept_oracle_download_terms: true
run_list:
- recipe[jenkins-chefci::full]
verifier:
inspec_tests:
- test/smoke/full