-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.include
72 lines (60 loc) · 1.62 KB
/
build.include
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
#!/bin/sh
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# See: https://sipb.mit.edu/doc/safe-shell/
init() {
init_constants
# Make sure Docker is working and we have /var/run/docker.sock mounted or valid DOCKER_HOST
check_docker "$@"
}
init_constants() {
BLUE='\033[1;34m'
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[38;5;220m'
BOLD='\033[1m'
UNDERLINE='\033[4m'
NC='\033[0m'
DOCKER_RUN_OPTIONS=""
BATS_OPTIONS=""
# run bats with terminal mode (pretty print) if supported by current shell
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-t"
BATS_OPTIONS="--pretty"
else
BATS_OPTIONS="--tap"
fi
# Replace all of these with digests
UTILITY_IMAGE_ALPINE="alpine:3.4"
UTILITY_IMAGE_CHEIP="eclipse/che-ip:nightly"
UTILITY_IMAGE_CHEACTION="eclipse/che-action:nightly"
UTILITY_IMAGE_CHEDIR="eclipse/che-dir:nightly"
UTILITY_IMAGE_CHETEST="eclipse/che-test:nightly"
UTILITY_IMAGE_CHEMOUNT="eclipse/che-mount:nightly"
}
check_docker() {
if ! docker ps > /dev/null 2>&1; then
output=$(docker ps)
printf "${RED}Docker not installed properly: ${output}${NC}\n"
exit 1
fi
}
docker_exec() {
if has_docker_for_windows_client; then
MSYS_NO_PATHCONV=1 docker.exe "$@"
else
"$(which docker)" "$@"
fi
}
has_docker_for_windows_client(){
GLOBAL_HOST_ARCH=$(docker version --format {{.Client}})
if [[ "${GLOBAL_HOST_ARCH}" == *"windows"* ]]; then
return 0
else
return 1
fi
}