Added some new gitlab functions.

This commit is contained in:
caes 2020-05-29 03:01:43 -04:00
parent 6e2865982d
commit 8d3f50b3d7

View File

@ -376,6 +376,10 @@ apt_update () {
sudo apt update -y sudo apt update -y
} }
install_docker () {
curl -sSL https://get.docker.com/ | sh
}
install_prereqs () { install_prereqs () {
if [[ ! -x /usr/bin/jq ]]; then if [[ ! -x /usr/bin/jq ]]; then
sudo apt install jq sudo apt install jq
@ -643,6 +647,18 @@ git_list_dirs_under () {
find $1 -type d -a -name '.git' find $1 -type d -a -name '.git'
} }
######################################################################
# Gitlab operations
gitlab_download_backups () {
scp rancher@gitlab.adamo.network:~/* .
}
gitlab_container_backup () {
docker exec -it gitlab gitlab-rake gitlab:backup:create
sudo tar cf gitlab-secrets.tar /opt/gitlab/config/
}
gitlab_get_token () { gitlab_get_token () {
cat ${program_root}/gitlab_read.pat cat ${program_root}/gitlab_read.pat
} }
@ -1295,14 +1311,23 @@ execute_on_nodes () {
done done
} }
# $1: host deal
# $2: command
# $3: docker deal
docker_exec_on_host () {
local host="$1"; shift
local cmd="$1"; shift
local dealkeypath="$*"
pr_vars host cmd dealkeypath
if construct_deal_info $dealkeypath; then
ssh_tty_to_host $host "docker exec -it $deal_name \"${cmd}\""
fi
}
# $1: host deal # $1: host deal
# $2: docker deal # $2: docker deal
docker_bash_on_host () { docker_bash_on_host () {
local host=$1; shift docker_exec_on_host $1 "/bin/bash" "${@:2}"
local dealkeypath="$*"
if construct_deal_info $dealkeypath; then
ssh_tty_to_host $host "docker exec -it $deal_name /bin/bash"
fi
} }
docker_run_from_data_on_host () { docker_run_from_data_on_host () {