Commit 32a6c370 authored by Robin Fischer's avatar Robin Fischer

Use token to authenticate

parent 7f0742d1
......@@ -33,7 +33,7 @@ targetDir = args.targetDir
validation = os.environ["CERTBOT_VALIDATION"]
token = os.environ["CERTBOT_TOKEN"]
domain = os.environ["CERTBOT_DOMAIN"]
#gitToken = os.environ["TOKEN"]
gitToken = os.environ["PRIVATE_TOKEN"]
fileName = domain + ".html"
......@@ -59,11 +59,11 @@ def writeValidationFile():
def gitPush():
originUrl = shell("git remote get-url origin", targetDir)
#writeOriginUrl = re.sub("gitlab-ci-token:.*?@", "gitlab-ci-token:" + gitToken + "@", originUrl)
#print("Replaced for path: " + writeOriginUrl)
writeOriginUrl = re.sub("gitlab-ci-token:.*?@", "gitlab-ci-token:" + gitToken + "@", originUrl)
print("Replaced for path: " + writeOriginUrl)
#shell("git remote add tokenOrigin " + writeOriginUrl, targetDir)
shell("git remote add sshOrigin git@gitlab.com:robinryf/robinryf.gitlab.io.git", targetDir)
shell("git remote add tokenOrigin " + writeOriginUrl, targetDir)
#shell("git remote add sshOrigin git@gitlab.com:robinryf/robinryf.gitlab.io.git", targetDir)
shell("git checkout master", targetDir)
shell("git add " + fileName, targetDir)
......@@ -73,7 +73,7 @@ def gitPush():
shell("git commit -m 'Add domain validation for " + domain + "'", targetDir)
shell("git push sshOrigin", targetDir)
shell("git push tokenOrigin", targetDir)
......@@ -87,7 +87,7 @@ def waitForPageChange():
while not doesSiteExist:
r = requests.get(url)
responseText = r.text.strip()
log("R: " + responseText + ", V: " + validation)
#log("R: " + responseText + ", V: " + validation)
if responseText == validation:
doesSiteExist = True
else:
......@@ -96,7 +96,6 @@ def waitForPageChange():
log("Passed validation")
writeValidationFile()
gitPush()
waitForPageChange()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment