summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2023-02-03 20:38:22 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-03 23:08:47 +0000
commit09ca39216efd0c28c71144d25f55b72a9bba24a4 (patch)
tree9451b53e5ad15fc7175048eafec9171555ad902e /buildscripts
parent78973ee9802c1a3f0f26574de459ec512718fd24 (diff)
downloadmongo-09ca39216efd0c28c71144d25f55b72a9bba24a4.tar.gz
SERVER-70427 Remove Chef+Kitchen package test infrastructure
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/package_test/files/sources.list.debian84
-rw-r--r--buildscripts/package_test/kitchen.legacy.yml122
-rw-r--r--buildscripts/package_test/kitchen.yml165
-rw-r--r--buildscripts/package_test/metadata.rb2
-rw-r--r--buildscripts/package_test/recipes/install_mongodb.rb154
-rw-r--r--buildscripts/package_test/rhel-user-data.sh6
-rw-r--r--buildscripts/package_test/test/recipes/service/install_mongodb_spec.rb221
-rw-r--r--buildscripts/package_test/ubuntu-user-data.sh7
8 files changed, 0 insertions, 681 deletions
diff --git a/buildscripts/package_test/files/sources.list.debian8 b/buildscripts/package_test/files/sources.list.debian8
deleted file mode 100644
index 0ad1174270a..00000000000
--- a/buildscripts/package_test/files/sources.list.debian8
+++ /dev/null
@@ -1,4 +0,0 @@
-deb http://archive.debian.org/debian jessie main
-deb-src http://archive.debian.org/debian jessie main
-deb http://security.debian.org/ jessie/updates main
-deb-src http://security.debian.org/ jessie/updates main
diff --git a/buildscripts/package_test/kitchen.legacy.yml b/buildscripts/package_test/kitchen.legacy.yml
deleted file mode 100644
index e2d1d5a2a27..00000000000
--- a/buildscripts/package_test/kitchen.legacy.yml
+++ /dev/null
@@ -1,122 +0,0 @@
----
-driver:
- name: ec2
- region: us-east-1
- vpc_mode: true
- vpc_id: <%= ENV['KITCHEN_VPC'] %>
- subnet_id: <%= ENV['KITCHEN_SUBNET'] %>
- security_group_ids:
- - <%= ENV['KITCHEN_SECURITY_GROUP'] %>
- aws_ssh_key_id: <%= ENV['KITCHEN_SSH_KEY_ID'] %>
- interface: private
- associate_public_ip: true
- tags:
- name: "server package test"
- owner: "build"
- expire-on: "<%= ENV['KITCHEN_EXPIRE'] %>"
-
-verifier:
- name: inspec
- sudo: true
-
-provisioner:
- name: chef_zero
- log_level: info
- require_chef_omnibus: 12
-
-platforms:
- - name: amazon-x86-64
- driver:
- image_id: ami-0080e4c5bc078760e
- transport:
- username: ec2-user
- - name: amazon2-x86-64
- driver:
- image_id: ami-428aa838
- transport:
- username: ec2-user
- - name: amazon2-arm64
- driver:
- image_id: ami-0c582118883b46f4f
- instance_type: c6g.medium
- transport:
- username: ec2-user
- - name: debian10-x86-64
- driver:
- image_id: ami-0dedf6a6502877301
- transport:
- username: admin
- - name: rhel70-x86-64
- driver:
- image_id: ami-2051294a
- transport:
- username: root
- - name: rhel80-x86-64
- driver:
- image_id: ami-0c322300a1dd5dc79
- transport:
- username: ec2-user
- - name: rhel82-arm64
- driver:
- image_id: ami-029ba835ddd43c34f
- instance_type: m6g.medium
- transport:
- username: ec2-user
- - name: suse11-x86-64
- driver:
- image_id: ami-7f2e6015
- transport:
- username: ec2-user
- - name: suse12-x86-64
- driver:
- image_id: ami-0b97110ce9fc52361
- transport:
- username: ec2-user
- - name: suse15-x86-64
- driver:
- image_id: ami-06ea7729e394412c8
- transport:
- username: ec2-user
- - name: ubuntu1204-x86-64
- driver:
- image_id: ami-3fec7956
- transport:
- username: ubuntu
- - name: ubuntu1404-x86-64
- driver:
- image_id: ami-1d8c9574
- transport:
- username: ubuntu
- - name: ubuntu1604-x86-64
- driver:
- image_id: ami-64140d0e
- transport:
- username: ubuntu
- - name: ubuntu1804-x86-64
- driver:
- image_id: ami-7ad76705
- transport:
- username: ubuntu
- - name: ubuntu1804-arm64
- driver:
- image_id: ami-01ac7d9c1179d7b74
- instance_type: m6g.medium
- - name: ubuntu2004-x86-64
- driver:
- image_id: ami-068663a3c619dd892
- transport:
- username: ubuntu
- - name: ubuntu2004-arm64
- driver:
- image_id: ami-00579fbb15b954340
- instance_type: m6g.medium
-
-transport:
- ssh_key: ~/.ssh/kitchen.pem
-
-suites:
- - name: service
- run_list:
- - recipe[package_test::install_mongodb]
- attributes:
- artifacts_url: <%= ENV['KITCHEN_ARTIFACTS_URL'] %>
diff --git a/buildscripts/package_test/kitchen.yml b/buildscripts/package_test/kitchen.yml
deleted file mode 100644
index 61f62ffc6e3..00000000000
--- a/buildscripts/package_test/kitchen.yml
+++ /dev/null
@@ -1,165 +0,0 @@
----
-driver:
- name: ec2
- region: us-east-1
- vpc_mode: true
- vpc_id: <%= ENV['KITCHEN_VPC'] %>
- subnet_id: <%= ENV['KITCHEN_SUBNET'] %>
- security_group_ids:
- - <%= ENV['KITCHEN_SECURITY_GROUP'] %>
- aws_ssh_key_id: <%= ENV['KITCHEN_SSH_KEY_ID'] %>
- interface: private
- associate_public_ip: true
- tags:
- name: "server package test"
- owner: "build"
- expire-on: "<%= ENV['KITCHEN_EXPIRE'] %>"
-
-verifier:
- name: inspec
- sudo: true
-
-provisioner:
- name: chef_zero
- log_level: info
- product_name: cinc
- product_version: 17.9.52
- download_url: https://omnitruck.cinc.sh/install.sh
-
-platforms:
- - name: amazon-x86-64
- driver:
- image_id: ami-0080e4c5bc078760e
- transport:
- username: ec2-user
- - name: amazon2-x86-64
- driver:
- image_id: ami-02013ed1a71752ea7
- transport:
- username: ec2-user
- - name: amazon2-arm64
- driver:
- image_id: ami-0c582118883b46f4f
- instance_type: c6g.medium
- transport:
- username: ec2-user
- - name: amazon2022-arm64
- driver:
- image_id: ami-00bca6c8c9d0e6f92
- instance_type: c6g.medium
- user_data: rhel-user-data.sh
- transport:
- username: ec2-user
- - name: debian71-x86-64
- driver:
- image_id: ami-4b124a22
- transport:
- username: admin
- - name: debian81-x86-64
- driver:
- image_id: ami-896d85e2
- transport:
- username: admin
- - name: debian10-x86-64
- driver:
- image_id: ami-0dedf6a6502877301
- transport:
- username: admin
- - name: debian11-x86-64
- driver:
- image_id: ami-06a80441f25333895
- transport:
- username: admin
- - name: rhel70-x86-64
- driver:
- image_id: ami-0051b1b2c5a166c8c
- transport:
- username: root
- - name: rhel80-x86-64
- driver:
- image_id: ami-0c322300a1dd5dc79
- transport:
- username: ec2-user
- - name: rhel82-arm64
- driver:
- image_id: ami-029ba835ddd43c34f
- instance_type: m6g.medium
- transport:
- username: ec2-user
- - name: rhel90-x86-64
- driver:
- image_id: ami-0c41531b8d18cc72b
- user_data: rhel-user-data.sh
- transport:
- username: ec2-user
- - name: suse11-x86-64
- driver:
- image_id: ami-7f2e6015
- transport:
- username: ec2-user
- - name: suse12-x86-64
- driver:
- image_id: ami-043eebeabcc4e3d35
- transport:
- username: ec2-user
- - name: suse15-x86-64
- driver:
- image_id: ami-06ea7729e394412c8
- transport:
- username: ec2-user
- - name: ubuntu1204-x86-64
- driver:
- image_id: ami-3fec7956
- transport:
- username: ubuntu
- - name: ubuntu1404-x86-64
- driver:
- image_id: ami-1d8c9574
- transport:
- username: ubuntu
- - name: ubuntu1604-x86-64
- driver:
- image_id: ami-64140d0e
- transport:
- username: ubuntu
- - name: ubuntu1804-x86-64
- driver:
- image_id: ami-7ad76705
- transport:
- username: ubuntu
- - name: ubuntu1804-arm64
- driver:
- image_id: ami-01ac7d9c1179d7b74
- instance_type: m6g.medium
- - name: ubuntu2004-x86-64
- driver:
- image_id: ami-068663a3c619dd892
- transport:
- username: ubuntu
- - name: ubuntu2004-arm64
- driver:
- image_id: ami-00579fbb15b954340
- instance_type: m6g.medium
- - name: ubuntu2204-x86-64
- driver:
- image_id: ami-051dcca84f1edfff1
- user_data: ubuntu-user-data.sh
- transport:
- username: ubuntu
- - name: ubuntu2204-arm64
- driver:
- image_id: ami-070650c005cce4203
- instance_type: m6g.medium
- user_data: ubuntu-user-data.sh
- transport:
- username: ubuntu
-
-transport:
- ssh_key: ~/.ssh/kitchen.pem
-
-suites:
- - name: service
- run_list:
- - recipe[package_test::install_mongodb]
- attributes:
- artifacts_url: <%= ENV['KITCHEN_ARTIFACTS_URL'] %>
diff --git a/buildscripts/package_test/metadata.rb b/buildscripts/package_test/metadata.rb
deleted file mode 100644
index 3bbfb147acc..00000000000
--- a/buildscripts/package_test/metadata.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-name 'package_test'
-version '0.1.0'
diff --git a/buildscripts/package_test/recipes/install_mongodb.rb b/buildscripts/package_test/recipes/install_mongodb.rb
deleted file mode 100644
index e7ec6a7067f..00000000000
--- a/buildscripts/package_test/recipes/install_mongodb.rb
+++ /dev/null
@@ -1,154 +0,0 @@
-# This Chef task installs MongoDB in a new EC2 instance spun up by Kitchen in
-# preparation for running some basic server functionality tests.
-
-artifacts_tarball = 'artifacts.tgz'
-homedir = "/tmp"
-
-ruby_block 'allow sudo over tty' do
- block do
- file = Chef::Util::FileEdit.new('/etc/sudoers')
- file.search_file_replace_line(/Defaults\s+requiretty/, '#Defaults requiretty')
- file.search_file_replace_line(/Defaults\s+requiretty/, '#Defaults !visiblepw')
- file.write_file
- end
-end
-
-# This file limits processes to 1024. It therefore interfereres with `ulimit -u` when present.
-if platform_family? 'rhel' or platform_family? 'amazon'
- file '/etc/security/limits.d/90-nproc.conf' do
- action :delete
- end
-end
-
-remote_file "#{homedir}/#{artifacts_tarball}" do
- source node['artifacts_url']
-end
-
-execute 'extract artifacts' do
- command "tar xzvf #{artifacts_tarball}"
- live_stream true
- cwd homedir
-end
-
-if platform_family? 'debian'
-
- # SERVER-40491 Debian 8 sources.list need to point to archive url
- if node['platform'] == 'debian' and node['platform_version'] == '8.1'
- cookbook_file '/etc/apt/sources.list' do
- source 'sources.list.debian8'
- owner 'root'
- group 'root'
- mode '0644'
- action :create
- end
- end
-
- execute 'apt update' do
- command 'apt update'
- live_stream true
- end
-
- ENV['DEBIAN_FRONTEND'] = 'noninteractive'
- package 'openssl'
-
- # the ubuntu image does not have some dependencies installed by default
- # and it is required for the install_compass script
- if node['platform'] == 'ubuntu' and node['platform_version'] >= '20.04'
- execute 'install dependencies ubuntu 20.04' do
- command 'apt-get install -y python3 libsasl2-modules-gssapi-mit'
- live_stream true
- end
- link '/usr/bin/python' do
- to '/usr/bin/python3'
- end
- else
- execute 'install dependencies' do
- command 'apt-get install -y python libsasl2-modules-gssapi-mit'
- live_stream true
- end
- end
-
- # dpkg returns 1 if dependencies are not satisfied, which they will not be
- # for enterprise builds. We install dependencies in the next block.
- execute 'install mongod' do
- command 'dpkg -i `find . -name "*server*.deb"`'
- live_stream true
- cwd homedir
- returns [0, 1]
- end
-
- # install the tools so we can test install_compass
- execute 'install mongo tools' do
- command 'dpkg -i `find . -name "*tools-extra*.deb"`'
- live_stream true
- cwd homedir
- returns [0, 1]
- end
-
- # yum and zypper fetch dependencies automatically, but dpkg does not.
- # Installing the dependencies explicitly is fragile, so we reply on apt-get
- # to install dependencies after the fact.
- execute 'update and fix broken dependencies' do
- command 'apt update && apt -y -f install'
- live_stream true
- end
-end
-
-if platform_family? 'rhel' or platform_family? 'amazon'
- bash 'wait for yum updates if they are running' do
- code <<-EOH
- sleep 120
- EOH
- end
- #rhel9 doesn't have Gconf2 without epel
- if node['platform'] == 'redhat' and node['platform_version'] == '9.0'
- execute 'install epel' do
- command 'dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y'
- live_stream true
- cwd homedir
- end
- end
- execute 'install mongod' do
- command 'yum install -y `find . -name "*server*.rpm"`'
- live_stream true
- cwd homedir
- end
-
- # install the tools so we can test install_compass
- execute 'install mongo tools' do
- command 'yum install -y `find . -name "*tools-extra*.rpm"`'
- live_stream true
- cwd homedir
- end
-end
-
-if platform_family? 'suse'
- bash 'wait for zypper lock to be released' do
- code <<-EOD
- retry_counter=0
- # We also need to make sure another instance of zypper isn't running while
- # we do our install, so just run zypper refresh until it doesn't fail.
- # Waiting for 2 minutes is copied from an internal project where we do this.
- until [ "$retry_counter" -ge "12" ]; do
- zypper refresh && exit 0
- retry_counter=$(($retry_counter + 1))
- [ "$retry_counter" = "12" ] && break
- sleep 10
- done
- exit 1
- EOD
- flags "-x"
- end
-
- execute 'install mongod' do
- command 'zypper --no-gpg-checks -n install `find . -name "*server*.rpm"`'
- live_stream true
- cwd homedir
- end
-
- execute 'install mongo tools' do
- command 'zypper --no-gpg-checks -n install `find . -name "*tools-extra*.rpm"`'
- live_stream true
- cwd homedir
- end
-end
diff --git a/buildscripts/package_test/rhel-user-data.sh b/buildscripts/package_test/rhel-user-data.sh
deleted file mode 100644
index fe927b9b272..00000000000
--- a/buildscripts/package_test/rhel-user-data.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /bin/bash
-sed -i '/^PubkeyAcceptedAlgorithms/s/$/,ssh-rsa/' /etc/crypto-policies/back-ends/opensshserver.config
-sed -i '/^HostKeyAlgorithms/s/$/,ssh-rsa/' /etc/crypto-policies/back-ends/opensshserver.config
-update-crypto-policies --set LEGACY
-systemctl restart sshd
-
diff --git a/buildscripts/package_test/test/recipes/service/install_mongodb_spec.rb b/buildscripts/package_test/test/recipes/service/install_mongodb_spec.rb
deleted file mode 100644
index c0569281332..00000000000
--- a/buildscripts/package_test/test/recipes/service/install_mongodb_spec.rb
+++ /dev/null
@@ -1,221 +0,0 @@
-############################################################
-# This section verifies start, stop, and restart after
-# installation within a new EC2 instance spun up by Kitchen.
-#
-# - stop mongod so that we begin testing from a stopped state
-# - verify start, stop, and restart
-############################################################
-
-# service is not in path for commands with sudo on suse
-service = os[:name] == 'suse' ? '/sbin/service' : 'service'
-
-describe command("#{service} mongod stop") do
- its('exit_status') { should eq 0 }
-end
-
-describe command("#{service} mongod start") do
- its('exit_status') { should eq 0 }
-end
-
-# Inspec treats all amazon linux as upstart, we explicitly make it use
-# systemd_service https://github.com/chef/inspec/issues/2639
-if (os[:name] == 'amazon' and os[:release] == '2.0')
- describe systemd_service('mongod') do
- it { should be_running }
- end
-else
- describe service('mongod') do
- it { should be_running }
- end
-end
-
-describe command("#{service} mongod stop") do
- its('exit_status') { should eq 0 }
-end
-
-describe command("#{service} mongod restart") do
- its('exit_status') { should eq 0 }
-end
-
-if (os[:name] == 'amazon' and os[:release] == '2.0')
- describe systemd_service('mongod') do
- it { should be_running }
- end
-else
- describe service('mongod') do
- it { should be_running }
- end
-end
-
-if os[:arch] == 'x86_64'
- # install_compass does not run Amazon Linux but *does* run on Amazon Linux 2,
- # but the 'redhat' family includes both, apparently. We need to specifically
- # exclude Amazon Linux from the set of allowed distributions here because the
- # version strings would otherwise pass it.
- if ((os[:family] == 'redhat' and os[:name] != "amazon" and os[:release].split('.')[0].to_i >= 7) or
- (os[:name] == 'ubuntu' and os[:release].split('.')[0].to_i >= 16) or
- (os[:name] == 'debian' and os[:release].split('.')[0].to_i >= 9) or
- (os[:name] == 'amazon' and os[:release].split('.')[0].to_i == 2))
- describe command("install_compass") do
- its('exit_status') { should eq 0 }
- its('stderr') { should eq '' }
- end
- elsif os[:name] == 'suse'
- describe command("install_compass") do
- its('exit_status') { should eq 1 }
- its('stderr') { should match /You are using an unsupported platform/ }
- end
- else
- describe command("install_compass") do
- its('exit_status') { should eq 1 }
- its('stderr') { should match /You are using an unsupported Linux distribution/ }
- end
- end
-else
- describe command("install_compass") do
- its('exit_status') { should eq 1 }
- its('stderr') { should match /Sorry, MongoDB Compass is only supported on 64-bit Intel platforms/ }
- end
-end
-
-############################################################
-# This section verifies files, directories, and users
-# - files and directories exist and have correct attributes
-# - mongod user exists and has correct attributes
-############################################################
-
-# convenience variables for init system and package type
-upstart = (os[:name] == 'ubuntu' && os[:release][0..1] == '14') ||
- (os[:name] == 'amazon')
-sysvinit = if (os[:name] == 'debian' && os[:release][0] == '7') ||
- (os[:name] == 'redhat' && os[:release][0] == '6') ||
- (os[:name] == 'suse' && os[:release][0..1] == '11') ||
- (os[:name] == 'ubuntu' && os[:release][0..1] == '12')
- true
- else
- false
- end
-systemd = !(upstart || sysvinit)
-rpm = if os[:name] == 'amazon' || os[:name] == 'redhat' || os[:name] == 'suse'
- true
- else
- false
- end
-deb = !rpm
-
-# these files should exist on all systems
-%w(
- /etc/mongod.conf
- /usr/bin/mongod
- /var/log/mongodb/mongod.log
-).each do |filename|
- describe file(filename) do
- it { should be_file }
- end
-end
-
-if sysvinit
- describe file('/etc/init.d/mongod') do
- it { should be_file }
- it { should be_executable }
- end
-end
-
-if systemd
- unit_file_prefix = ''
- if os[:name] == 'suse'
- # Putting systemd unit files in /usr, which may be a separate partition
- # and therefore not available during isolated startups, is bad practice.
- # But it's what SUSE has chosen to do, so we have to deal with it.
- unit_file_prefix = '/usr'
- end
- describe file("#{unit_file_prefix}/lib/systemd/system/mongod.service") do
- it { should be_file }
- end
-end
-
-if rpm
- %w(
- /var/lib/mongo
- /var/run/mongodb
- ).each do |filename|
- describe file(filename) do
- it { should be_directory }
- end
- end
-
- describe user('mongod') do
- it { should exist }
- its('groups') { should include 'mongod' }
- its('home') { should eq '/var/lib/mongo' }
- its('shell') { should eq '/bin/false' }
- end
-end
-
-if deb
- describe file('/var/lib/mongodb') do
- it { should be_directory }
- end
-
- describe user('mongodb') do
- it { should exist }
- its('groups') { should include 'mongodb' }
- # All versions of Debian 10 will use /usr/sbin/nologin for service
- # account shells
- its('shell') {
- if ((os[:name] == 'debian' and os[:release].split('.')[0] >= '10') or
- (os[:name] == 'ubuntu' and os[:release] == '18.04') or
- (os[:name] == 'ubuntu' and os[:release] == '20.04') or
- (os[:name] == 'ubuntu' and os[:release] == '22.04')
- )
- should eq '/usr/sbin/nologin'
- else
- should eq '/bin/false'
- end
- }
- end
-end
-
-############################################################
-# This section verifies ulimits.
-############################################################
-
-ulimits = {
- 'Max file size' => 'unlimited',
- 'Max cpu time' => 'unlimited',
- 'Max address space' => 'unlimited',
- 'Max open files' => '64000',
- 'Max resident set' => 'unlimited',
- 'Max processes' => '64000'
-}
-ulimits_cmd = 'cat /proc/$(pgrep mongod)/limits'
-
-ulimits.each do |limit, value|
- describe command("#{ulimits_cmd} | grep \"#{limit}\"") do
- its('stdout') { should match(/#{limit}\s+#{value}/) }
- end
-end
-
-############################################################
-# This section verifies uninstall.
-############################################################
-
-if rpm
- describe command('rpm -e $(rpm -qa | grep "mongodb.*server" | awk \'{print $1}\')') do
- its('exit_status') { should eq 0 }
- end
-elsif deb
- describe command('dpkg -r $(dpkg -l | grep "mongodb.*server" | awk \'{print $2}\')') do
- its('exit_status') { should eq 0 }
- end
-end
-
-# make sure we cleaned up
-%w(
- /lib/systemd/system/mongod.service
- /usr/bin/mongod
-).each do |filename|
- describe file(filename) do
- it { should_not exist }
- end
-end
diff --git a/buildscripts/package_test/ubuntu-user-data.sh b/buildscripts/package_test/ubuntu-user-data.sh
deleted file mode 100644
index 0475f8391a1..00000000000
--- a/buildscripts/package_test/ubuntu-user-data.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/bash
-echo "HostkeyAlgorithms +ssh-rsa" >> /etc/ssh/sshd_config
-echo "PubkeyAcceptedAlgorithms +ssh-rsa" >> /etc/ssh/sshd_config
-
-systemctl restart sshd
-
-touch /root/userdata_ran