Skip to content

Commit de9e4da

Browse files
committed
remove unused code from lib.sh
On-behalf-of: @SAP christoph.mewes@sap.com
1 parent c61e085 commit de9e4da

File tree

1 file changed

+0
-83
lines changed

1 file changed

+0
-83
lines changed

hack/lib.sh

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@
2121
# receives a SIGINT
2222
set -o monitor
2323

24-
# Get the operating system
25-
# Possible values are:
26-
# * linux for linux
27-
# * darwin for macOS
28-
#
29-
# usage:
30-
# if [ "${OS}" == "darwin" ]; then
31-
# # do macos stuff
32-
# fi
33-
OS="$(echo $(uname) | tr '[:upper:]' '[:lower:]')"
34-
3524
retry() {
3625
# Works only with bash but doesn't fail on other shells
3726
start_time=$(date +%s)
@@ -122,42 +111,6 @@ write_junit() {
122111
EOF
123112
}
124113

125-
ensure_github_host_pubkey() {
126-
# check whether we already have a known_hosts entry for Github
127-
if ssh-keygen -F github.com > /dev/null 2>&1; then
128-
echodate "Github's SSH host key already present."
129-
else
130-
local github_rsa_key
131-
# https://help.github.com/en/github/authenticating-to-github/githubs-ssh-key-fingerprints
132-
github_rsa_key="github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk="
133-
134-
echodate "Adding Github's SSH host key to known hosts…"
135-
136-
mkdir -p "$HOME/.ssh"
137-
chmod 700 "$HOME/.ssh"
138-
echo "$github_rsa_key" >> "$HOME/.ssh/known_hosts"
139-
chmod 600 "$HOME/.ssh/known_hosts"
140-
fi
141-
}
142-
143-
vault_ci_login() {
144-
# already logged in
145-
if [ -n "${VAULT_TOKEN:-}" ]; then
146-
return 0
147-
fi
148-
149-
# check environment variables
150-
if [ -z "${VAULT_ROLE_ID:-}" ] || [ -z "${VAULT_SECRET_ID:-}" ]; then
151-
echo "VAULT_ROLE_ID and VAULT_SECRET_ID must be set to programmatically authenticate against Vault."
152-
return 1
153-
fi
154-
155-
local token
156-
token=$(vault write --format=json auth/approle/login "role_id=$VAULT_ROLE_ID" "secret_id=$VAULT_SECRET_ID" | jq -r '.auth.client_token')
157-
158-
export VAULT_TOKEN="$token"
159-
}
160-
161114
# append_trap appends to existing traps, if any. It is needed because Bash replaces existing handlers
162115
# rather than appending: https://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal
163116
# Needing this func is a strong indicator that Bash is not the right language anymore. Also, this
@@ -182,42 +135,6 @@ append_trap() {
182135
fi
183136
}
184137

185-
docker_logs() {
186-
if [[ $? -ne 0 ]]; then
187-
echodate "Printing Docker logs…"
188-
cat /tmp/docker.log
189-
fi
190-
}
191-
192-
start_docker_daemon_ci() {
193-
# DOCKER_REGISTRY_MIRROR_ADDR is injected via Prow preset;
194-
# start-docker.sh is part of the build image.
195-
DOCKER_REGISTRY_MIRROR="${DOCKER_REGISTRY_MIRROR_ADDR:-}" DOCKER_MTU=1400 start-docker.sh
196-
197-
# enable the modern buildx plugin
198-
echodate "Enabling dockerx plugin…"
199-
docker buildx install
200-
}
201-
202-
start_docker_daemon() {
203-
if docker stats --no-stream > /dev/null 2>&1; then
204-
echodate "Not starting Docker again, it's already running."
205-
return
206-
fi
207-
208-
# Start Docker daemon
209-
echodate "Starting Docker…"
210-
dockerd > /tmp/docker.log 2>&1 &
211-
212-
echodate "Started Docker successfully."
213-
append_trap docker_logs EXIT
214-
215-
# Wait for Docker to start
216-
echodate "Waiting for Docker…"
217-
retry 5 docker stats --no-stream
218-
echodate "Docker became ready."
219-
}
220-
221138
repeat() {
222139
local end=$1
223140
local str="${2:-=}"

0 commit comments

Comments
 (0)