This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
kitchen.yml
161 lines (149 loc) · 6.1 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
# Check this doc: https://github.com/test-kitchen/kitchen-azurerm
# you may set the following environment variables:
# AZURE_CLIENT_ID="your-azure-client-id-here"
# AZURE_CLIENT_SECRET="your-client-secret-here"
# AZURE_TENANT_ID="your-azure-tenant-id-here"
# (check doc https://github.com/test-kitchen/kitchen-azurerm for more details)
driver:
name: azurerm
subscription_id: <%= ENV['AZ_SUBSCRIPTION_ID'] %>
location: 'westus2'
machine_size: 'Standard_D2s_v3'
username: azure
password: <%=
require "securerandom"
if File.exists?("./.kitchen/pwd.txt")
ENV['MACHINE_PASS'] = File.read("./.kitchen/pwd.txt")
else
ENV['MACHINE_PASS'] = SecureRandom.base64(24)
File.open("./.kitchen/pwd.txt", "w") { |f| f.write ENV['MACHINE_PASS'] }
end
ENV['MACHINE_PASS']
%>
provisioner:
name: shell # defaults to bash on linux, so the shebang is important!
script: 'tests/kitchen/provisioning.ps1'
verifier:
sudo: true
shell: pwsh
name: pester
test_folder: ./tests/kitchen/
copy_folders:
- output/module/nxtools
downloads:
"./PesterTestResults.xml": "./output/testResults/"
# kitchen_cmd.ps1: "./output/testResults/"
# ./coverage.xml: "./output/testResults/"
# # : ./testresults
# pester_install:
# MaximumVersion: '4.99.999'
platforms:
- name: ubuntu-18.04
driver:
image_urn: Canonical:UbuntuServer:18.04-LTS:latest
lifecycle:
post_create:
- remote: |
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
# Install PowerShell
sudo apt-get install -y powershell
sudo apt-get install -y tree
sudo pwsh -c "enable-ExperimentalFeature -Name PSSubsystemPluginModel"
# Check the provisioning ps1 to see what may be running next...
- name: centos-7.5
driver:
image_urn: OpenLogic:CentOS:7.5:latest
username: azure
password: <%=
require "securerandom"
if File.exists?("./.kitchen/pwd.txt")
ENV['MACHINE_PASS'] = File.read("./.kitchen/pwd.txt")
else
ENV['MACHINE_PASS'] = SecureRandom.base64(24)
File.open("./.kitchen/pwd.txt", "w") { |f| f.write ENV['MACHINE_PASS'] }
end
ENV['MACHINE_PASS']
%>
lifecycle:
post_create:
- remote: echo "<%= ENV['MACHINE_PASS'] %>" | sudo -S chmod +x /etc/sudoers.d
- remote: "echo \"<%= ENV['MACHINE_PASS'] %>\" | sudo -S sh -c \"chmod +x /etc/sudoers.d && echo 'azure ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/waagent\""
- remote: |
# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
# Install PowerShell
sudo yum install -y powershell
# Start PowerShell to enable exp feature
sudo pwsh -c "enable-ExperimentalFeature -Name PSSubsystemPluginModel"
- name: debian-10
driver:
image_urn: Debian:Debian-10:10:latest
username: azure
password: <%=
require "securerandom"
if File.exists?("./.kitchen/pwd.txt")
ENV['MACHINE_PASS'] = File.read("./.kitchen/pwd.txt")
else
ENV['MACHINE_PASS'] = SecureRandom.base64(24)
File.open("./.kitchen/pwd.txt", "w") { |f| f.write ENV['MACHINE_PASS'] }
end
ENV['MACHINE_PASS']
%>
lifecycle:
post_create:
#- remote: echo "<%= ENV['MACHINE_PASS'] %>" | sudo -S chmod +x /etc/sudoers.d
# { echo 'E04hzjc4K4qYV7VeGw7V0H+rFxNM0Amo' ; echo 'hi' ; } | sudo -k -S sed '1 s/^.*$//' | /usr/games/cowsay
- remote: "echo \"<%= ENV['MACHINE_PASS'] %>\" | sudo -S sh -c \"chmod +x /etc/sudoers.d && echo 'azure ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/waagent\""
- remote: sudo apt-get update && sudo apt-get install -y curl gnupg apt-transport-https
- remote: curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- remote: sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'
- remote: sudo apt-get update && sudo apt-get install -y powershell
- remote: pwsh -c "Write-Host 'PowerShell Installed'"
- remote: sudo apt-get install -y lsb-release
# # - remote: mkdir ~/.local/share/powershell
# # - remote: sudo chown -r azure ~/.local/share/powershell
# #- sudo apt-get install -y cowsay
# pre_destroy:
# - local: pwsh -c " rm ./.kitchen/pwd.txt"
# - name: win2019
# driver:
# image_urn: MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest
# verifier:
# bootstrap: # installs modules from nuget feed by download and unzip.
# repository_url: "https://www.powershellgallery.com/api/v2"
# modules:
# - PackageManagement
# - Name: PowerShellGet
# Version: '2.2.4.1'
# - name: win2012r2
# driver:
# image_urn: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
# verifier:
# bootstrap: # installs modules from nuget feed by download and unzip.
# repository_url: "https://www.powershellgallery.com/api/v2"
# modules:
# - PackageManagement
# - Name: PowerShellGet
# Version: '2.2.4.1'
suites:
- name: GCPackages
verifier:
copy_folders:
- output/GCPackages/
- output/module/nxtools # This is only used when troubleshooting interactively.
install_modules:
- Name: GuestConfiguration
AllowPrerelease: true
- name: Functions
verifier:
copy_folders:
- output/module/nxtools