File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed
Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -56,12 +56,14 @@ COPY stage_binaries.sh /
5656RUN /stage_binaries.sh -o {ARG_STAGING} \
5757 -p base-files \
5858 -p bash \
59+ -p ca-certificates \
5960 -p coreutils \
61+ -p curl \
6062 -p git \
63+ -p gzip \
6164 -p openssh-client \
62- -p ca-certificates \
63- -p curl \
6465 -p socat \
66+ -p tar \
6567 -b /bin/grep \
6668 -b /bin/sed \
6769 -f /etc/debian_version \
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ #
3+ # Copyright 2020 The Kubernetes Authors.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ # Use for e2e test of --exechook-command.
18+ # This option takes no command arguments, so requires a wrapper script.
19+
20+ git archive --format tar.gz --output archive.tgz HEAD
Original file line number Diff line number Diff line change @@ -122,6 +122,12 @@ function assert_file_lines_ge() {
122122 fi
123123}
124124
125+ function assert_tgz_archive() {
126+ if ! tar tzf " $1 " ; then
127+ fail " failed to list tgz archive content in $1 "
128+ fi
129+ }
130+
125131function assert_metric_eq() {
126132 local val
127133 val=" $( curl --silent " http://localhost:$HTTP_PORT /metrics" \
@@ -317,6 +323,7 @@ EXECHOOK_COMMAND="$TEST_TOOLS/exechook_command.sh"
317323EXECHOOK_COMMAND_FAIL=" $TEST_TOOLS /exechook_command_fail.sh"
318324EXECHOOK_COMMAND_SLEEPY=" $TEST_TOOLS /exechook_command_with_sleep.sh"
319325EXECHOOK_COMMAND_FAIL_SLEEPY=" $TEST_TOOLS /exechook_command_fail_with_sleep.sh"
326+ EXECHOOK_COMMAND_GIT_ARCHIVE=" $TEST_TOOLS /exechook_command_git_archive.sh"
320327EXECHOOK_ENVKEY=ENVKEY
321328EXECHOOK_ENVVAL=envval
322329RUNLOG=" $DIR /runlog"
@@ -3604,6 +3611,20 @@ function e2e::gc_off() {
36043611 assert_file_eq " $ROOT /link/file" " ${FUNCNAME[0]} "
36053612}
36063613
3614+ # #############################################
3615+ # Test git-archive using tar and gzip
3616+ # #############################################
3617+ function e2e::exechook_git_archive() {
3618+ GIT_SYNC \
3619+ --one-time \
3620+ --repo=" file://$REPO " \
3621+ --root=" $ROOT " \
3622+ --link=" link" \
3623+ --exechook-command=" /$EXECHOOK_COMMAND_GIT_ARCHIVE "
3624+ assert_file_exists " $ROOT /link/archive.tgz"
3625+ assert_tgz_archive " $ROOT /link/archive.tgz"
3626+ }
3627+
36073628#
36083629# main
36093630#
You can’t perform that action at this time.
0 commit comments