Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/apt-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- Debian GNU/Linux bullseye arm64
- Ubuntu Bionic arm64
- Ubuntu Focal arm64
- Ubuntu Jammy arm64
include:
- label: Debian GNU/Linux buster arm64
rake-job: debian-buster
Expand All @@ -28,6 +29,10 @@ jobs:
rake-job: ubuntu-focal
rake-options: LINTIAN=no
test-docker-image: arm64v8/ubuntu:focal
- label: Ubuntu Jammy arm64
rake-job: ubuntu-jammy
rake-options: LINTIAN=no
test-docker-image: arm64v8/ubuntu:jammy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- Ubuntu Xenial amd64
- Ubuntu Bionic amd64
- Ubuntu Focal amd64
- Ubuntu Jammy amd64
include:
- label: Debian GNU/Linux buster amd64
rake-job: debian-buster
Expand All @@ -31,6 +32,9 @@ jobs:
- label: Ubuntu Focal amd64
rake-job: ubuntu-focal
test-docker-image: ubuntu:focal
- label: Ubuntu Jammy amd64
rake-job: ubuntu-jammy
test-docker-image: ubuntu:jammy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand Down
3 changes: 2 additions & 1 deletion td-agent-apt-source/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ class TdAgentAptSourcePackageTask < PackageTask
"debian-buster",
"ubuntu-xenial",
"ubuntu-bionic",
"ubuntu-focal"
"ubuntu-focal",
"ubuntu-jammy"
]
end

Expand Down
17 changes: 17 additions & 0 deletions td-agent-apt-source/apt/ubuntu-jammy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:jammy

RUN \
echo "debconf debconf/frontend select Noninteractive" | \
debconf-set-selections

ARG DEBUG

RUN \
quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \
apt update ${quiet} && \
apt install -y -V ${quiet} \
debhelper \
devscripts \
gnupg && \
apt clean && \
rm -rf /var/lib/apt/lists/*
62 changes: 46 additions & 16 deletions td-agent/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,28 @@ def tar_command
end
end

def use_ruby3?
# Check whether ubuntu 22.04 (jammy) or not
# Basically, TD Agent adopts ruby 2.7 as default version, but on Ubuntu 22.04,
# use ruby 3.x because distribution switches to OpenSSL 3.x.
return false unless File.exist?("/etc/os-release")
os_release_entries = File.open("/etc/os-release").readlines.map(&:strip)
os_release_entries.include?("UBUNTU_CODENAME=jammy") and os_release_entries.include?("ID=ubuntu")
Copy link
Copy Markdown
Contributor

@cosmo0920 cosmo0920 Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: This is not required but also CentOS Stream 9 (and RockyLinux 9) will be needed to switch using Ruby 3.1.
This is just for your information but we will need to handle this Ruby 3.1 switching in the future.

end

def bundled_ruby_version
use_ruby3? ? BUNDLED_RUBY3_VERSION : BUNDLED_RUBY_VERSION
end

def bundled_ruby_source_sha256sum
use_ruby3? ? BUNDLED_RUBY3_SOURCE_SHA256SUM : BUNDLED_RUBY_SOURCE_SHA256SUM
end

class DownloadTask
include Rake::DSL

attr_reader :file_jemalloc_source
attr_reader :file_ruby_source, :file_ruby_installer_x64
attr_reader :file_ruby_source, :file_ruby3_source, :file_ruby_installer_x64
attr_reader :file_fluentd_archive
attr_reader :files_ruby_gems
attr_reader :file_openssl_source
Expand All @@ -186,6 +203,7 @@ class DownloadTask
@file_jemalloc_source,
@file_openssl_source,
@file_ruby_source,
@file_ruby3_source,
@file_ruby_installer_x64,
@file_fluentd_archive,
*@files_ruby_gems
Expand All @@ -204,7 +222,7 @@ class DownloadTask
task :jemalloc => [@file_jemalloc_source]

desc "Download Ruby source"
task :ruby => [@file_ruby_source, @file_ruby_installer_x64]
task :ruby => [@file_ruby_source, @file_ruby3_source, @file_ruby_installer_x64]

desc "Clone fluentd repository and create a tarball"
task :fluentd => @file_fluentd_archive
Expand Down Expand Up @@ -273,17 +291,24 @@ class DownloadTask
end

def define_ruby_source_file
version = BUNDLED_RUBY_VERSION
sha256sum = BUNDLED_RUBY_SOURCE_SHA256SUM
filename = "ruby-#{version}.tar.gz"
feature_version = version.match(/^(\d+\.\d+)/)[0]
url_base = "https://cache.ruby-lang.org/pub/ruby/"
url = "#{url_base}#{feature_version}/#{filename}"

@file_ruby_source = File.join(DOWNLOADS_DIR, filename)

file @file_ruby_source do
download_file(url, filename, sha256sum)
[[BUNDLED_RUBY_VERSION, BUNDLED_RUBY_SOURCE_SHA256SUM],
[BUNDLED_RUBY3_VERSION, BUNDLED_RUBY3_SOURCE_SHA256SUM]].each do |version, sha256sum|
filename = "ruby-#{version}.tar.gz"
feature_version = version.match(/^(\d+\.\d+)/)[0]
url_base = "https://cache.ruby-lang.org/pub/ruby/"
url = "#{url_base}#{feature_version}/#{filename}"

if version.start_with?("3")
@file_ruby3_source = File.join(DOWNLOADS_DIR, filename)
file @file_ruby3_source do
download_file(url, filename, sha256sum)
end
else
@file_ruby_source = File.join(DOWNLOADS_DIR, filename)
file @file_ruby_source do
download_file(url, filename, sha256sum)
end
end
end
end

Expand Down Expand Up @@ -625,7 +650,7 @@ class BuildTask
BUNDLED_RUBY_PATCHES.each do |patch|
patch_name, version_condition = patch
dependency = Gem::Dependency.new('', version_condition)
if dependency.match?('', BUNDLED_RUBY_VERSION)
if dependency.match?('', bundled_ruby_version)
patch_path = File.join(__dir__, "patches", patch_name)
sh("patch", "-p1", "--input=#{patch_path}")
end
Expand Down Expand Up @@ -737,7 +762,11 @@ class BuildTask
end

def build_ruby_from_source
tarball = @download_task.file_ruby_source
tarball = if use_ruby3?
@download_task.file_ruby3_source
else
@download_task.file_ruby_source
end
ruby_source_dir = tarball.sub(/\.tar\.gz$/, '')

sh(*tar_command, "xvf", tarball, "-C", DOWNLOADS_DIR)
Expand Down Expand Up @@ -869,7 +898,7 @@ class BuildTask
if windows?
ruby_version = BUNDLED_RUBY_INSTALLER_X64_VERSION
else
ruby_version = BUNDLED_RUBY_VERSION
ruby_version = bundled_ruby_version
end
rb_major, rb_minor, rb_teeny = ruby_version.split("-", 2).first.split(".", 3)
"#{rb_major}.#{rb_minor}.0" # gem path's teeny version is always 0
Expand Down Expand Up @@ -1248,6 +1277,7 @@ EOS
"ubuntu-xenial",
"ubuntu-bionic",
"ubuntu-focal",
"ubuntu-jammy",
]
end

Expand Down
2 changes: 1 addition & 1 deletion td-agent/apt/commonvar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ case ${code_name} in
mirror=http://archive.ubuntu.com/ubuntu/
java_jdk=openjdk-8-jre
;;
bionic|focal|hirsute)
bionic|focal|hirsute|jammy)
distribution=ubuntu
channel=universe
mirror=http://archive.ubuntu.com/ubuntu/
Expand Down
5 changes: 5 additions & 0 deletions td-agent/apt/install-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ if [ -e $conf_path ]; then
exit 1
fi

if [ ${code_name} = "jammy" ]; then
# TODO: Remove when repository for jammy has been deployed
echo "skip to install via apt repository: <${code_name}>"
exit 0
fi
apt clean all
apt_source_package=${apt_source_repositories_dir}/${distribution}/pool/${code_name}/${channel}/*/*/td-agent-apt-source*_all.deb
apt install -V -y ${apt_source_package}
Expand Down
5 changes: 5 additions & 0 deletions td-agent/apt/piuparts-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ case ${code_name} in
apt install -V -y piuparts mount gnupg curl eatmydata apt-transport-https
gpg_command=gpg
;;
jammy)
# TODO: Remove when repository for jammy has been deployed
echo "skip piuparts test for jammy"
exit 0
;;
*)
DEBIAN_FRONTEND=noninteractive apt install -V -y piuparts mount gnupg1 curl eatmydata
gpg_command=gpg1
Expand Down
5 changes: 5 additions & 0 deletions td-agent/apt/pkgsize-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ case ${DISTRIBUTION} in
done
;;
ubuntu)
if [ $CODE_NAME = "jammy" ]; then
# TODO: Remove when repository for jammy has been deployed
echo "No previous ${CODE_NAME} release"
exit 0
fi
BASE_URI=http://packages.treasuredata.com.s3.amazonaws.com/4/ubuntu/${CODE_NAME}
CHANNEL=universe
for v in "${PREVIOUS_VERSIONS[@]}"; do
Expand Down
18 changes: 18 additions & 0 deletions td-agent/apt/ubuntu-jammy-arm64/from
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

arm64v8/ubuntu:jammy
57 changes: 57 additions & 0 deletions td-agent/apt/ubuntu-jammy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

ARG FROM=ubuntu:jammy
FROM ${FROM}

COPY qemu-* /usr/bin/

RUN \
echo "debconf debconf/frontend select Noninteractive" | \
debconf-set-selections

ARG DEBUG

RUN sed -i'' -e 's/^# deb-src/deb-src/g' /etc/apt/sources.list

RUN \
quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \
apt update ${quiet} && \
apt install -y -V ${quiet} \
build-essential \
debhelper \
devscripts \
ruby-dev \
ruby-bundler \
libedit2 \
libncurses5-dev \
libyaml-dev \
git \
pkg-config \
libssl-dev \
libpq-dev \
tar \
lsb-release \
zlib1g-dev \
cmake && \
apt build-dep -y ruby && \
apt clean && \
# raise IPv4 priority
sed -i'' -e 's,#precedence ::ffff:0:0/96 100,precedence ::ffff:0:0/96 100,' /etc/gai.conf && \
# enable multiplatform feature
gem install --no-document --install-dir /usr/share/rubygems-integration/all bundler:2.2.9 && \
rm -rf /var/lib/apt/lists/*
33 changes: 33 additions & 0 deletions td-agent/apt/ubuntu-jammy/qemu-dummy-static
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Do nothing. This exists only for not requiring qemu-aarch64-static copy.
# Recent Debian (buster or later) and Ubuntu (18.10 or later) on amd64 hosts or
# arm64 host don't require qemu-aarch64-static in Docker image. But old Debian
# and Ubuntu hosts on amd64 require qemu-aarch64-static in Docker image.
#
# We use "COPY qemu* /usr/bin/" in Dockerfile. If we don't put any "qemnu*",
# the "COPY" is failed. It means that we always require "qemu*" even if we
# use recent Debian/Ubuntu or arm64 host. If we have this dummy "qemu*" file,
# the "COPY" isn't failed. It means that we can copy "qemu*" only when we
# need.
#
# See also "script" in dev/tasks/linux-packages/azure.linux.arm64.yml.
# Azure Pipelines uses old Ubuntu (18.04).
# So we need to put "qemu-aarch64-static" into this directory.
3 changes: 3 additions & 0 deletions td-agent/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#BUNDLED_RUBY_VERSION = "3.1.2"
#BUNDLED_RUBY_SOURCE_SHA256SUM = "61843112389f02b735428b53bb64cf988ad9fb81858b8248e22e57336f24a83e"

BUNDLED_RUBY3_VERSION = "3.1.2"
BUNDLED_RUBY3_SOURCE_SHA256SUM = "61843112389f02b735428b53bb64cf988ad9fb81858b8248e22e57336f24a83e"

BUNDLED_RUBY_PATCHES = [
["ruby-2.7/0001-Removed-the-old-executables-of-racc.patch", ["~> 2.7.0"]],
["ruby-2.7/0002-Fixup-a6864f6d2f39bcd1ff04516591cc18d4027ab186.patch", ["~> 2.7.0"]],
Expand Down
4 changes: 2 additions & 2 deletions td-agent/convert-artifacts-layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ case $1 in
apt|deb)
REPOSITORY_TYPE=apt
REPOSITORY_PATH=$TD_AGENT_DIR/$REPOSITORY_TYPE/repositories
for d in buster bullseye xenial bionic focal; do
for d in buster bullseye xenial bionic focal jammy; do
case $d in
buster|bullseye)
# e.g. mapping debian/pool/buster/main/t/td-agent/ => 4/debian/buster/pool/contrib/t/td-agent
mkdir -p $ARTIFACTS_DIR/4/debian/$d/pool/contrib/t/td-agent
find $REPOSITORY_PATH/debian/pool/$d -name '*.deb' -not -name '*dbgsym*' -exec cp {} $ARTIFACTS_DIR/4/debian/$d/pool/contrib/t/td-agent \;
;;
xenial|bionic|focal)
xenial|bionic|focal|jammy)
# e.g. mapping ubuntu/pool/.../main/t/td-agent/ => 4/ubuntu/.../pool/contrib/t/td-agent
mkdir -p $ARTIFACTS_DIR/4/ubuntu/$d/pool/contrib/t/td-agent
find $REPOSITORY_PATH/ubuntu/pool/$d -name '*.deb' -exec cp {} $ARTIFACTS_DIR/4/ubuntu/$d/pool/contrib/t/td-agent \;
Expand Down
6 changes: 4 additions & 2 deletions td-agent/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export DH_RUBY = --gem-install
%:
dh $@

override_dh_makeshlibs:
:
# As aptly doesn't support zstd yet, so as a workaround, force default
# package compression to xz
override_dh_builddeb:
dh_builddeb -- -Zxz

override_dh_auto_install:
rake build:deb_config TD_AGENT_STAGING_PATH="$(CURDIR)/debian/tmp" NO_VAR_RUN=1
Expand Down
Loading