Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ COPY stage_binaries.sh /
RUN /stage_binaries.sh -o {ARG_STAGING} \
-p base-files \
-p bash \
-p ca-certificates \
-p coreutils \
-p curl \
-p git \
-p gzip \
-p openssh-client \
-p ca-certificates \
-p curl \
-p socat \
-p tar \
-b /bin/grep \
-b /bin/sed \
-f /etc/debian_version \
Expand Down
20 changes: 20 additions & 0 deletions _test_tools/exechook_command_git_archive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
#
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Use for e2e test of --exechook-command.
# This option takes no command arguments, so requires a wrapper script.

git archive --format tar.gz --output archive.tgz HEAD
21 changes: 21 additions & 0 deletions test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ function assert_file_lines_ge() {
fi
}

function assert_tgz_archive() {
if ! tar tzf "$1"; then
fail "failed to list tgz archive content in $1"
fi
}

function assert_metric_eq() {
local val
val="$(curl --silent "http://localhost:$HTTP_PORT/metrics" \
Expand Down Expand Up @@ -317,6 +323,7 @@ EXECHOOK_COMMAND="$TEST_TOOLS/exechook_command.sh"
EXECHOOK_COMMAND_FAIL="$TEST_TOOLS/exechook_command_fail.sh"
EXECHOOK_COMMAND_SLEEPY="$TEST_TOOLS/exechook_command_with_sleep.sh"
EXECHOOK_COMMAND_FAIL_SLEEPY="$TEST_TOOLS/exechook_command_fail_with_sleep.sh"
EXECHOOK_COMMAND_GIT_ARCHIVE="$TEST_TOOLS/exechook_command_git_archive.sh"
EXECHOOK_ENVKEY=ENVKEY
EXECHOOK_ENVVAL=envval
RUNLOG="$DIR/runlog"
Expand Down Expand Up @@ -3602,6 +3609,20 @@ function e2e::gc_off() {
assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]}"
}

##############################################
# Test git-archive using tar and gzip
##############################################
function e2e::exechook_git_archive() {
GIT_SYNC \
--one-time \
--repo="file://$REPO" \
--root="$ROOT" \
--link="link" \
--exechook-command="/$EXECHOOK_COMMAND_GIT_ARCHIVE"
assert_file_exists "$ROOT/link/archive.tgz"
assert_tgz_archive "$ROOT/link/archive.tgz"
}

#
# main
#
Expand Down
Loading