From c0386be382a5f0172eaa3abc0a8d176f6455502b Mon Sep 17 00:00:00 2001 From: treydock Date: Mon, 23 Oct 2023 12:24:10 -0400 Subject: [PATCH] Add Debian 12 support (#3127) * Add Debian 12 support * Need sqlite3 as the alias doesn't exist on Debian 12 * Need native and also need to install npm for debian-12 * Install flask from OS repos on debian as pip throws errors --- .github/workflows/tests.yml | 1 + .gitlab-ci.yml | 4 +-- Gemfile | 2 +- Gemfile.lock | 4 +-- packaging/deb/control | 2 +- packaging/deb/packaging.yaml | 4 +++ packaging/deb/rules | 2 +- spec/e2e/e2e_helper.rb | 36 ++++++++++++++++--------- spec/e2e/nodesets/debian-12-aarch64.yml | 36 +++++++++++++++++++++++++ spec/e2e/nodesets/debian-12.yml | 36 +++++++++++++++++++++++++ 10 files changed, 108 insertions(+), 19 deletions(-) create mode 100644 packaging/deb/packaging.yaml create mode 100644 spec/e2e/nodesets/debian-12-aarch64.yml create mode 100644 spec/e2e/nodesets/debian-12.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9aea3f222a..53ab14196f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -124,6 +124,7 @@ jobs: - amzn2023 - ubuntu-20.04 - ubuntu-22.04 + - debian-12 arch: - x86_64 - aarch64 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1663d43f57..35b46e3517 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,7 @@ build-nightly: - OOD_PACKAGING_DIST: [el7, el8] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec - - OOD_PACKAGING_DIST: [el9] + - OOD_PACKAGING_DIST: [el9, debian-12] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] # Ubuntu doesn't have way to get NodeJS 14+ on ppc64le - OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04] @@ -54,7 +54,7 @@ build: - OOD_PACKAGING_DIST: [el7, el8] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec - - OOD_PACKAGING_DIST: [el9] + - OOD_PACKAGING_DIST: [el9, debian-12] OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le] # Ubuntu doesn't have way to get NodeJS 14+ on ppc64le - OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04] diff --git a/Gemfile b/Gemfile index 4c10305a7e..af59de7041 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'rake' gem 'dotenv', '~> 2.1' group :package do - gem 'ood_packaging', '~> 0.12.1' + gem 'ood_packaging', '~> 0.13.4' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 94275cfc46..fdec954774 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,7 +96,7 @@ GEM oga (3.3) ast ruby-ll (~> 2.1) - ood_packaging (0.12.1) + ood_packaging (0.13.4) rake (~> 13.0.1) open_uri_redirections (0.2.1) parallel (1.21.0) @@ -177,7 +177,7 @@ DEPENDENCIES beaker-docker (~> 1.4.0) beaker-rspec dotenv (~> 2.1) - ood_packaging (~> 0.12.1) + ood_packaging (~> 0.13.4) rake rspec rubocop diff --git a/packaging/deb/control b/packaging/deb/control index 489aba3f33..8e1b3ccf8e 100644 --- a/packaging/deb/control +++ b/packaging/deb/control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>=11~), curl, build-essential, tzdata, libxml2-dev, libxslt-dev, pkg-config, zlib1g-dev, liblzma-dev, ruby, ruby-dev, nodejs (>= 18.0), nodejs (<< 19.0), - sqlite, libsqlite3-dev, python3 + sqlite3, libsqlite3-dev, python3@EXTRA_DEPENDS@ Standards-Version: 4.1.4 Homepage: https://openondemand.org diff --git a/packaging/deb/packaging.yaml b/packaging/deb/packaging.yaml new file mode 100644 index 0000000000..9d94582ccb --- /dev/null +++ b/packaging/deb/packaging.yaml @@ -0,0 +1,4 @@ +--- +debian-12: + extra_depends: + - npm diff --git a/packaging/deb/rules b/packaging/deb/rules index 906479a7f6..6d199a0763 100755 --- a/packaging/deb/rules +++ b/packaging/deb/rules @@ -8,7 +8,7 @@ export GEM_PATH = $(GEM_HOME):$(DESTDIR)/opt/ood/gems:$(shell printenv export APACHE_DIR = "$(DESTDIR)/var/www/ood" export APACHE_CONF_DIR = "$(DESTDIR)/etc/apache2" export CONFIG_DIR = "$(DESTDIR)/etc/ood/config" -export ARCH = $(shell uname -p) +export ARCH = $(shell uname -m) # Left as example of how to do dynamic dependencies # control would need: ${nodejs:Depends} for install dependencies diff --git a/spec/e2e/e2e_helper.rb b/spec/e2e/e2e_helper.rb index 97d81b36c9..dc8a823d19 100644 --- a/spec/e2e/e2e_helper.rb +++ b/spec/e2e/e2e_helper.rb @@ -54,9 +54,15 @@ def dist "amzn#{host_inventory['platform_version']}" when 'ubuntu' "ubuntu-#{host_inventory['platform_version']}" + when 'debian' + "debian-#{host_inventory['platform_version']}" end end +def apt? + ['ubuntu', 'debian'].include?(host_inventory['platform']) +end + def arch host_inventory['kernel']['machine'] end @@ -67,11 +73,13 @@ def codename 'jammy' when 'ubuntu-20.04' 'focal' + when 'debian-12' + 'bookworm' end end def packager - if host_inventory['platform'] == 'ubuntu' + if apt? 'DEBIAN_FRONTEND=noninteractive apt' elsif host_inventory['platform'] == 'redhat' && host_inventory['platform_version'] =~ /^7/ 'yum' @@ -81,7 +89,7 @@ def packager end def apache_service - if host_inventory['platform'] == 'ubuntu' + if apt? 'apache2' elsif host_inventory['platform'] == 'redhat' && host_inventory['platform_version'] =~ /^7/ 'httpd24-httpd' @@ -91,7 +99,7 @@ def apache_service end def apache_reload - if host_inventory['platform'] == 'ubuntu' + if apt? '/usr/sbin/apachectl graceful' elsif host_inventory['platform'] == 'redhat' && host_inventory['platform_version'] =~ /^7/ '/opt/rh/httpd24/root/usr/sbin/httpd-scl-wrapper $OPTIONS -k graceful' @@ -102,7 +110,7 @@ def apache_reload def apache_user case host_inventory['platform'] - when 'ubuntu' + when 'ubuntu', 'debian' 'www-data' else 'apache' @@ -136,7 +144,7 @@ def bootstrap_repos on hosts, 'dnf -y module enable ruby:3.1' on hosts, 'dnf -y module enable nodejs:18' end - when 'ubuntu' + when 'ubuntu', 'debian' on hosts, 'apt-get update' end install_packages(repos) unless repos.empty? @@ -157,7 +165,7 @@ def ondemand_repo create_remote_file(hosts, '/etc/yum.repos.d/ondemand.repo', repo_file) copy_files_to_dir(File.join(proj_root, "dist/#{dist}-#{arch}/*.rpm"), '/repo') on hosts, 'createrepo /repo' - elsif host_inventory['platform'] == 'ubuntu' + elsif apt? install_packages(['dpkg-dev']) copy_files_to_dir(File.join(proj_root, "dist/#{dist}-#{arch}/*.deb"), '/repo') on hosts, 'cd /repo ; dpkg-scanpackages . | gzip -9c > Packages.gz' @@ -192,7 +200,7 @@ def install_ondemand end on hosts, "#{config_manager} --save --setopt ondemand-web.exclude='ondemand ondemand-gems* ondemand-selinux'" install_packages(['ondemand', 'ondemand-dex', 'ondemand-selinux']) - elsif host_inventory['platform'] == 'ubuntu' + elsif apt? install_packages(['wget']) on hosts, "wget -O /tmp/ondemand-release.deb https://yum.osc.edu/ondemand/latest/ondemand-release-web_#{build_repo_version}.0-#{codename}_all.deb" install_packages(['/tmp/ondemand-release.deb']) @@ -207,8 +215,8 @@ def install_ondemand end def fix_apache - # ubuntu has it's own default page - if host_inventory['platform'] == 'ubuntu' + # ubuntu/debian has it's own default page + if apt? default_config = '/etc/apache2/sites-enabled/000-default.conf' on hosts, "test -L #{default_config} && unlink #{default_config} || exit 0" end @@ -221,7 +229,7 @@ def upload_portal_config(file) end def apache_conf_dir - if host_inventory['platform'] == 'ubuntu' + if apt? '/etc/apache2/sites-available' elsif host_inventory['platform'] == 'redhat' && host_inventory['platform_version'] =~ /^7/ '/opt/rh/httpd24/root/etc/httpd/conf.d' @@ -252,8 +260,12 @@ def bootstrap_user end def bootstrap_flask - install_packages(['python3', 'python3-pip']) - on hosts, 'python3 -m pip install flask' + if host_inventory['platform'] == 'debian' + install_packages(['python3', 'python3-flask']) + else + install_packages(['python3', 'python3-pip']) + on hosts, 'python3 -m pip install flask' + end end def dl_ctr_logs diff --git a/spec/e2e/nodesets/debian-12-aarch64.yml b/spec/e2e/nodesets/debian-12-aarch64.yml new file mode 100644 index 0000000000..dd365d9d1f --- /dev/null +++ b/spec/e2e/nodesets/debian-12-aarch64.yml @@ -0,0 +1,36 @@ +HOSTS: + debian12: + roles: + - agent + platform: debian-12-amd64 + hypervisor : docker + image: arm64v8/debian:12 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" + - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates iproute2' + - 'locale-gen en_US.UTF-8' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + - DEBIAN_FRONTEND=noninteractive + docker_container_name: 'ondemand-debian12' + docker_port_bindings: + 22/tcp: + - HostPort: '2222' + HostIp: '127.0.0.1' + 8080/tcp: + - HostPort: '8080' + HostIp: '0.0.0.0' + 5556/tcp: + - HostPort: '5556' + HostIp: '0.0.0.0' +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] + diff --git a/spec/e2e/nodesets/debian-12.yml b/spec/e2e/nodesets/debian-12.yml new file mode 100644 index 0000000000..efb72e7227 --- /dev/null +++ b/spec/e2e/nodesets/debian-12.yml @@ -0,0 +1,36 @@ +HOSTS: + debian12: + roles: + - agent + platform: debian-12-amd64 + hypervisor : docker + image: debian:12 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" + - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates iproute2' + - 'locale-gen en_US.UTF-8' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + - DEBIAN_FRONTEND=noninteractive + docker_container_name: 'ondemand-debian12' + docker_port_bindings: + 22/tcp: + - HostPort: '2222' + HostIp: '127.0.0.1' + 8080/tcp: + - HostPort: '8080' + HostIp: '0.0.0.0' + 5556/tcp: + - HostPort: '5556' + HostIp: '0.0.0.0' +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] +