Update trigger to use ssh as well
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
415d1a8a2f
commit
906e948b6c
1 changed files with 5 additions and 4 deletions
|
@ -12,11 +12,12 @@ from requests import post
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Environment variables for creds
|
# Environment variables for creds
|
||||||
base_repo_user = os.environ.get("BASE_REPO_USERNAME")
|
|
||||||
base_repo_pass = os.environ.get("BASE_REPO_PASSWORD")
|
|
||||||
content_repo_git = os.environ.get("CONTENT_REPO_GIT")
|
content_repo_git = os.environ.get("CONTENT_REPO_GIT")
|
||||||
content_repo_id = os.environ.get("CONTENT_REPO_ID")
|
content_repo_id = os.environ.get("CONTENT_REPO_ID")
|
||||||
gitlab_token = os.environ.get("GITLAB_TOKEN")
|
gitlab_token = os.environ.get("GITLAB_TOKEN")
|
||||||
|
ssh_key = os.environ.get("SSH_SECRET_KEY")
|
||||||
|
|
||||||
|
git_ssh_cmd = f"ssh -o StrictHostKeyChecking=no -i {ssh_key}"
|
||||||
|
|
||||||
# Get the time and create a tag of epoch
|
# Get the time and create a tag of epoch
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
@ -32,11 +33,11 @@ except ValueError:
|
||||||
pass
|
pass
|
||||||
repo.create_remote(
|
repo.create_remote(
|
||||||
"pushback",
|
"pushback",
|
||||||
f"https://{base_repo_user}:{base_repo_pass}@git.baalajimaestro.me/{content_repo_git}.git",
|
f"ssh://git@git.baalajimaestro.me:29999/{content_repo_git}.git",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Push the newly created tag
|
# Push the newly created tag
|
||||||
repo.git.push("pushback", "HEAD:prod", force=True)
|
repo.git.push("pushback", "HEAD:prod", force=True, env=dict(GIT_SSH_COMMAND=git_ssh_cmd))
|
||||||
|
|
||||||
# Trigger site rebuild
|
# Trigger site rebuild
|
||||||
data = {"token": gitlab_token, "ref": "source"}
|
data = {"token": gitlab_token, "ref": "source"}
|
||||||
|
|
Loading…
Reference in a new issue