Reformat with black
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
33b42a988b
commit
264edabd8c
2 changed files with 32 additions and 14 deletions
30
encrypt.py
30
encrypt.py
|
@ -11,7 +11,14 @@ from glob import glob
|
||||||
import subprocess
|
import subprocess
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
BLACKLIST = [".git", ".obsidian", ".idea", ".gitlab-ci.yml", ".encrypt.py", ".trigger.py"]
|
BLACKLIST = [
|
||||||
|
".git",
|
||||||
|
".obsidian",
|
||||||
|
".idea",
|
||||||
|
".gitlab-ci.yml",
|
||||||
|
".encrypt.py",
|
||||||
|
".trigger.py",
|
||||||
|
]
|
||||||
|
|
||||||
enc_path = os.environ.get("ENCRYPTED_PATH")
|
enc_path = os.environ.get("ENCRYPTED_PATH")
|
||||||
enc_repo = os.environ.get("ENCRYPTED_REPO")
|
enc_repo = os.environ.get("ENCRYPTED_REPO")
|
||||||
|
@ -26,9 +33,14 @@ os.mkdir(enc_path)
|
||||||
os.chdir(enc_path)
|
os.chdir(enc_path)
|
||||||
|
|
||||||
repo = Repo.init(enc_path)
|
repo = Repo.init(enc_path)
|
||||||
repo.create_remote("origin", f"https://{enc_repo_user}:{enc_repo_pass}@github.com/baalajimaestro/{enc_repo}.git")
|
repo.create_remote(
|
||||||
|
"origin",
|
||||||
|
f"https://{enc_repo_user}:{enc_repo_pass}@github.com/baalajimaestro/{enc_repo}.git",
|
||||||
|
)
|
||||||
|
|
||||||
file_list = glob(base_dir+'/**/.*', recursive=True) + glob(base_dir+'/**/*', recursive=True)
|
file_list = glob(base_dir + "/**/.*", recursive=True) + glob(
|
||||||
|
base_dir + "/**/*", recursive=True
|
||||||
|
)
|
||||||
|
|
||||||
for i in file_list:
|
for i in file_list:
|
||||||
if os.path.isdir(i):
|
if os.path.isdir(i):
|
||||||
|
@ -47,7 +59,8 @@ for i in file_list:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
process = subprocess.run(
|
process = subprocess.run(
|
||||||
["openssl",
|
[
|
||||||
|
"openssl",
|
||||||
"enc",
|
"enc",
|
||||||
"-chacha20",
|
"-chacha20",
|
||||||
"-base64",
|
"-base64",
|
||||||
|
@ -61,13 +74,12 @@ for i in file_list:
|
||||||
"-in",
|
"-in",
|
||||||
i,
|
i,
|
||||||
"-out",
|
"-out",
|
||||||
enc_path+"/"+rel_path]
|
enc_path + "/" + rel_path,
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
repo.git.add(".")
|
repo.git.add(".")
|
||||||
|
|
||||||
repo.index.commit(
|
repo.index.commit(f"Commit as of {current_time}")
|
||||||
f"Commit as of {current_time}"
|
|
||||||
)
|
|
||||||
|
|
||||||
repo.git.push('origin', 'master', force=True)
|
repo.git.push("origin", "master", force=True)
|
||||||
|
|
12
trigger.py
12
trigger.py
|
@ -22,9 +22,15 @@ repo.create_tag(current_time)
|
||||||
|
|
||||||
if repo.remote("pushback").exists():
|
if repo.remote("pushback").exists():
|
||||||
repo.remote().remove(repo, "pushback")
|
repo.remote().remove(repo, "pushback")
|
||||||
repo.create_remote("pushback", f"https://{base_repo_user}:{base_repo_pass}@git.baalajimaestro.me/baalajimaestro/{content_repo_git}.git")
|
repo.create_remote(
|
||||||
repo.git.push('pushback', current_time)
|
"pushback",
|
||||||
|
f"https://{base_repo_user}:{base_repo_pass}@git.baalajimaestro.me/baalajimaestro/{content_repo_git}.git",
|
||||||
|
)
|
||||||
|
repo.git.push("pushback", current_time)
|
||||||
|
|
||||||
data = {"token": gitlab_token, "ref": "source"}
|
data = {"token": gitlab_token, "ref": "source"}
|
||||||
|
|
||||||
post(f"https://git.baalajimaestro.me/api/v4/projects/{content_repo_id}/trigger/pipeline", json = data)
|
post(
|
||||||
|
f"https://git.baalajimaestro.me/api/v4/projects/{content_repo_id}/trigger/pipeline",
|
||||||
|
json=data,
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue