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

Use token to authenticate

parent 7f0742d1
...@@ -33,7 +33,7 @@ targetDir = args.targetDir ...@@ -33,7 +33,7 @@ targetDir = args.targetDir
validation = os.environ["CERTBOT_VALIDATION"] validation = os.environ["CERTBOT_VALIDATION"]
token = os.environ["CERTBOT_TOKEN"] token = os.environ["CERTBOT_TOKEN"]
domain = os.environ["CERTBOT_DOMAIN"] domain = os.environ["CERTBOT_DOMAIN"]
#gitToken = os.environ["TOKEN"] gitToken = os.environ["PRIVATE_TOKEN"]
fileName = domain + ".html" fileName = domain + ".html"
...@@ -59,11 +59,11 @@ def writeValidationFile(): ...@@ -59,11 +59,11 @@ def writeValidationFile():
def gitPush(): def gitPush():
originUrl = shell("git remote get-url origin", targetDir) originUrl = shell("git remote get-url origin", targetDir)
#writeOriginUrl = re.sub("gitlab-ci-token:.*?@", "gitlab-ci-token:" + gitToken + "@", originUrl) writeOriginUrl = re.sub("gitlab-ci-token:.*?@", "gitlab-ci-token:" + gitToken + "@", originUrl)
#print("Replaced for path: " + writeOriginUrl) print("Replaced for path: " + writeOriginUrl)
#shell("git remote add tokenOrigin " + writeOriginUrl, targetDir) 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 sshOrigin git@gitlab.com:robinryf/robinryf.gitlab.io.git", targetDir)
shell("git checkout master", targetDir) shell("git checkout master", targetDir)
shell("git add " + fileName, targetDir) shell("git add " + fileName, targetDir)
...@@ -73,7 +73,7 @@ def gitPush(): ...@@ -73,7 +73,7 @@ def gitPush():
shell("git commit -m 'Add domain validation for " + domain + "'", targetDir) 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(): ...@@ -87,7 +87,7 @@ def waitForPageChange():
while not doesSiteExist: while not doesSiteExist:
r = requests.get(url) r = requests.get(url)
responseText = r.text.strip() responseText = r.text.strip()
log("R: " + responseText + ", V: " + validation) #log("R: " + responseText + ", V: " + validation)
if responseText == validation: if responseText == validation:
doesSiteExist = True doesSiteExist = True
else: else:
...@@ -96,7 +96,6 @@ def waitForPageChange(): ...@@ -96,7 +96,6 @@ def waitForPageChange():
log("Passed validation") log("Passed validation")
writeValidationFile() writeValidationFile()
gitPush() gitPush()
waitForPageChange() 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