summaryrefslogtreecommitdiff
path: root/azure-pipelines.yml
blob: f808fa6ff9d56d2cd4a92b12c23372866dd7c5a2 (plain)
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
# End-to-End Test of Chef in macOS

variables:
  FORCE_FFI_YAJL: 'ext'
  CHEF_LICENSE: 'accept-no-persist'

trigger:
- master
# TODO: 20190528 - should we be testing end_to_end on chef-15?
#- chef-15

pool:
  vmImage: $(imageName)

jobs:
  - job:
    strategy:
      matrix:
        ubuntu_kitchen_tests:
          imageName: 'ubuntu-latest'
        mac_kitchen_tests:
          imageName: 'macos-latest'

    steps:
    - script: |
        curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current
        /opt/chef/bin/chef-client -v
        /opt/chef/bin/ohai -v
        /opt/chef/embedded/bin/rake --version
        /opt/chef/embedded/bin/bundle -v
      displayName: 'Install Chef/Ohai from Omnitruck'

    - script: |
        OHAI_VERSION=$(sed -n '/ohai .[0-9]/{s/.*(//;s/)//;p;}' Gemfile.lock)
        sudo /opt/chef/embedded/bin/gem install appbundler appbundle-updater --no-doc
        sudo /opt/chef/embedded/bin/appbundle-updater chef ohai v${OHAI_VERSION} --tarball --github chef/ohai
        sudo /opt/chef/embedded/bin/appbundle-updater chef chef $BUILD_SOURCEVERSION --tarball --github chef/chef
        echo "Installed Chef / Ohai release:"
        /opt/chef/bin/chef-client -v
        /opt/chef/bin/ohai -v
      displayName: 'Upgrade Chef/Ohai via Appbundler'

    - script: |
        cd kitchen-tests
        sudo /opt/chef/embedded/bin/bundle config set without 'omnibus_package docgen ruby_prof'
        sudo /opt/chef/embedded/bin/bundle install --jobs=3 --retry=3 --path=vendor/bundle
        sudo /opt/chef/embedded/bin/gem install berkshelf --no-doc
        sudo /opt/chef/embedded/bin/berks vendor cookbooks
        sudo /opt/chef/bin/chef-client -z -o end_to_end --chef-license accept-no-persist
      displayName: 'Run end_to_end::default recipe'

  - job:
    strategy:
      matrix:
        windows_kitchen_tests:
          imageName: 'windows-latest'

    steps:
    - powershell: |
        . { Invoke-WebRequest -useb https://omnitruck.chef.io/install.ps1 } | Invoke-Expression; Install-Project -project chef -channel current
        $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH
        chef-client -v
        ohai -v
        rake --version
        bundle -v
      displayName: 'Install Chef/Ohai from Omnitruck'

    - powershell: |
        $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH
        $env:OHAI_VERSION = ( Select-String -Path .\Gemfile.lock -Pattern '(?<=ohai \()\d.*(?=\))' | ForEach-Object { $_.Matches[0].Value } )
        gem install appbundler appbundle-updater --no-doc
        appbundle-updater chef ohai v$env:OHAI_VERSION --tarball --github chef/ohai
        appbundle-updater chef chef $env:BUILD_SOURCEVERSION --tarball --github chef/chef
        Write-Output "Installed Chef / Ohai release:"
        chef-client -v
        ohai -v
      displayName: 'Upgrade Chef/Ohai via Appbundler'

    - powershell: |
        cd kitchen-tests
        $env:PATH = "C:\opscode\chef\bin;C:\opscode\chef\embedded\bin;" + $env:PATH
        bundle config set without 'omnibus_package docgen ruby_prof'
        bundle install --jobs=3 --retry=3 --path=vendor/bundle
        gem install berkshelf --no-doc
        berks vendor cookbooks
        chef-client -z -o end_to_end --chef-license accept-no-persist
      displayName: 'Run end_to_end::default recipe'