Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit bd752ed

Browse files
authored
PR #1615: GitHub CI cleanups
1 parent 9c89371 commit bd752ed

File tree

15 files changed

+90
-80
lines changed

15 files changed

+90
-80
lines changed

.github/workflows/main.yml

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,22 @@ jobs:
1414
strategy:
1515
fail-fast: false # Actions seems kind of flaky lately
1616
matrix:
17-
builder: [none, docker, ch-image]
17+
builder:
18+
- ch-image
1819
pack_fmt: [squash-mount, tar-unpack, squash-unpack]
1920
keep_sudo: # if false, remove self from sudoers post-install/setup
2021
- false
21-
cache: [enabled, disabled]
22-
exclude:
22+
cache:
23+
- enabled
24+
include:
2325
- builder: none
24-
cache: enabled
25-
- builder: docker
26-
cache: enabled
27-
- builder: ch-image
26+
pack_fmt: squash-mount
27+
keep_sudo: false
2828
cache: disabled
29-
include:
3029
- builder: docker
31-
pack_fmt: squash-mount
30+
pack_fmt: tar-unpack
3231
keep_sudo: true
33-
cache: disabled
32+
cache: enabled
3433
- builder: ch-image
3534
pack_fmt: squash-mount
3635
keep_sudo: false
@@ -65,8 +64,8 @@ jobs:
6564
echo "PATH=$path_new" >> $GITHUB_ENV
6665
# Set sudo umask to something quite restrictive. The default is
6766
# 0022, but we had a "make install" bug (issue #947) that was
68-
# tickled by 0027, which is a better setting. For reasons I don't
69-
# understand, this only affects sudo, but since that's what we want,
67+
# tickled by 0027, which is a better setting. For reasons I dont
68+
# understand, this only affects sudo, but since thats what we want,
7069
# I left it. Note there are a few dependency installs below that
7170
# have similar permissions bugs; these relax the umask on a
7271
# case-by-case basis.
@@ -104,7 +103,7 @@ jobs:
104103
105104
- name: install/configure dependencies, all
106105
run: |
107-
# configure doesn't tell us about these.
106+
# configure doesnt tell us about these.
108107
sudo apt-get install attr pigz pv
109108
# configure does tell us about these.
110109
sudo apt-get install bats squashfs-tools
@@ -162,7 +161,6 @@ jobs:
162161
sudo ldconfig
163162
# Unset setuid on all fusermount3(1) on the system.
164163
sudo chmod -v u-s /usr/bin/fusermount*
165-
sudo find / -name 'fusermount*' -ls
166164
ls -lh $(command -v fusermount3)
167165
[[ ! -u $(command -v fusermount3) ]]
168166
@@ -172,7 +170,7 @@ jobs:
172170
run: |
173171
sudo apt-get install -y musl-tools
174172
# At present we use argp to parse command line arguments. This is
175-
# not portable; it's a glibc extension (see #1260). Thus, install a
173+
# not portable; its a glibc extension (see #1260). Thus, install a
176174
# standalone argp.
177175
cd /usr/local/src
178176
git clone --depth=1 https://github.com/ericonr/argp-standalone.git
@@ -211,7 +209,9 @@ jobs:
211209
sudo usermod --add-subgids 10000-65536 $USER
212210
213211
- name: disable bundled lark, ch-image
214-
if: ${{ matrix.builder == 'ch-image' && matrix.cache == 'disabled' }}
212+
if: ${{ matrix.builder == 'ch-image'
213+
&& matrix.pack_fmt == 'squash-mount'
214+
&& matrix.cache == 'disabled' }}
215215
run: |
216216
set -x
217217
# no install, disable
@@ -255,7 +255,7 @@ jobs:
255255
# workflow also use glibc.
256256
if [[ $CH_TEST_PACK_FMT == tar-unpack ]]; then
257257
export CC=musl-gcc
258-
# GNU ldd(1) doesn't work on musl binaries.
258+
# GNU ldd(1) doesnt work on musl binaries.
259259
LDD='/lib/ld-musl-x86_64.so.1 --list'
260260
else
261261
LDD=ldd
@@ -330,23 +330,10 @@ jobs:
330330
-v ~/registry-etc:/etc/docker/registry registry:2
331331
docker ps -a
332332
333-
- name: configure sudo to user root, group non-root
334-
if: ${{ matrix.keep_sudo }}
335-
run: |
336-
sudo sed -Ei 's/=\(ALL\)/=(ALL:ALL)/g' /etc/sudoers.d/runner
337-
sudo cat /etc/sudoers.d/runner
338-
339-
- name: remove sudo
340-
if: ${{ ! matrix.keep_sudo }}
341-
run: |
342-
sudo rm /etc/sudoers.d/runner
343-
! sudo echo hello
344-
345333
- name: build/install from tarball
346-
if: ${{ matrix.builder == 'docker' && matrix.keep_sudo }}
347334
run: |
348335
# Create and unpack tarball. The wildcard saves us having to put the
349-
# version in a variable. This assumes there isn't already a tarball
336+
# version in a variable. This assumes there isnt already a tarball
350337
# or unpacked directory in $ch_prefix, which is true on the clean
351338
# VMs GitHub gives us. Note that cd fails if it gets more than one
352339
# argument, which helps, but this is probably kind of brittle.
@@ -380,29 +367,38 @@ jobs:
380367
bin/ch-run --version
381368
$ch_prefix/from-tarball/bin/ch-run --version
382369
383-
- name: run test suite (Git WD, quick)
384-
if: ${{ matrix.builder == 'docker' && ! matrix.keep_sudo }}
370+
- name: configure sudo to user root, group non-root
371+
if: ${{ matrix.keep_sudo }}
385372
run: |
386-
bin/ch-test --scope=quick all
373+
sudo sed -Ei 's/=\(ALL\)/=(ALL:ALL)/g' /etc/sudoers.d/runner
374+
sudo cat /etc/sudoers.d/runner
375+
376+
- name: remove sudo
377+
if: ${{ ! matrix.keep_sudo }}
378+
run: |
379+
sudo rm /etc/sudoers.d/runner
380+
! sudo echo hello
387381
388382
- name: run test suite (Git WD, standard)
389383
run: |
390384
bin/ch-test all
391385
392386
- name: run test suite (installed from Git WD, standard)
393-
if: ${{ ( matrix.builder == 'docker' && ! matrix.keep_sudo )
394-
|| ( matrix.builder == 'ch-image'
395-
&& matrix.cache == 'disabled' ) }}
387+
if: ${{ matrix.builder == 'ch-image'
388+
&& matrix.pack_fmt == 'squash-mount'
389+
&& matrix.cache == 'enabled' }}
396390
run: |
397391
$ch_prefix/from-git/bin/ch-test all
398392
399393
- name: run test suite (installed from tarball, standard)
400-
if: ${{ matrix.builder == 'docker' && matrix.keep_sudo }}
394+
if: ${{ matrix.builder == 'ch-image'
395+
&& matrix.pack_fmt == 'squash-mount'
396+
&& matrix.cache == 'enabled' }}
401397
run: |
402398
$ch_prefix/from-tarball/bin/ch-test all
403399
404-
- name: make uninstall
405-
if: ${{ matrix.builder == 'docker' && matrix.keep_sudo }}
400+
- name: uninstall from tarball
401+
if: ${{ matrix.keep_sudo }}
406402
run: |
407403
cd $ch_prefix/charliecloud-*
408404
sudo make uninstall
@@ -419,7 +415,7 @@ jobs:
419415
EOF
420416
421417
- name: rebuild with most things --disable’d
422-
if: ${{ matrix.builder == 'docker' && ! matrix.keep_sudo }}
418+
if: ${{ matrix.builder == 'docker' }}
423419
run: |
424420
make distclean
425421
./configure --prefix=/doesnotexist \
@@ -438,31 +434,29 @@ jobs:
438434
bin/ch-run --version
439435
440436
- name: run test suite (Git WD, standard)
441-
if: ${{ matrix.builder == 'docker' && ! matrix.keep_sudo }}
437+
if: ${{ matrix.builder == 'docker' }}
442438
run: |
443439
bin/ch-test all
444440
445441
- name: remove non-essential dependencies
446-
if: ${{ matrix.builder == 'docker' && matrix.keep_sudo && matrix.pack_fmt == 'tar-unpack' }}
442+
if: ${{ matrix.builder == 'docker' }}
447443
run: |
448444
set -x
449445
# This breaks lots of dependencies unrelated to our build but YOLO.
450446
sudo dpkg --remove --force-depends \
451447
pigz \
452448
pv \
453449
python3-requests \
454-
squashfs-tools \
450+
squashfs-tools
455451
sudo pip3 uninstall -y sphinx sphinx-rtd-theme
456452
if [[ ${{ matrix.pack_fmt }} = squash-mount ]]; then
457-
( cd /usr/local/src/squashfuse && make uninstall )
453+
( cd /usr/local/src/squashfuse && sudo make uninstall )
458454
fi
459455
! python3 -c 'import requests'
460456
! python3 -c 'import lark'
461-
test -e bin/ch-image
462-
bin/ch-test -f test/build/10_sanity.bats # issue #806
463457
464458
- name: rebuild
465-
if: ${{ matrix.builder == 'docker' && matrix.keep_sudo && matrix.pack_fmt == 'tar-unpack' }}
459+
if: ${{ matrix.builder == 'docker' }}
466460
run: |
467461
make distclean
468462
./configure --prefix=/doesnotexist
@@ -478,7 +472,7 @@ jobs:
478472
bin/ch-run --version
479473
480474
- name: run test suite (Git WD, standard)
481-
if: ${{ matrix.builder == 'docker' && matrix.keep_sudo && matrix.pack_fmt == 'tar-unpack' }}
475+
if: ${{ matrix.builder == 'docker' }}
482476
run: |
483477
bin/ch-test all
484478

examples/Dockerfile.centos_7ch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ch-test-scope: standard
1+
# ch-test-scope: full
22
FROM centos:7
33

44
# This image has two purposes: (1) demonstrate we can build a CentOS 7 image

lib/charliecloud.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,15 @@
1919
import time
2020
import traceback
2121

22-
import filesystem as fs
23-
import registry as rg
24-
import version
25-
26-
# Compatibility link. Sometimes we load pickled data from when Path was
27-
# defined in this file. This alias lets us still load such pickles.
28-
Path = fs.Path
2922

23+
# List of dependency problems. This variable needs to be created before we
24+
# import any other Charliecloud stuff to avoid #806.
25+
depfails = []
3026

31-
## Hairy imports ##
3227

33-
# List of dependency problems.
34-
depfails = []
28+
import filesystem as fs
29+
import registry as rg
30+
import version
3531

3632

3733
## Enums ##
@@ -104,6 +100,10 @@ class Download_Mode(enum.Enum):
104100

105101
## Globals ##
106102

103+
# Compatibility link. Sometimes we load pickled data from when Path was
104+
# defined in this file. This alias lets us still load such pickles.
105+
Path = fs.Path
106+
107107
# Active architecture (both using registry vocabulary)
108108
arch = None # requested by user
109109
arch_host = None # of host

misc/loc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Dockerfile
8989
filename Dockerfile.nvidia
9090
filename Dockerfile.ocimanifest
9191
filename Dockerfile.openmpi
92+
filename Dockerfile.quick
9293
3rd_gen_scale 2.00
9394
end_of_line_continuation \\$
9495
m4

test/Dockerfile.quick

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Minimal test image to exercise a Dockerfile build in quick scope.
2+
# ch-test-scope: quick
3+
4+
FROM alpine:3.17
5+
RUN apk add bc

test/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ testdir = $(pkglibexecdir)/test
44
testfiles = \
55
.dockerignore \
66
Dockerfile.argenv \
7+
Dockerfile.quick \
78
approved-trailing-whitespace \
89
bucache/a.df \
910
bucache/a-fail.df \

test/build/10_sanity.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ load ../common
128128
}
129129

130130
@test 'proxy variables' {
131-
scope quick
131+
scope standard
132132
# Proxy variables are a mess on UNIX. There are a lot them, and different
133133
# programs use them inconsistently. This test is based on the assumption
134134
# that if one of the proxy variables are set, then they all should be, in

test/build/50_dockerfile.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ EOF
564564

565565
# test that it works with python3
566566
run build_ -t tmpimg -f - . <<'EOF'
567-
FROM centos_7ch
567+
FROM almalinux_8ch
568568
SHELL ["/usr/bin/python3", "-c"]
569569
RUN print ("hello")
570570
EOF

test/build/55_cache.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ EOF
246246
* (HEAD -> root) ROOT
247247
EOF
248248
)
249-
ch-image --rebuild build -t c -f bucache/c.df .
250249
# avoid race condition
251250
sleep 1
251+
ch-image --rebuild build -t c -f bucache/c.df .
252252
run ch-image build-cache --tree
253253
[[ $status -eq 0 ]]
254254
diff -u <(echo "$blessed_out") <(echo "$output" | treeonly)

test/force-auto.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ class Test(abc.ABC):
122122
print(f"\n# skip: {self}: --force=%s excluded" % self.force)
123123
return
124124
# scope
125-
if (self.scope == Scope.STANDARD or self.run == Run.NEEDED):
125+
if ( (self.scope == Scope.STANDARD or self.run == Run.NEEDED)
126+
and self.force != "fakeroot"):
126127
scope = "standard"
127128
else:
128129
scope = "full"

0 commit comments

Comments
 (0)