Skip to content

Commit fde0842

Browse files
authored
Merge pull request #4670 from kolyshkin/shell-spring-cleaning
Shell spring cleaning
2 parents 92d1ea4 + d31e6b8 commit fde0842

File tree

9 files changed

+10
-19
lines changed

9 files changed

+10
-19
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ task:
1212
HOME: /root
1313
CIRRUS_WORKING_DIR: /home/runc
1414
GO_VER_PREFIX: "1.24."
15-
BATS_VERSION: "v1.9.0"
15+
BATS_VERSION: "v1.11.0"
1616
RPMS: gcc git-core iptables jq glibc-static libseccomp-devel make criu fuse-sshfs container-selinux
1717
# yamllint disable rule:key-duplicates
1818
matrix:

.github/workflows/validate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ jobs:
108108
- uses: actions/checkout@v4
109109
- name: install shellcheck
110110
env:
111-
VERSION: v0.9.0
111+
VERSION: v0.10.0
112112
BASEURL: https://github.com/koalaman/shellcheck/releases/download
113-
SHA256: 7087178d54de6652b404c306233264463cb9e7a9afeb259bb663cc4dbfd64149
113+
SHA256: f35ae15a4677945428bdfe61ccc297490d89dd1e544cc06317102637638c6deb
114114
run: |
115115
mkdir ~/bin
116116
curl -sSfL --retry 5 $BASEURL/$VERSION/shellcheck-$VERSION.linux.x86_64.tar.xz |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG GO_VERSION=1.23
2-
ARG BATS_VERSION=v1.9.0
2+
ARG BATS_VERSION=v1.11.0
33
ARG LIBSECCOMP_VERSION=2.5.6
44

55
FROM golang:${GO_VERSION}-bookworm

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ shellcheck:
221221
shfmt:
222222
$(CONTAINER_ENGINE) run $(CONTAINER_ENGINE_RUN_FLAGS) \
223223
--rm -v $(CURDIR):/src -w /src \
224-
mvdan/shfmt:v3.5.1 -d -w .
224+
mvdan/shfmt:v3.11.0 -d -w .
225225

226226
.PHONY: localshfmt
227227
localshfmt:

script/setup_host_fedora.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/bash
22
set -eux -o pipefail
3-
DNF_OPTS="-y --setopt=install_weak_deps=False --setopt=tsflags=nodocs --exclude=kernel,kernel-core"
4-
RPMS="bats git-core glibc-static golang jq libseccomp-devel make"
3+
DNF=(dnf -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs --exclude="kernel,kernel-core")
4+
RPMS=(bats git-core glibc-static golang jq libseccomp-devel make)
55
# Work around dnf mirror failures by retrying a few times.
66
for i in $(seq 0 2); do
77
sleep "$i"
8-
# shellcheck disable=SC2086
9-
dnf $DNF_OPTS update && dnf $DNF_OPTS install $RPMS && break
8+
"${DNF[@]}" update && "${DNF[@]}" install "${RPMS[@]}" && break
109
done
1110
dnf clean all
1211

@@ -18,8 +17,7 @@ useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
1817

1918
# Allow root and rootless itself to execute `ssh rootless@localhost` in tests/rootless.sh
2019
ssh-keygen -t ecdsa -N "" -f /root/rootless.key
21-
# shellcheck disable=SC2174
22-
mkdir -m 0700 -p /home/rootless/.ssh
20+
mkdir -m 0700 /home/rootless/.ssh
2321
cp /root/rootless.key /home/rootless/.ssh/id_ecdsa
2422
cat /root/rootless.key.pub >>/home/rootless/.ssh/authorized_keys
2523
chown -R rootless.rootless /home/rootless

tests/integration/hooks.bats

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function teardown() {
2121
@test "runc create [hook fails]" {
2222
for hook in prestart createRuntime createContainer; do
2323
echo "testing hook $hook"
24-
# shellcheck disable=SC2016
2524
update_config '.hooks |= {"'$hook'": [{"path": "/bin/true"}, {"path": "/bin/false"}]}'
2625
runc create --console-socket "$CONSOLE_SOCKET" test_hooks
2726
[ "$status" -ne 0 ]
@@ -34,7 +33,6 @@ function teardown() {
3433
# All hooks except Poststop.
3534
for hook in prestart createRuntime createContainer startContainer poststart; do
3635
echo "testing hook $hook"
37-
# shellcheck disable=SC2016
3836
update_config '.hooks |= {"'$hook'": [{"path": "/bin/true"}, {"path": "/bin/false"}]}'
3937
runc run "test_hook-$hook"
4038
[[ "$output" != "Hello World" ]]

tests/integration/run.bats

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ function teardown() {
8484
chmod 'a=rwx,ug+s,+t' rootfs/tmp # set all bits
8585
mode=$(stat -c %A rootfs/tmp)
8686

87-
# shellcheck disable=SC2016
8887
update_config '.process.args = ["sh", "-c", "stat -c %A /tmp"]'
8988
update_config '.mounts += [{"destination": "/tmp", "type": "tmpfs", "source": "tmpfs", "options":["noexec","nosuid","nodev","rprivate"]}]'
9089

@@ -94,7 +93,6 @@ function teardown() {
9493
}
9594

9695
@test "runc run with tmpfs perms" {
97-
# shellcheck disable=SC2016
9896
update_config '.process.args = ["sh", "-c", "stat -c %a /tmp/test"]'
9997
update_config '.mounts += [{"destination": "/tmp/test", "type": "tmpfs", "source": "tmpfs", "options": ["mode=0444"]}]'
10098

@@ -113,14 +111,12 @@ function teardown() {
113111
# so it should use the directory's perms.
114112
update_config '.mounts[-1].options = []'
115113
chmod 0710 rootfs/tmp/test
116-
# shellcheck disable=SC2016
117114
runc run test_tmpfs
118115
[ "$status" -eq 0 ]
119116
[ "${lines[0]}" = "710" ]
120117

121118
# Add back the mode on the mount, and it should use that instead.
122119
# Just for fun, use different perms than was used earlier.
123-
# shellcheck disable=SC2016
124120
update_config '.mounts[-1].options = ["mode=0410"]'
125121
runc run test_tmpfs
126122
[ "$status" -eq 0 ]

tests/integration/seccomp-notify.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function scmp_act_notify_template() {
183183
@test "runc run [seccomp] (SCMP_ACT_NOTIFY startContainer hook)" {
184184
# shellcheck disable=SC2016
185185
# We use single quotes to properly delimit the $1 param to
186-
# update_config(), but this shellshcheck is quite silly and fails if the
186+
# update_config(), but shellcheck is quite silly and fails if the
187187
# multi-line string includes some $var (even when it is properly outside of the
188188
# single quotes) or when we use this syntax to execute commands in the
189189
# string: $(command).

tests/integration/tty.bats

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function teardown() {
123123

124124
# replace "uid": 0 with "uid": 1000
125125
# and do a similar thing for gid.
126-
# shellcheck disable=SC2016
127126
update_config ' (.. | select(.uid? == 0)) .uid |= 1000
128127
| (.. | select(.gid? == 0)) .gid |= 100'
129128

0 commit comments

Comments
 (0)