-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathintegration-test.sh
More file actions
executable file
·91 lines (76 loc) · 2.67 KB
/
Copy pathintegration-test.sh
File metadata and controls
executable file
·91 lines (76 loc) · 2.67 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
#!/usr/bin/env bash
# Copyright 2018 Google LLC
#
# 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.
set -e
function start_local_registry {
docker start registry 2>/dev/null || docker run --name registry -d -p 5000:5000 registry:2
}
function start_local_auth_server {
local dir="/tmp/kaniko-tls-registry"
"$(dirname "$0")/setup-tls-registry-creds.sh"
if ! docker start kaniko-auth-server 2>/dev/null; then
docker rm -f kaniko-auth-server 2>/dev/null || true
docker run -d --name kaniko-auth-server \
-p 5002:5002 \
-v "${dir}/tls.crt:/certs/tls.crt:ro" \
-v "${dir}/tls.key:/certs/tls.key:ro" \
-v "${dir}/auth_config.yml:/config/auth_config.yml:ro" \
cesanta/docker_auth:1 /config/auth_config.yml
fi
}
function start_local_tls_registry {
local dir="/tmp/kaniko-tls-registry"
if ! docker start kaniko-tls-registry 2>/dev/null; then
docker rm -f kaniko-tls-registry 2>/dev/null || true
docker run -d --name kaniko-tls-registry \
-p 127.0.0.2:5001:5000 \
-v "${dir}/tls.crt:/certs/tls.crt:ro" \
-v "${dir}/tls.key:/certs/tls.key:ro" \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/tls.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/tls.key \
-e REGISTRY_AUTH=token \
-e REGISTRY_AUTH_TOKEN_REALM=https://localhost:5002/auth \
-e REGISTRY_AUTH_TOKEN_SERVICE=kaniko-test-registry \
-e REGISTRY_AUTH_TOKEN_ISSUER=kaniko-test-auth \
-e REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/certs/tls.crt \
registry:2
fi
}
IMAGE_REPO="${IMAGE_REPO:-gcr.io/kaniko-test}"
docker version
echo "Running integration tests..."
make out/executor
make out/warmer
FLAGS=(
"--timeout=50m"
"-parallel=${TEST_PARALLELISM:-8}"
)
if [[ -n ${DOCKERFILE_PATTERN} ]]; then
FLAGS+=("--dockerfiles-pattern=${DOCKERFILE_PATTERN}")
fi
if [[ -n ${LOCAL} ]]; then
echo "running in local mode, mocking registry..."
start_local_registry
start_local_auth_server
start_local_tls_registry
IMAGE_REPO="localhost:5000"
fi
FLAGS+=(
"--repo=${IMAGE_REPO}"
)
if [[ -n ${COVERAGE_DIR} ]]; then
FLAGS+=("--coverage-dir=${COVERAGE_DIR}")
fi
export TLS_REGISTRY_CERT="/tmp/kaniko-tls-registry/tls.crt"
go test -v ./integration/... "${FLAGS[@]}" "$@"