Repository navigation
Expand file tree
/
Copy pathtini.yaml
More file actions
157 lines (135 loc) · 4.45 KB
/
Copy pathtini.yaml
File metadata and controls
157 lines (135 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package:
name: tini
version: 0.19.0
epoch: 26 # glibc: 2.43->2.44
description: A tiny but valid init for containers
copyright:
- license: MIT
dependencies:
provides:
- tini-compat=${{package.full-version}}
runtime:
- merged-sbin
- wolfi-baselayout
resources:
cpu: "1"
memory: 2Gi
environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- cmake
- glibc-2.44-dev
- samurai
environment:
CFLAGS: -Wno-error=sign-conversion -Wno-error=hardened
pipeline:
- uses: git-checkout
with:
expected-commit: de40ad007797e0dcd8b7126f27bb87401d224240
repository: https://github.com/krallin/tini
tag: v${{package.version}}
cherry-picks: |
master/0b44d3665869e46ccbac7414241b8256d6234dc4: chore: bump minimum CMake to 2.8.12
master/071c715e376e9ee0ac1a196fe8c38bcb61ad385c: chore: allow CMake though to 3.10
- runs: |
export CFLAGS="$CFLAGS -DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=None
cmake --build build --target all tini-static
- runs: |
install -Dm755 build/tini ${{targets.destdir}}/usr/bin/tini
subpackages:
- name: tini-static
pipeline:
- runs: install -Dm755 build/tini-static ${{targets.subpkgdir}}/usr/bin/tini-static
description: Static build of tini
dependencies:
runtime:
- merged-sbin
- wolfi-baselayout
test:
pipeline:
- uses: test/tw/contains-files
with:
dir: /usr/bin
name: tini-static
- name: Test tini-static spawns and manages child process
runs: |
set -euo pipefail
# Verify tini-static can spawn a child and capture its output
output=$(tini-static -- echo "hello from tini-static")
echo "$output" | grep -F "hello from tini-static"
# Verify tini-static forwards child exit code (success)
tini-static -- true
# Verify tini-static forwards child exit code (failure)
if tini-static -- false; then
echo "FAIL: tini-static should forward non-zero exit code from child"
exit 1
fi
# Verify tini-static can run a shell command via sh -c
result=$(tini-static -- sh -c 'echo "computed: $((2 + 3))"')
echo "$result" | grep -F "computed: 5"
update:
enabled: true
github:
identifier: krallin/tini
strip-prefix: v
use-tag: true
test:
pipeline:
# AUTOGENERATED
- runs: |
tini --version
- name: Test tini spawns and manages child process
runs: |
set -euo pipefail
# Verify tini can spawn a child process and capture its output
output=$(tini -- echo "hello from tini")
echo "$output" | grep -F "hello from tini"
# Verify tini can run a shell command via sh -c
result=$(tini -- sh -c 'echo "computed: $((2 + 3))"')
echo "$result" | grep -F "computed: 5"
- name: Test tini forwards exit codes from child processes
runs: |
set -euo pipefail
# Child exits 0 - tini should also exit 0
tini -- true
# Child exits non-zero - tini should forward the exit code
if tini -- false; then
echo "FAIL: tini should forward non-zero exit code from child"
exit 1
fi
# Verify specific exit code is forwarded
set +e
tini -- sh -c 'exit 42'
rc=$?
set -e
if [ "$rc" -ne 42 ]; then
echo "FAIL: Expected exit code 42, got $rc"
exit 1
fi
- name: Test tini forwards signals to child processes
runs: |
set -euo pipefail
# Start tini with a long-running child process
tini -- sleep 300 &
tini_pid=$!
# Give tini time to start and spawn the child
sleep 1
# Verify tini and child are running
kill -0 "$tini_pid"
# Send SIGTERM to tini - it should forward to child and both should exit
kill -TERM "$tini_pid"
# Wait for tini to exit (with timeout)
timeout=10
while kill -0 "$tini_pid" 2>/dev/null; do
timeout=$((timeout - 1))
if [ "$timeout" -le 0 ]; then
echo "FAIL: tini did not exit after SIGTERM within timeout"
exit 1
fi
sleep 1
done
echo "SUCCESS: tini forwarded SIGTERM and exited"