Skip to content

Commit

Permalink
Upgrade Ubuntu and Debian to NodeJS 20 (#286)
Browse files Browse the repository at this point in the history
* Upgrade Ubuntu and Debian to NodeJS 20

* Bump version, fix ondemand-release-latest for Ubuntu/Debian

* Upgrade amzn2023 to NodeJS 20

* Upgrade runtime to 4.0.1

* Fix Ruby version of amzn2023

* Setup nodejs and npm alternatives for Amazon image
  • Loading branch information
treydock authored Nov 10, 2024
1 parent 8063120 commit accfd40
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 30 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
arch: ppc64le
- dist: ubuntu-22.04
arch: ppc64le
- dist: ubuntu-24.04
arch: ppc64le
- dist: debian-12
arch: ppc64le
runs-on: ${{ matrix.os }}
name: Buildbox tests
steps:
Expand Down Expand Up @@ -276,6 +280,10 @@ jobs:
arch: ppc64le
- dist: ubuntu-22.04
arch: ppc64le
- dist: ubuntu-24.04
arch: ppc64le
- dist: debian-12
arch: ppc64le
runs-on: ${{ matrix.os }}
name: Package ${{ matrix.package }} dist=${{ matrix.dist }} arch=${{ matrix.arch }}
steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
arch: ppc64le
- dist: ubuntu-22.04
arch: ppc64le
- dist: ubuntu-24.04
arch: ppc64le
- dist: debian-12
arch: ppc64le
name: Release buildbox
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ build-image:
- OOD_PACKAGING_DIST: [el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, debian-12]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, debian-12]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
Expand Down Expand Up @@ -132,9 +132,9 @@ build-passenger:
- OOD_PACKAGING_DIST: [el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, debian-12]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, debian-12]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
- OOD_PACKAGING_DIST: [amzn2023]
# Amazon aarch64 takes hours so build by hand for now
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ood_packaging (0.16.0)
ood_packaging (0.16.1)
rake (~> 13.0.1)

GEM
Expand Down
9 changes: 6 additions & 3 deletions lib/ood_packaging/build_box/docker-image/Dockerfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ RUN dnf config-manager --set-enabled crb && dnf clean all && rm -rf /var/cache/d
<% if dist =~ /^el/ -%>
RUN dnf module enable -y ruby:<%= ruby_version %> nodejs:<%= nodejs_version %> && dnf clean all && rm -rf /var/cache/dnf/*
<% end -%>
RUN dnf install -y --allowerasing systemd ruby nodejs sudo which wget \
RUN dnf install -y --allowerasing systemd sudo which wget \
<%= ruby_package %> <%= nodejs_package %> \
gcc-c++ gcc make patch shadow-utils gnupg2 \
rpm-build rpmdevtools rpm-sign <%= dist =~ /^el/ ? 'scl-utils-build' : '' %> && \
dnf clean all && rm -rf /var/cache/dnf/*
<% if dist == 'amzn2023' -%>
RUN alternatives --install /usr/bin/node node /usr/bin/node-<%= nodejs_version %> 1 && \
alternatives --install /usr/bin/npm npm /usr/bin/npm-<%= nodejs_version %> 1
<% end -%>
<% elsif dist =~ /^ubuntu|debian/ -%>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -y && apt upgrade -y && apt clean all -y
Expand All @@ -32,10 +37,8 @@ RUN apt update -y && apt install -y apt-transport-https ca-certificates \
init debhelper devscripts dh-make build-essential apt-cudf lintian equivs \
sudo rake wget curl ruby bundler && \
apt clean all -y
<% if ['focal', 'jammy'].include?(codename) && arch != 'ppc64le' %>
RUN echo "deb https://deb.nodesource.com/node_<%= nodejs_version %>.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nodesource.gpg
<% end %>
<% end -%>
RUN ln -s /dev/null /etc/systemd/system/proc-sys-fs-binfmt_misc.automount
COPY . /build
Expand Down
14 changes: 14 additions & 0 deletions lib/ood_packaging/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,27 @@ def ondemand_rpm_repo_baseurl
end

def ruby_version
return '3.2' if dist == 'amzn2023'

'3.3'
end

def ruby_package
return "ruby#{ruby_version}" if dist == 'amzn2023'

'ruby'
end

def nodejs_version
'20'
end

def nodejs_package
return "nodejs#{nodejs_version}" if dist == 'amzn2023'

'nodejs'
end

def ctr_scripts_dir
'/ondemand-packaging'
end
Expand Down
6 changes: 3 additions & 3 deletions lib/ood_packaging/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

# Version code for OodPackaging
module OodPackaging
VERSION = '0.16.0'
VERSION = '0.16.1'
PACKAGE_VERSION = {
'ondemand-release' => {
'(ubuntu|debian)' => '4.0.0',
'default' => '4.0'
},
'ondemand-release-latest' => {
'(ubuntu|debian)' => '4',
'(ubuntu|debian)' => '5',
'default' => '1-8'
},
'ondemand-runtime' => '4.0.0',
'ondemand-runtime' => '4.0.1',
'scl-utils' => '2.0.3',
'passenger' => '6.0.23',
'cjose' => '0.6.1',
Expand Down
8 changes: 1 addition & 7 deletions packages/ondemand-release-latest/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export DH_VERBOSE = 1
export CODENAME = $(shell lsb_release -sc 2>/dev/null)
export WEB_DESTDIR = $(CURDIR)/debian/ondemand-release-web-latest
export DEB_BUILD_OPTIONS=nocheck
export NODEREPO=node_18.x
export NODEREPO=node_20.x

%:
dh $@
Expand All @@ -20,14 +20,8 @@ override_dh_auto_install:
mkdir -p $(WEB_DESTDIR)/etc/apt/trusted.gpg.d
echo "deb https://apt.osc.edu/ondemand/latest/web/apt $(CODENAME) main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/ondemand-web.list
install -m 644 -D $(CURDIR)/ondemand.gpg $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/ondemand-web.gpg
# Debian 12 (bookworm) and Ubuntu 24.04 (noble)
# have NodeJS 18 in OS repos
ifeq ($(CODENAME),bookworm)
else ifeq ($(CODENAME),noble)
else
echo "deb https://deb.nodesource.com/$(NODEREPO) nodistro main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/nodesource.list
curl -s https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor > $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/nodesource.gpg
endif

override_dh_builddeb:
dh_builddeb -- -Zgzip
8 changes: 1 addition & 7 deletions packages/ondemand-release/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export DEB_BUILD_OPTIONS=nocheck
export VERSION_MAJOR = $(shell echo "$(VERSION)" | cut -d'.' -f1)
export VERSION_MINOR = $(shell echo "$(VERSION)" | cut -d'.' -f2)
export REPO = $(VERSION_MAJOR).$(VERSION_MINOR)
export NODEREPO=node_18.x
export NODEREPO=node_20.x

%:
dh $@
Expand All @@ -23,14 +23,8 @@ override_dh_auto_install:
mkdir -p $(WEB_DESTDIR)/etc/apt/trusted.gpg.d
echo "deb https://apt.osc.edu/ondemand/$(REPO)/web/apt $(CODENAME) main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/ondemand-web.list
install -m 644 -D $(CURDIR)/ondemand.gpg $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/ondemand-web.gpg
# Debian 12 (bookworm) and Ubuntu 24.04 (noble)
# have NodeJS 18 in OS repos
ifeq ($(CODENAME),bookworm)
else ifeq ($(CODENAME),noble)
else
echo "deb https://deb.nodesource.com/$(NODEREPO) nodistro main" > $(WEB_DESTDIR)/etc/apt/sources.list.d/nodesource.list
curl -s https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor > $(WEB_DESTDIR)/etc/apt/trusted.gpg.d/nodesource.gpg
endif

override_dh_builddeb:
dh_builddeb -- -Zgzip
4 changes: 2 additions & 2 deletions packages/ondemand-runtime/rpm/ondemand-runtime.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
%endif
%if 0%{?amzn} == 2023
%global ruby ruby3.2
%global nodejs nodejs
%global nodejs nodejs20
%global apache httpd
%global ruby_version 3.2
%endif
Expand Down Expand Up @@ -95,7 +95,7 @@ Requires: %{nodejs} >= 1:20.0, %{nodejs} < 1:21.0
Requires: npm
%endif
%if 0%{?amzn} == 2023
Requires: %{nodejs} >= 1:18.0, %{nodejs} < 1:19.0
Requires: %{nodejs} >= 1:20.0, %{nodejs} < 1:21.0
Requires: npm
%endif

Expand Down
2 changes: 1 addition & 1 deletion packages/passenger/rpm/passenger.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%define release_version %{package_release}
%define ngix_release_version 1

%define runtime_version 4.0.0
%define runtime_version 4.0.1

%global nginx_user %{?scl_prefix}nginx
%global nginx_group %{nginx_user}
Expand Down
2 changes: 1 addition & 1 deletion release-manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
major: '4.0'
full: '4.0.0'
runtime: '4.0.0'
runtime: '4.0.1'

# release
ondemand-release:
Expand Down
2 changes: 1 addition & 1 deletion spec/ood_packaging/ood_packaging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
end

it 'gets package version for dist ubuntu-20.04' do
expect(described_class.package_version('ondemand-release-latest', 'ubuntu-20.04')).to eq('4')
expect(described_class.package_version('ondemand-release-latest', 'ubuntu-24.04')).to eq('5')
end
end

0 comments on commit accfd40

Please sign in to comment.