feat: create repo and add deploy key util

wip-site
Aravinth Manivannan 2022-07-01 19:52:10 +05:30
parent 8be1e02a21
commit 412230bd99
Signed by untrusted user: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 29 additions and 16 deletions

View File

@ -11,6 +11,7 @@ init() {
else
docker_compose_down || true
docker_compose_up
sed -i /localhost.*/d ~/.ssh/known_hosts
setup_env
sleep 5
# wait_for_env
@ -29,4 +30,8 @@ teardown() {
fi
}
$1
new_fleet_repo() {
new_fleet_repo_init $2
}
$1 $@

View File

@ -120,31 +120,20 @@ support_repo_init() {
$GITEA_HOSTEA_SUPPORT_REPO
}
# register user "Hostea" on Gitea and create support repository
fleet_repo_init() {
python -m integration \
gitea register \
$GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \
$GITEA_HOSTEA_EMAIL \
$GITEA_URL || true
python -m integration \
gitea login \
$GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \
$GITEA_HOSTEA_EMAIL \
$GITEA_URL
new_fleet_repo_init() {
python -m integration \
gitea create_repo \
$GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \
$GITEA_HOSTEA_EMAIL \
$GITEA_URL \
$GITEA_HOSTEA_FLEET_REPO
$1
python -m integration \
gitea add_deploy_key \
$GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \
$GITEA_HOSTEA_EMAIL \
$GITEA_URL \
$GITEA_HOSTEA_FLEET_REPO \
$1 \
$GITEA_HOSTEA_FLEET_DEPLOY_KEY
tmp_dir=$(mktemp -d)
@ -159,7 +148,8 @@ fleet_repo_init() {
git init
git add README
git commit -m "init"
git remote add origin $GITEA_HOSTEA_FLEET_REPO_REMOTE
REMOTE="$GITEA_SSH_URL/$GITEA_HOSTEA_USERNAME/$1.git"
git remote add origin $REMOTE
GIT_SSH_COMMAND="/usr/bin/ssh -oStrictHostKeyChecking=no -i $GITEA_HOSTEA_FLEET_DEPLOY_KEY_PRIVATE" \
git push --set-upstream origin master
popd
@ -167,6 +157,24 @@ fleet_repo_init() {
}
# register user "Hostea" on Gitea and create support repository
fleet_repo_init() {
python -m integration \
gitea register \
$GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \
$GITEA_HOSTEA_EMAIL \
$GITEA_URL || true
python -m integration \
gitea login \
$GITEA_HOSTEA_USERNAME $GITEA_HOSTEA_PASSWORD \
$GITEA_HOSTEA_EMAIL \
$GITEA_URL
new_fleet_repo_init $GITEA_HOSTEA_FLEET_REPO
}
# Create user on Hostea to simulate a Hostea customer
hostea_customer_simulation() {
python -m integration \