-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun-local.sh
More file actions
executable file
·45 lines (38 loc) · 1.53 KB
/
Copy pathrun-local.sh
File metadata and controls
executable file
·45 lines (38 loc) · 1.53 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
#!/bin/bash
set -eu
set -o pipefail
# Examples:
# - RUN_LOCAL_DOCKER_IMAGE=config-prebuild .automation/run-local.sh .automation/pipeline/config-diff.sh <commit from kayobe-config to compare against> -- --env KAYOBE_VAULT_PASSWORD=$(< ~/.kayobe-vault-pass)
# - RUN_LOCAL_DOCKER_IMAGE=rally-docker:latest .automation/run-local.sh .automation/pipeline/tempest.sh -- --env TEMPEST_PATTERN="tempest.api.compute.servers.test_delete_server.DeleteServersTestJSON" --env TEMPEST_OPENRC="$(< ~/src/um6p-kayobe-config/etc/kolla/public-openrc.sh )" --name will --env KAYOBE_AUTOMATION_LOG_LEVEL=info
PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$PARENT/.."
source "${PARENT}/functions"
function config_extras {
export RUN_LOCAL_DOCKER_IMAGE="${RUN_LOCAL_DOCKER_IMAGE:-centos:8}"
}
function main {
config_extras
RELATIVE_PATH=$(realpath --relative-to="$REPO_ROOT" "$1")
SCRIPT_ARGS=()
shift
echo "CI script: $RELATIVE_PATH"
# Arguments before -- are passed to the script, arguments that are listed after are passed to docker
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--)
shift
break
;;
*)
SCRIPT_ARGS+=("$1")
shift
;;
esac
done
#echo "Script args: ${SCRIPT_ARGS[@]}"
# WARNING: printing docker args will leak your environment file
#echo "docker args: $@"
docker run --rm -it "$@" -v $REPO_ROOT:/src "$RUN_LOCAL_DOCKER_IMAGE" "/src/$RELATIVE_PATH" "${SCRIPT_ARGS[@]}"
}
main "$@"