Commit 5217a3d9 authored by Aman Verma's avatar Aman Verma Committed by Hema Vishnu Pola [Microsoft]
Browse files

adding yaml file for bootstrapping step for schema service

parent 2a8cc604
......@@ -17,6 +17,9 @@ variables:
AZURE_TEST_SUBDIR: testing/schema-test-core
AZURE_SKIP_TEST: 'true'
AZURE_DEPLOYMENTS_SUBDIR: deployments/scripts/azure
INTEGRATION_TESTER: $AZURE_PRINCIPAL_ID
AZURE_TESTER_SERVICEPRINCIPAL_SECRET: $AZURE_PRINCIPAL_SECRET
DATA_PARTITION: opendes
AZURE_STORAGE_CONNECTION_STRING: DefaultEndpointsProtocol=https;AccountName=${AZURE_BASE}data;AccountKey=${AZURE_STORAGE_KEY};EndpointSuffix=core.windows.net
......@@ -60,6 +63,8 @@ include:
- project: "osdu/platform/ci-cd-pipelines"
ref: 'master'
file: 'cloud-providers/osdu-gcp-cloudrun.yml'
- local: "/devops/azure/bootstrap.yaml"
osdu-gcp-test:
image: maven:3.3.9-jdk-8
......
......@@ -4,14 +4,10 @@ import msal
class AzureToken(object):
def get_azure_id_token(self):
tenant_id = os.getenv('AZURE_AD_TENANT_ID')
resource_id = os.getenv('AZURE_AD_APP_RESOURCE_ID')
tenant_id = os.getenv('AZURE_TENANT_ID')
resource_id = os.getenv('AZURE_APP_ID')
client_id = os.getenv('INTEGRATION_TESTER')
client_secret = os.getenv('TESTER_SERVICEPRINCIPAL_SECRET')
authority_host_uri = 'https://login.microsoftonline.com'
authority_uri = authority_host_uri + '/' + tenant_id
scopes = [resource_id + '/.default']
client_secret = os.getenv('AZURE_TESTER_SERVICEPRINCIPAL_SECRET')
if tenant_id is None:
print('Please pass tenant Id to generate token')
......@@ -27,6 +23,9 @@ class AzureToken(object):
exit(1)
try:
authority_host_uri = 'https://login.microsoftonline.com'
authority_uri = authority_host_uri + '/' + tenant_id
scopes = [resource_id + '/.default']
app = msal.ConfidentialClientApplication(client_id=client_id, authority=authority_uri, client_credential=client_secret)
result = app.acquire_token_for_client(scopes=scopes)
token = 'Bearer ' + result.get('access_token')
......
export AZURE_SCHEMA_URL=https://$AZURE_DNS_NAME/api/schema-service/v1/schema
BEARER_TOKEN=`python $AZURE_DEPLOYMENTS_SUBDIR/Token.py`
export BEARER_TOKEN=$BEARER_TOKEN
python deployments/scripts/DeploySharedSchemas.py -u $AZURE_SCHEMA_URL
azure_bootstrap:
stage: bootstrap
image: python:3.8
needs: ["azure_deploy"]
script:
- pip install -r $AZURE_DEPLOYMENTS_SUBDIR/requirements.txt
- chmod +x $AZURE_DEPLOYMENTS_SUBDIR/bootstrap.sh
- $AZURE_DEPLOYMENTS_SUBDIR/bootstrap.sh
only:
variables:
- $AZURE == 'true'
azure_test:
needs: ["azure_bootstrap"]
only:
variables:
- $AZURE == 'true'
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