summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-05-29 17:57:27 -0700
committerGitHub <noreply@github.com>2020-05-29 17:57:27 -0700
commitcd52bea888fedb72768823c31959f14d06c04930 (patch)
tree6bf149eb4b1df7ddab914dcfc2976cc802948d7e
parentd7b7697a29a3a747bf56cf7fe566c78196460080 (diff)
parentd6d0fee0c5779775a7493cd09776e73a666e1fb8 (diff)
downloadchef-cd52bea888fedb72768823c31959f14d06c04930.tar.gz
Merge pull request #9894 from chef/btm/azure-pipelines2
Set up CI with Azure Pipelines
-rw-r--r--azure-pipelines.yml88
-rw-r--r--kitchen-tests/cookbooks/end_to_end/attributes/default.rb2
-rw-r--r--kitchen-tests/cookbooks/end_to_end/files/io.chef.testing.fake.plist25
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_launchd.rb13
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/default.rb114
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/linux.rb118
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/macos.rb65
7 files changed, 314 insertions, 111 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 0000000000..765812faf9
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,88 @@
+# 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 and chef-14?
+#- chef-15
+#- chef-14
+
+pool:
+ vmImage: $(imageName)
+
+jobs:
+ - job:
+ strategy:
+ matrix:
+ linux:
+ imageName: 'ubuntu-latest'
+ mac:
+ 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:
+ 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'
diff --git a/kitchen-tests/cookbooks/end_to_end/attributes/default.rb b/kitchen-tests/cookbooks/end_to_end/attributes/default.rb
index 332a3fe462..e910b9e7d4 100644
--- a/kitchen-tests/cookbooks/end_to_end/attributes/default.rb
+++ b/kitchen-tests/cookbooks/end_to_end/attributes/default.rb
@@ -1,5 +1,7 @@
puts "CHEF UTILS THINKS WE ARE ON UBUNTU" if ubuntu?
puts "CHEF UTILS THINKS WE ARE ON RHEL" if rhel?
+puts "CHEF UTILS THINKS WE ARE ON MACOS" if macos?
+puts "CHEF UTILS THINKS WE ARE ON WINDOWS" if windows?
#
# ubuntu cookbook overrides
diff --git a/kitchen-tests/cookbooks/end_to_end/files/io.chef.testing.fake.plist b/kitchen-tests/cookbooks/end_to_end/files/io.chef.testing.fake.plist
new file mode 100644
index 0000000000..570c736041
--- /dev/null
+++ b/kitchen-tests/cookbooks/end_to_end/files/io.chef.testing.fake.plist
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+
+<plist version="1.0">
+ <dict>
+ <key>Label</key>
+
+ <string>io.chef.testing.fake</string>
+
+ <key>ProgramArguments</key>
+
+ <array>
+ <string>/bin/sleep</string>
+ <string>60</string>
+ </array>
+
+ <key>StartCalendarInterval</key>
+
+ <dict>
+ <key>Hour</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+</plist>
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_launchd.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_launchd.rb
new file mode 100644
index 0000000000..4a1e910b51
--- /dev/null
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_launchd.rb
@@ -0,0 +1,13 @@
+#
+# Cookbook:: end_to_end
+# Recipe:: launchd
+#
+
+file "/Library/LaunchDaemons/io.chef.testing.fake.plist" do
+ path "io.chef.testing.fake.plist"
+ mode "644"
+end
+
+launchd "io.chef.testing.fake" do
+ source "io.chef.testing.fake"
+end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb
index f175474d46..c353e181e9 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb
@@ -5,114 +5,6 @@
# Copyright:: Copyright (c) Chef Software Inc.
#
-hostname "chef-bk-ci.chef.io"
-
-apt_update
-
-chef_sleep "2"
-
-execute "sleep 1"
-
-execute "sleep 1 second" do
- command "sleep 1"
- live_stream true
-end
-
-execute "sensitive sleep" do
- command "sleep 1"
- sensitive true
-end
-
-timezone "UTC"
-
-include_recipe "::_yum" if platform_family?("rhel")
-
-if platform_family?("rhel", "fedora", "amazon")
- include_recipe "selinux::disabled"
-end
-
-build_essential do
- raise_if_unsupported true
-end
-
-include_recipe "::_packages"
-
-include_recipe "ntp"
-
-include_recipe "resolver"
-
-users_manage "sysadmin" do
- group_id 2300
- action [:create]
-end
-
-ssh_known_hosts_entry "github.com"
-
-include_recipe "chef-client::delete_validation"
-include_recipe "chef-client::config"
-
-include_recipe "openssh"
-
-include_recipe "nscd"
-
-include_recipe "logrotate"
-
-include_recipe "git"
-
-# test various archive formats in the archive_file resource
-%w{tourism.tar.gz tourism.tar.xz tourism.zip}.each do |archive|
- cookbook_file File.join(Chef::Config[:file_cache_path], archive) do
- source archive
- end
-
- archive_file archive do
- path File.join(Chef::Config[:file_cache_path], archive)
- extract_to File.join(Chef::Config[:file_cache_path], archive.tr(".", "_"))
- end
-end
-
-user_ulimit "tomcat" do
- filehandle_soft_limit 8192
- filehandle_hard_limit 8192
- process_soft_limit 61504
- process_hard_limit 61504
- memory_limit 1024
- core_limit 2048
- core_soft_limit 1024
- core_hard_limit "unlimited"
- stack_soft_limit 2048
- stack_hard_limit 2048
- rtprio_soft_limit 60
- rtprio_hard_limit 60
-end
-
-chef_client_cron "Run chef-client as a cron job"
-
-chef_client_cron "Run chef-client with base recipe" do
- minute 0
- hour "0,12"
- job_name "chef-client-base"
- log_directory "/var/log/custom_chef_client_dir/"
- log_file_name "chef-client-base.log"
- daemon_options ["--override-runlist mycorp_base::default"]
-end
-
-chef_client_systemd_timer "Run chef-client as a systemd timer" do
- interval "1hr"
- only_if { systemd? }
-end
-
-locale "set system locale" do
- lang "en_US.UTF-8"
- only_if { debian? }
-end
-
-include_recipe "::_apt" if platform_family?("debian")
-include_recipe "::_chef-vault" unless includes_recipe?("end_to_end::chef-vault")
-include_recipe "::_sudo"
-include_recipe "::_sysctl"
-include_recipe "::_alternatives"
-include_recipe "::_cron"
-include_recipe "::_ohai_hint"
-include_recipe "::_openssl"
-include_recipe "::_tests"
+include_recipe "::linux" if platform_family?("rhel", "debian")
+include_recipe "::macos" if macos?
+include_recipe "::windows" if windows?
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
new file mode 100644
index 0000000000..b66edb14dd
--- /dev/null
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
@@ -0,0 +1,118 @@
+#
+# Cookbook:: end_to_end
+# Recipe:: linux
+#
+# Copyright:: Copyright (c) Chef Software Inc.
+#
+
+hostname "chef-bk-ci.chef.io"
+
+apt_update
+
+chef_sleep "2"
+
+execute "sleep 1"
+
+execute "sleep 1 second" do
+ command "sleep 1"
+ live_stream true
+end
+
+execute "sensitive sleep" do
+ command "sleep 1"
+ sensitive true
+end
+
+timezone "UTC"
+
+include_recipe "::_yum" if platform_family?("rhel")
+
+if platform_family?("rhel", "fedora", "amazon")
+ include_recipe "selinux::disabled"
+end
+
+build_essential do
+ raise_if_unsupported true
+end
+
+include_recipe "::_packages"
+
+include_recipe "ntp"
+
+include_recipe "resolver"
+
+users_manage "sysadmin" do
+ group_id 2300
+ action [:create]
+end
+
+ssh_known_hosts_entry "github.com"
+
+include_recipe "chef-client::delete_validation"
+include_recipe "chef-client::config"
+
+include_recipe "openssh"
+
+include_recipe "nscd"
+
+include_recipe "logrotate"
+
+include_recipe "git"
+
+# test various archive formats in the archive_file resource
+%w{tourism.tar.gz tourism.tar.xz tourism.zip}.each do |archive|
+ cookbook_file File.join(Chef::Config[:file_cache_path], archive) do
+ source archive
+ end
+
+ archive_file archive do
+ path File.join(Chef::Config[:file_cache_path], archive)
+ extract_to File.join(Chef::Config[:file_cache_path], archive.tr(".", "_"))
+ end
+end
+
+user_ulimit "tomcat" do
+ filehandle_soft_limit 8192
+ filehandle_hard_limit 8192
+ process_soft_limit 61504
+ process_hard_limit 61504
+ memory_limit 1024
+ core_limit 2048
+ core_soft_limit 1024
+ core_hard_limit "unlimited"
+ stack_soft_limit 2048
+ stack_hard_limit 2048
+ rtprio_soft_limit 60
+ rtprio_hard_limit 60
+end
+
+chef_client_cron "Run chef-client as a cron job"
+
+chef_client_cron "Run chef-client with base recipe" do
+ minute 0
+ hour "0,12"
+ job_name "chef-client-base"
+ log_directory "/var/log/custom_chef_client_dir/"
+ log_file_name "chef-client-base.log"
+ daemon_options ["--override-runlist mycorp_base::default"]
+end
+
+chef_client_systemd_timer "Run chef-client as a systemd timer" do
+ interval "1hr"
+ only_if { systemd? }
+end
+
+locale "set system locale" do
+ lang "en_US.UTF-8"
+ only_if { debian? }
+end
+
+include_recipe "::_apt" if platform_family?("debian")
+include_recipe "::_chef-vault" unless includes_recipe?("end_to_end::chef-vault")
+include_recipe "::_sudo"
+include_recipe "::_sysctl"
+include_recipe "::_alternatives"
+include_recipe "::_cron"
+include_recipe "::_ohai_hint"
+include_recipe "::_openssl"
+include_recipe "::_tests"
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
new file mode 100644
index 0000000000..f1250fb7a1
--- /dev/null
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
@@ -0,0 +1,65 @@
+#
+# Cookbook:: end_to_end
+# Recipe:: macos
+#
+# Copyright:: Copyright (c) Chef Software Inc.
+#
+
+chef_sleep "2"
+
+execute "sleep 1"
+
+execute "sleep 1 second" do
+ command "sleep 1"
+ live_stream true
+end
+
+execute "sensitive sleep" do
+ command "sleep 1"
+ sensitive true
+end
+
+timezone "GMT"
+
+include_recipe "ntp"
+
+include_recipe "resolver"
+
+users_manage "remove sysadmin" do
+ group_name "sysadmin"
+ group_id 2300
+ action [:remove]
+end
+
+users_manage "create sysadmin" do
+ group_name "sysadmin"
+ group_id 2300
+ action [:create]
+end
+
+ssh_known_hosts_entry "github.com"
+
+include_recipe "chef-client::delete_validation"
+include_recipe "chef-client::config"
+
+include_recipe "git"
+
+# test various archive formats in the archive_file resource
+%w{tourism.tar.gz tourism.tar.xz tourism.zip}.each do |archive|
+ cookbook_file File.join(Chef::Config[:file_cache_path], archive) do
+ source archive
+ end
+
+ archive_file archive do
+ path File.join(Chef::Config[:file_cache_path], archive)
+ extract_to File.join(Chef::Config[:file_cache_path], archive.tr(".", "_"))
+ end
+end
+
+launchd "io.chef.testing.fake" do
+ source "io.chef.testing.fake.plist"
+ action "enable"
+end
+
+include_recipe "::_ohai_hint"
+include_recipe "::_openssl"