Skip to content

Commit

Permalink
Activated the azure cro (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
athiruma authored Nov 23, 2023
1 parent a438bf5 commit 81f5a91
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = False
tag = True
current_version = 1.1.174
current_version = 1.1.175
tag_name = v{current_version}
message = GitHub Actions Build {current_version}

Expand Down
5 changes: 5 additions & 0 deletions jenkins/cloud_resource_orchestration/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ pipeline {
S3_RESULTS_PATH = credentials('S3_RESULTS_PATH')
ATHENA_DATABASE_NAME = credentials('ATHENA_DATABASE_NAME')
ATHENA_TABLE_NAME = credentials('ATHENA_TABLE_NAME')
AZURE_CLIENT_SECRET = credentials('cloud-governance-azure-client-secret')
AZURE_TENANT_ID = credentials('cloud-governance-azure-tenant-id')
AZURE_ACCOUNT_ID = credentials('cloud-governance-azure-account-id')
AZURE_CLIENT_ID = credentials('cloud-governance-azure-client-id')
AZURE_SUBSCRIPTION_ID = credentials('cloud-governance-azure-subscription-id')
contact1 = "[email protected]"
contact2 = "[email protected]"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import os

AWS_ACCESS_KEY_ID_DELETE_PERF = os.environ['AWS_ACCESS_KEY_ID_DELETE_PERF']
Expand Down Expand Up @@ -29,6 +28,15 @@

es_index = CLOUD_RESOURCE_ORCHESTRATION_INDEX

common_env_vars = {
'es_host': ES_HOST, 'es_port': ES_PORT, 'CRO_ES_INDEX': CRO_ES_INDEX, 'log_level': 'INFO',
'LDAP_HOST_NAME': LDAP_HOST_NAME,
'JIRA_QUEUE': JIRA_QUEUE, 'JIRA_TOKEN': JIRA_TOKEN, 'JIRA_USERNAME': JIRA_USERNAME, 'JIRA_URL': JIRA_URL,
'CRO_COST_OVER_USAGE': CRO_COST_OVER_USAGE, 'CRO_PORTAL': CRO_PORTAL, 'CRO_DEFAULT_ADMINS': CRO_DEFAULT_ADMINS,
'CRO_REPLACED_USERNAMES': CRO_REPLACED_USERNAMES,
'CE_PAYER_INDEX': 'cloud-governance-clouds-billing-reports', 'RUN_ACTIVE_REGIONS': True,
}

input_vars_to_container = [{'account': 'perf-dept', 'AWS_ACCESS_KEY_ID': AWS_ACCESS_KEY_ID_DELETE_PERF,
'AWS_SECRET_ACCESS_KEY': AWS_SECRET_ACCESS_KEY_DELETE_PERF, 'PUBLIC_CLOUD_NAME': 'AWS'},
{'account': 'perf-scale', 'AWS_ACCESS_KEY_ID': AWS_ACCESS_KEY_ID_DELETE_PERF_SCALE,
Expand All @@ -38,11 +46,16 @@

os.system('echo Run CloudResourceOrchestration in pre active region')

common_input_vars = {'es_host': ES_HOST, 'es_port': ES_PORT, 'CRO_ES_INDEX': CRO_ES_INDEX, 'log_level': 'INFO', 'LDAP_HOST_NAME': LDAP_HOST_NAME,
'JIRA_QUEUE': JIRA_QUEUE, 'JIRA_TOKEN': JIRA_TOKEN, 'JIRA_USERNAME': JIRA_USERNAME, 'JIRA_URL': JIRA_URL,
'CRO_COST_OVER_USAGE': CRO_COST_OVER_USAGE, 'CRO_PORTAL': CRO_PORTAL, 'CRO_DEFAULT_ADMINS': CRO_DEFAULT_ADMINS, 'CRO_REPLACED_USERNAMES': CRO_REPLACED_USERNAMES,
'CE_PAYER_INDEX': 'cloud-governance-clouds-billing-reports', 'RUN_ACTIVE_REGIONS': True, 'AWS_DEFAULT_REGION': 'us-east-1', 'AWS_MAX_ATTEMPTS': 5, 'AWS_RETRY_MODE': 'standard',
'ATHENA_ACCOUNT_ACCESS_KEY': AWS_ACCESS_KEY_ID_ATHIRUMA_BOT, 'ATHENA_ACCOUNT_SECRET_KEY': AWS_SECRET_ACCESS_KEY_ATHIRUMA_BOT,
common_input_vars = {'es_host': ES_HOST, 'es_port': ES_PORT, 'CRO_ES_INDEX': CRO_ES_INDEX, 'log_level': 'INFO',
'LDAP_HOST_NAME': LDAP_HOST_NAME,
'JIRA_QUEUE': JIRA_QUEUE, 'JIRA_TOKEN': JIRA_TOKEN, 'JIRA_USERNAME': JIRA_USERNAME,
'JIRA_URL': JIRA_URL,
'CRO_COST_OVER_USAGE': CRO_COST_OVER_USAGE, 'CRO_PORTAL': CRO_PORTAL,
'CRO_DEFAULT_ADMINS': CRO_DEFAULT_ADMINS, 'CRO_REPLACED_USERNAMES': CRO_REPLACED_USERNAMES,
'CE_PAYER_INDEX': 'cloud-governance-clouds-billing-reports', 'RUN_ACTIVE_REGIONS': True,
'AWS_DEFAULT_REGION': 'us-east-1', 'AWS_MAX_ATTEMPTS': 5, 'AWS_RETRY_MODE': 'standard',
'ATHENA_ACCOUNT_ACCESS_KEY': AWS_ACCESS_KEY_ID_ATHIRUMA_BOT,
'ATHENA_ACCOUNT_SECRET_KEY': AWS_SECRET_ACCESS_KEY_ATHIRUMA_BOT,
'ATHENA_DATABASE_NAME': ATHENA_DATABASE_NAME, 'ATHENA_TABLE_NAME': ATHENA_TABLE_NAME,
'S3_RESULTS_PATH': S3_RESULTS_PATH
}
Expand All @@ -56,3 +69,23 @@
os.system(f"""echo Running on Account {input_vars.get("account").upper()}""")
envs = list(map(combine_vars, input_vars.items()))
os.system(f"""podman run --net="host" --rm --name cloud_resource_orchestration -e CLOUD_RESOURCE_ORCHESTRATION="True" -e EMAIL_ALERT="True" -e {' -e '.join(envs)} -e {' -e '.join(common_envs)} quay.io/ebattat/cloud-governance:latest""")


AZURE_ACCOUNT_ID = os.environ['AZURE_ACCOUNT_ID']
AZURE_CLIENT_SECRET = os.environ['AZURE_CLIENT_SECRET']
AZURE_TENANT_ID = os.environ['AZURE_TENANT_ID']
AZURE_CLIENT_ID = os.environ['AZURE_CLIENT_ID']
AZURE_SUBSCRIPTION_ID = os.environ['AZURE_SUBSCRIPTION_ID']

os.system("Running the azure cro")
azure_cro_env = {
'AZURE_ACCOUNT_ID': AZURE_ACCOUNT_ID, 'AZURE_CLIENT_ID': AZURE_CLIENT_ID,
'AZURE_TENANT_ID': AZURE_TENANT_ID, 'AZURE_CLIENT_SECRET': AZURE_CLIENT_SECRET,
'AZURE_SUBSCRIPTION_ID': AZURE_SUBSCRIPTION_ID,
'account': 'PERF&SCALE', 'PUBLIC_CLOUD_NAME': 'AZURE', 'CLOUD_RESOURCE_ORCHESTRATION': True
}
azure_cro_env.update(common_env_vars)

azure_cro = """ podman run --net="host" --rm --name cloud_resource_orchestration """
azure_cro += f" -e {' -e '.join(azure_cro_env)} quay.io/ebattat/cloud-governance:latest"
os.system(azure_cro)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from os import path
from setuptools import setup, find_packages

__version__ = '1.1.174'
__version__ = '1.1.175'

here = path.abspath(path.dirname(__file__))

Expand Down

0 comments on commit 81f5a91

Please sign in to comment.