Skip to content

Commit

Permalink
Add Debian 12 support (#3127)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
treydock authored Oct 23, 2023
1 parent c2aa53d commit c0386be
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
- amzn2023
- ubuntu-20.04
- ubuntu-22.04
- debian-12
arch:
- x86_64
- aarch64
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packaging/deb/control
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions packaging/deb/packaging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
debian-12:
extra_depends:
- npm
2 changes: 1 addition & 1 deletion packaging/deb/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 24 additions & 12 deletions spec/e2e/e2e_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -102,7 +110,7 @@ def apache_reload

def apache_user
case host_inventory['platform']
when 'ubuntu'
when 'ubuntu', 'debian'
'www-data'
else
'apache'
Expand Down Expand Up @@ -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?
Expand All @@ -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'
Expand Down Expand Up @@ -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'])
Expand All @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions spec/e2e/nodesets/debian-12-aarch64.yml
Original file line number Diff line number Diff line change
@@ -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"]

36 changes: 36 additions & 0 deletions spec/e2e/nodesets/debian-12.yml
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit c0386be

Please sign in to comment.