Implemented basic auth (personal access token)

OPMAAS-3253
Patryk Gudalewicz 2022-07-28 09:10:34 +02:00
parent 6d222c0fb7
commit b648aa2cd8
2 changed files with 9 additions and 3 deletions

View File

@ -8,15 +8,17 @@ from git import Repo
import os
#set STAGING global dashboard name
DASHBOARD_NAME = "[STAGING]Global Offboard Reliability - Touchpoint Mobile #"
CONFIG_REPO_URL = "https://atc.bmwgroup.net/bitbucket/scm/opapm/shared_configuration.git"
AUTHSTRING = config("BITBUCKET_USERNAME")+":"+config("BITBUCKET_TOKEN")
CONFIG_REPO_URL = "https://"+AUTHSTRING+"atc.bmwgroup.net/bitbucket/scm/opapm/shared_configuration.git"
CONFIG_REPO_NAME = "shared_configuration"
ARCHIVE_REPO_URL = "https://atc.bmwgroup.net/bitbucket/scm/opapm/archive.git"
ARCHIVE_REPO_URL = "https://"+AUTHSTRING+"atc.bmwgroup.net/bitbucket/scm/opapm/archive.git"
ARCHIVE_REPO_NAME = "archive"
parser = argparse.ArgumentParser(description="Generate and deploy the Dynatrace Global Dashboard as Code. Auto deployment works only for STAGING dashboard",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-R", "--rows", type=int, help="Number of rows per dashboard. If not specified, all rows will be added to single dashboard")
parser.add_argument('--auto-upload', default=False, action='store_true', help="Auto upload to STAGING dashboard")
args = parser.parse_args()
def clone_repo_if_notexist(repourl, reponame):
if(not os.path.isdir(reponame)):

View File

@ -32,7 +32,11 @@ Before executing scripts, python requirements have to be satisfied. To do so, ex
To provide authentication for API calls, create ".env" file in the script directory with following definition:
<ENV NAME>=<ENV TOKEN>
<ENV NAME> is name of environment variable. This name should be passed to "environment.yaml" file as "env-token-name" parameter
<ENV NAME> is name of environment variable. This name should be passed to "environment.yaml" file as "env-token-name" parameter
BITBUCKET_USERNAME=<USERNAME>
<USERNAME> for bitbucket account with read access to shared_configuration repo and R/W access to archive repo
BITBUCKET_TOKEN=<TOKEN>
<TOKEN> personal access token for BITBUCKET_USERNAME with repo write permissions. For more information see https://confluence.atlassian.com/bitbucketserver0717/personal-access-tokens-1087535496.html?utm_campaign=in-app-help&utm_medium=in-app-help&utm_source=stash#Personalaccesstokens-usingpersonalaccesstokens
# Usage