File tree Expand file tree Collapse file tree
crates/buzz-relay/src/api/git Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,7 +77,9 @@ LABEL org.opencontainers.image.title="Buzz" \
7777RUN apt-get update \
7878 && apt-get install -y --no-install-recommends \
7979 ca-certificates \
80+ curl \
8081 git \
82+ openssl \
8183 && rm -rf /var/lib/apt/lists/* \
8284 && groupadd --system --gid 1000 buzz \
8385 && useradd --system --uid 1000 --gid 1000 --home-dir /var/lib/buzz \
Original file line number Diff line number Diff line change @@ -176,3 +176,32 @@ pub async fn install_hook(repo_path: &Path) -> anyhow::Result<()> {
176176 info ! ( repo = %repo_path. display( ) , "pre-receive hook installed" ) ;
177177 Ok ( ( ) )
178178}
179+
180+ #[ cfg( test) ]
181+ mod tests {
182+ use super :: PRE_RECEIVE_HOOK ;
183+
184+ #[ test]
185+ fn runtime_image_installs_pre_receive_hook_tools ( ) {
186+ let dockerfile = include_str ! ( "../../../../../Dockerfile" ) ;
187+ let runtime_stage = dockerfile
188+ . split ( "FROM debian:${DEBIAN_VERSION}-slim AS runtime" )
189+ . nth ( 1 )
190+ . expect ( "Dockerfile should have a runtime stage" ) ;
191+ let runtime_setup = runtime_stage
192+ . split ( "COPY --from=builder" )
193+ . next ( )
194+ . expect ( "runtime stage should copy built artifacts after package setup" ) ;
195+
196+ for tool in [ "curl" , "openssl" ] {
197+ assert ! (
198+ PRE_RECEIVE_HOOK . contains( tool) ,
199+ "test setup expected the pre-receive hook to invoke {tool}"
200+ ) ;
201+ assert ! (
202+ runtime_setup. contains( & format!( "\n {tool} \\ " ) ) ,
203+ "relay runtime image must install {tool}; the git pre-receive hook uses it and fails closed without it"
204+ ) ;
205+ }
206+ }
207+ }
You can’t perform that action at this time.
0 commit comments