Skip to content

Commit 02fe02d

Browse files
committed
[GR-18163] Docker fixes for 21.2
PullRequest: truffleruby/2826
2 parents 00b825c + fd85368 commit 02fe02d

File tree

4 files changed

+75
-34
lines changed

4 files changed

+75
-34
lines changed

doc/contributor/docker.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jt docker test --graalvm graalvm-ee.tar.gz llvm-toolchain-installable.jar:ruby-i
2222
jt docker test --standalone truffleruby-linux-amd64.tar.gz --test release_branch
2323
```
2424

25-
## Distributions
25+
To run tests on a specific distribution:
26+
```bash
27+
DOCKER=podman jt docker build --ubuntu1804 --standalone ~/Downloads/truffleruby-21.2.0-linux-amd64.tar.gz --test release/graal-vm/21.2
28+
```
2629

27-
Pick one of:
30+
## Distributions
2831

29-
* Oracle Linux 7, `--ol7` (default)
30-
* Ubuntu 18.04 `--ubuntu1804`
31-
* Ubuntu 16.04 `--ubuntu1604`
32-
* Fedora 28, `--fedora28`
32+
Pick one of the distributions in [docker-configs.yaml](../../tool/docker-configs.yaml).
3333

3434
## Methods of installing
3535

tool/docker-configs.yaml

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,66 @@
1-
rpm_packages: &rpm_packages
2-
locale:
1+
rpm: &rpm
32
tar: tar gzip
43
specs: which findutils
54
zlib: zlib-devel
65
openssl: openssl-devel
76
cext: gcc make
7+
set-locale:
8+
- ENV LANG=en_US.UTF-8
89

9-
deb_packages: &deb_packages
10+
deb: &deb
1011
locale: locales
1112
tar:
1213
specs: netbase
1314
zlib: libz-dev
1415
openssl: libssl-dev
1516
cext: gcc make
17+
set-locale:
18+
# Uncomment the en_US.UTF-8 line in /etc/locale.gen
19+
- RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen
20+
# locale-gen generates locales for all uncommented locales in /etc/locale.gen
21+
- RUN locale-gen
22+
- ENV LANG=en_US.UTF-8
1623

1724
ol7:
1825
base: oraclelinux:7-slim
19-
set-locale:
20-
- ENV LANG=en_US.UTF-8
2126
install: RUN yum install -y
22-
<<: *rpm_packages
27+
locale:
28+
<<: *rpm
29+
30+
ol8:
31+
base: oraclelinux:8-slim
32+
install: RUN microdnf install -y
33+
locale: glibc-langpack-en
34+
<<: *rpm
2335

2436
fedora28:
2537
base: fedora:28
26-
set-locale:
27-
- ENV LANG=en_US.UTF-8
2838
install: RUN dnf install -y
29-
<<: *rpm_packages
39+
locale:
40+
<<: *rpm
41+
42+
fedora34:
43+
base: fedora:34
44+
install: RUN dnf install -y
45+
locale: glibc-langpack-en
46+
<<: *rpm
47+
48+
ubuntu2004:
49+
base: ubuntu:20.04
50+
install: RUN apt-get update && apt-get install -y
51+
<<: *deb
3052

3153
ubuntu1804:
3254
base: ubuntu:18.04
33-
set-locale:
34-
- RUN locale-gen en_US.UTF-8
35-
- ENV LANG=en_US.UTF-8
3655
install: RUN apt-get update && apt-get install -y
37-
<<: *deb_packages
56+
<<: *deb
3857

3958
ubuntu1604:
4059
base: ubuntu:16.04
41-
set-locale:
42-
- RUN locale-gen en_US.UTF-8
43-
- ENV LANG=en_US.UTF-8
4460
install: RUN apt-get update && apt-get install -y
45-
<<: *deb_packages
61+
<<: *deb
62+
63+
debian10:
64+
base: debian:buster
65+
install: RUN apt-get update && apt-get install -y
66+
<<: *deb

tool/docker.rb

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'yaml'
2+
13
class JT
24
class Docker
35
include Utilities
@@ -18,6 +20,14 @@ def docker(*args)
1820
end
1921
end
2022

23+
private def docker_config
24+
@config ||= YAML.load_file(File.join(TRUFFLERUBY_DIR, 'tool', 'docker-configs.yaml'))
25+
end
26+
27+
private def docker_distros
28+
docker_config.each_pair.select { |_name, details| details.key?('base') }.map(&:first).map { |distro| "--#{distro}" }
29+
end
30+
2131
private def docker_build(*args)
2232
if args.first.nil? || args.first.start_with?('--')
2333
image_name = 'truffleruby-test'
@@ -30,7 +40,7 @@ def docker(*args)
3040
end
3141

3242
private def docker_test(*args)
33-
distros = ['--ol7', '--ubuntu1804', '--ubuntu1604', '--fedora28']
43+
distros = docker_distros
3444

3545
distros.each do |distro|
3646
puts '**********************************'
@@ -50,10 +60,9 @@ def docker(*args)
5060
end
5161

5262
private def dockerfile(*args)
53-
require 'yaml'
54-
config = @config ||= YAML.load_file(File.join(TRUFFLERUBY_DIR, 'tool', 'docker-configs.yaml'))
63+
config = docker_config
5564

56-
distro = 'ol7'
65+
distro_name = 'ol7'
5766
install_method = nil
5867
rebuild_images = false
5968
rebuild_openssl = true
@@ -65,8 +74,8 @@ def docker(*args)
6574
until args.empty?
6675
arg = args.shift
6776
case arg
68-
when '--ol7', '--ubuntu1804', '--ubuntu1604', '--fedora28'
69-
distro = arg[2..-1]
77+
when *docker_distros
78+
distro_name = arg[2..-1]
7079
when '--graalvm'
7180
install_method = :graalvm
7281
graalvm_tarball = args.shift
@@ -93,7 +102,7 @@ def docker(*args)
93102
end
94103
end
95104

96-
distro = config.fetch(distro)
105+
distro = config.fetch(distro_name)
97106
run_post_install_hook = rebuild_openssl
98107

99108
packages = []
@@ -107,9 +116,12 @@ def docker(*args)
107116
packages << distro.fetch('cext')
108117

109118
proxy_vars = []
110-
%w[http_proxy https_proxy no_proxy].each do |var|
111-
value = ENV[var]
112-
proxy_vars << "ENV #{var}=#{value}" if value
119+
# There is an issue with dnf + proxy in Fedora 34, install packages outside proxy to workaround
120+
unless distro_name == 'fedora34'
121+
%w[http_proxy https_proxy no_proxy].each do |var|
122+
value = ENV[var]
123+
proxy_vars << "ENV #{var}=#{value}" if value
124+
end
113125
end
114126

115127
lines = [
@@ -119,6 +131,9 @@ def docker(*args)
119131
*distro.fetch('set-locale'),
120132
]
121133

134+
# Check the locale is properly generated
135+
lines << 'RUN locale -a | grep en_US.utf8'
136+
122137
lines << 'WORKDIR /test'
123138

124139
lines << 'RUN useradd -ms /bin/bash test'
@@ -181,7 +196,8 @@ def docker(*args)
181196

182197
unless print_only
183198
chdir(docker_dir) do
184-
raw_sh 'git', 'clone', '--branch', test_branch, TRUFFLERUBY_DIR, 'truffleruby-tests'
199+
branch_args = test_branch == 'current' ? [] : ['--branch', test_branch]
200+
raw_sh 'git', 'clone', *branch_args, TRUFFLERUBY_DIR, 'truffleruby-tests'
185201
test_files.each do |file|
186202
FileUtils.cp_r "truffleruby-tests/#{file}", '.'
187203
end
@@ -241,6 +257,7 @@ def docker(*args)
241257

242258
%w[:command_line :security :language :core :library :capi :library_cext :truffle :truffle_capi].each do |set|
243259
t_config = c.empty? ? '' : '-T' + c
260+
t_config << ' -T--experimental-options -T--pattern-matching'
244261
t_excludes = excludes.map { |e| '--excl-tag ' + e }.join(' ')
245262
lines << "RUN ruby spec/mspec/bin/mspec -t #{ruby_bin}/ruby #{t_config} #{t_excludes} #{set}"
246263
end

tool/jt.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,9 @@ def rubocop(*args)
23172317

23182318
def idea(*args)
23192319
ENV['ECLIPSE_EXE'] ||= install_eclipse
2320+
if args.empty?
2321+
args = %w[--dy /substratevm,/tools,/vm]
2322+
end
23202323
mx(*args, 'intellijinit')
23212324
end
23222325

0 commit comments

Comments
 (0)