-
Notifications
You must be signed in to change notification settings - Fork 4
/
appveyor.yml
145 lines (138 loc) · 6.79 KB
/
appveyor.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
---
version: 0.1.x.{build}
skip_commits:
message: /^\(?doc|travis\)?.*/
clone_depth: 10
init:
- SET
- 'echo System architecture: %PLATFORM%'
- 'echo %APPVEYOR_REPO_NAME%'
environment:
winrm_user: winrm_test_user
winrm_password: WinRM_test_Pass@w0rd1
user_cert: c:\projects\ansible-firefox-config\user.pem
user_key: c:\projects\ansible-firefox-config\key.pem
user_pfx: c:\projects\ansible-firefox-config\user.pfx
CYGWIN: winsymlinks:nativestrict
matrix:
- SUITE: default
ANSIBLE_VERSION: 4.3.0
ANSIBLE_EXTRA_VARS:
TARGET: cygwin64
CYG_ROOT: C:\cygwin64
CYG_SETUP: C:\cygwin64\setup-x86_64.exe
CYG_CACHE: C:\cygwin64\var\cache\setup
CYG_BASH: C:\cygwin64\bin\sh
- SUITE: default
ANSIBLE_VERSION: 3.4.0
ANSIBLE_EXTRA_VARS:
TARGET: cygwin64
CYG_ROOT: C:\cygwin64
CYG_SETUP: C:\cygwin64\setup-x86_64.exe
CYG_CACHE: C:\cygwin64\var\cache\setup
CYG_BASH: C:\cygwin64\bin\sh
matrix:
fast_finish: true
install:
# setup winrm
- ps: net user /Y /add $env:winrm_user $env:winrm_password
- ps: net localgroup administrators $env:winrm_user /add
- ps: $env:PATH="C:\OpenSSL-Win64\bin;$env:PATH"
- ps: Import-Module $env:APPVEYOR_BUILD_FOLDER\test\appveyor\WinrmAppveyor.psm1
- ps: New-ClientCertificate $env:winrm_user $env:APPVEYOR_BUILD_FOLDER
- ps: $env:user_cert_thumb = (Import-pfxCertificate -FilePath $env:user_pfx -CertStoreLocation Cert:\LocalMachine\root).Thumbprint
- ps: Import-pfxCertificate -FilePath $env:user_pfx -CertStoreLocation Cert:\LocalMachine\TrustedPeople
- ps: $env:winrm_cert = (New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:\localmachine\my).Thumbprint
- ps: winrm create winrm/config/Listener?Address=*+Transport=HTTPS "@{Hostname=`"localhost`";CertificateThumbprint=`"$($env:winrm_cert)`"}"
- ps: winrm set winrm/config/client/auth '@{Basic="true"}'
- ps: winrm set winrm/config/service/auth '@{Basic="true"}'
- ps: winrm set winrm/config/service/auth '@{Certificate="true"}'
- ps: winrm set winrm/config/service/auth '@{CbtHardeningLevel="Strict"}'
- ps: winrm set winrm/config/service '@{AllowUnencrypted="true"}'
- ps: New-WinrmUserCertificateMapping $env:user_cert_thumb
- ps: $env:PATH="C:\Ruby$env:ruby_version\bin;$env:PATH"
- ps: Write-Host $env:PATH
- ps: ($pwd).path
# setup ansible
- cmd: "%CYG_SETUP% -qgnNdO -l %CYG_CACHE% -R %CYG_ROOT% -s http://cygwin.mirror.constant.com -P libssl-devel -P python2-devel -P python3-devel -P curl -P python-jinja -P python-crypto -P python-openssl -P python-setuptools -P git -P libffi-devel -P libcrypt-devel -P python36-cryptography"
- cmd: "%CYG_BASH% -lc 'openssl version'"
- cmd: "%CYG_BASH% -lc 'uname -a'"
- cmd: "%CYG_BASH% -lc 'python -m ensurepip'"
- cmd: "%CYG_BASH% -lc 'python3 -m ensurepip'"
- cmd: "%CYG_BASH% -lc 'python3 -m pip install cryptography==3.3.2'"
- cmd: "%CYG_BASH% -lc 'python3 -m pip install --upgrade pip'"
- cmd: "%CYG_BASH% -lc 'python3 -m pip install pywinrm'"
- cmd: "%CYG_BASH% -lc 'python3 -m pip install ansible==%ANSIBLE_VERSION%'"
- cmd: "%CYG_BASH% -lc 'ansible --version'"
- cmd: "%CYG_BASH% -lc 'echo localhost ansible_user=$winrm_user ansible_password=$winrm_password ansible_connection=winrm'"
# - cmd: "%CYG_BASH% -lc 'echo localhost ansible_user=$winrm_user ansible_password=$winrm_password ansible_connection=winrm > inventory'"
# - cmd: "%CYG_BASH% -lc 'cat inventory'"
# - cmd: "%CYG_BASH% -lc 'echo localhost ansible_user=$winrm_user ansible_password=$winrm_password ansible_connection=winrm | tee inventory'"
# - cmd: "%CYG_BASH% -lc 'cat inventory'"
# - ps: echo "localhost ansible_user=$env:winrm_user ansible_password=$env:winrm_password ansible_connection=winrm" | Out-file c:\inventory
# - ps: Get-ChildItem -Path c:\
# - ps: Get-Content -Path c:\inventory
# - ps: |
# $filepath = "C:\inventory"
# $Acl = Get-ACL $filepath
# $AccessRule= New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","full","none","none","Allow")
# $Acl.AddAccessRule($AccessRule)
# Set-Acl $filepath $Acl
- cmd: "%CYG_BASH% -lc 'ls /'"
- cmd: "%CYG_BASH% -lc 'ls -l /cygdrive/c/'"
# - cmd: "%CYG_BASH% -lc 'cat /cygdrive/c/inventory'"
- cmd: "%CYG_BASH% -lc 'ls -l /cygdrive/c/projects/ansible-firefox-config'"
- cmd: "%CYG_BASH% -lc pwd"
# - cmd: "%CYG_BASH% -lc env"
# - cmd: "%CYG_BASH% -lc 'find -ls'"
- cmd: "%CYG_BASH% -lc 'ansible -i /cygdrive/c/projects/ansible-firefox-config/test/appveyor/inventory -m win_ping -vvv localhost'"
- cmd: "%CYG_BASH% -lc 'mkdir -p /etc/ansible/roles'"
- cmd: "%CYG_BASH% -lc 'cp -R /cygdrive/c/projects/ansible-firefox-config /etc/ansible/roles/juju4.firefox_config'"
- cmd: cinst -y firefox
build: off
test_script:
- cmd: "%CYG_BASH% -lc 'ansible-playbook /cygdrive/c/projects/ansible-firefox-config/test/integration/%SUITE%/default.yml --syntax-check'"
- cmd: "%CYG_BASH% -lc 'ansible-playbook -i /cygdrive/c/projects/ansible-firefox-config/test/appveyor/inventory /cygdrive/c/projects/ansible-firefox-config/test/integration/%SUITE%/default.yml -vvv $ANSIBLE_EXTRA_VARS'"
after_test:
# Test idempotence
# %CYG_BASH% -lc 'ansible-playbook -i /cygdrive/c/projects/ansible-firefox-config/test/appveyor/inventory /cygdrive/c/projects/ansible-firefox-config/test/integration/%SUITE%/default.yml $ANSIBLE_EXTRA_VARS | tee /tmp/idempotency.log | grep -q "changed=0.*failed=0" && (echo "Idempotence test: pass" && exit 0) || (echo "Idempotence test: fail" && cat /tmp/idempotency.log && exit 0)'
- cmd: |
%CYG_BASH% -lc 'ansible-playbook -i /cygdrive/c/projects/ansible-firefox-config/test/appveyor/inventory /cygdrive/c/projects/ansible-firefox-config/test/integration/%SUITE%/default.yml $ANSIBLE_EXTRA_VARS'
on_finish:
- ps: |
Get-Acl -Path "C:\Program Files\Firefox" | Format-Table -Wrap
True
- ps: |
Get-ChildItem -Path "C:\Program Files\Firefox" -Recurse
True
- ps: |
Get-Content "c:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js"
True
- ps: |
Get-Content "c:\Program Files\Mozilla Firefox\mozilla.cfg"
True
- ps: |
Get-Content "c:\Program Files\Mozilla Firefox\override.ini"
True
- ps: |
Get-Acl -Path "C:\Program Files (x86)\Firefox" | Format-Table -Wrap
True
- ps: |
Get-ChildItem -Path "C:\Program Files (x86)\Firefox" -Recurse
True
- ps: |
Get-Content "c:\Program Files (x86)\Mozilla Firefox\defaults\pref\autoconfig.js"
True
- ps: |
Get-Content "c:\Program Files (x86)\Mozilla Firefox\mozilla.cfg"
True
- ps: |
Get-Content "c:\Program Files (x86)\Mozilla Firefox\override.ini"
True
notifications:
- provider: Email
to:
on_build_success: false
on_build_failure: false
on_build_status_changed: false