Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
else:
sys.exit(
"Kindly provide an 'Admin' Bitbucket user with correct password and run the installer again!"
)
# Terraform provisioning script needs the jar file path
replace_tfvars('atlassian_jar_path',
get_atlassian_tools_path() + "lib/bitbucket-cli-6.7.0.jar",
get_tfvars_file())
replace_tfvars('scm_elb', bbelb, get_tfvars_file())
replace_tfvars('scm_username', bbuserpass[0], get_tfvars_file())
replace_tfvars('scm_passwd', bbuserpass[1], get_tfvars_file())
replace_tfvars('scm_publicip', bbip, get_tfvars_file())
replace_tfvars('scm_type', 'bitbucket', get_tfvars_file())
replace_tfvars('scm_pathext', '/scm', get_tfvars_file())
def configure_jenkins(endpoint, defaultport, userpw, sshuser, secgrp, subnet):
# Check is the jenkins user exist in jenkins server
if not check_jenkins_user(endpoint, defaultport, userpw):
sys.exit(
"Kindly provide an 'Admin' Jenkins user with correct password and run the installer again!"
)
check_jenkins_pem()
# Default Jenkins instance ssh Port
ssh_port = "22"
replace_tfvars('dockerizedJenkins', 'false', get_tfvars_file(), quoteVal=False)
update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet)
def configure_gitlab_container():
# TODO having to explicitly disable each other SCM type by name here is not elegant
replace_tfvars('scmbb', 'false', get_tfvars_file(), False)
replace_tfvars("scmgitlab", "true", get_tfvars_file(), False)
replace_tfvars('scm_type', 'gitlab', get_tfvars_file())
replace_tfvars('scm_pathext', '/', get_tfvars_file())
def configure_jenkins_container(existing_vpc_id, vpc_cidr, ecs_range):
"""
Launch a containerized Jenkins server.
"""
if existing_vpc_id:
replace_tfvars('existing_vpc_ecs', existing_vpc_id, get_tfvars_file())
else:
replace_tfvars("autovpc", "true", get_tfvars_file(), False)
replace_tfvars("vpc_cidr_block", vpc_cidr, get_tfvars_file())
replace_tfvars('network_range', ecs_range, get_tfvars_file())
replace_tfvars('jenkinsuser', "admin", get_tfvars_file())
replace_tfvars('jenkinspasswd', passwd_generator(), get_tfvars_file())
def update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet):
replace_tfvars('jenkins_elb', '{0}:{1}'.format(endpoint, defaultport), get_tfvars_file())
replace_tfvars('jenkins_rawendpoint', endpoint, get_tfvars_file())
replace_tfvars('jenkins_security_group', secgrp, get_tfvars_file())
replace_tfvars('jenkins_subnet', subnet, get_tfvars_file())
replace_tfvars('jenkinsuser', userpw[0], get_tfvars_file())
replace_tfvars('jenkinspasswd', userpw[1], get_tfvars_file())
replace_tfvars('jenkins_ssh_login', sshuser, get_tfvars_file())
replace_tfvars('jenkins_ssh_port', ssh_port, get_tfvars_file())
replace_tfvars('jenkins_ssh_key', '{0}'.format(jenkins_pem), get_tfvars_file())
def configure_gitlab_container():
# TODO having to explicitly disable each other SCM type by name here is not elegant
replace_tfvars('scmbb', 'false', get_tfvars_file(), False)
replace_tfvars("scmgitlab", "true", get_tfvars_file(), False)
replace_tfvars('scm_type', 'gitlab', get_tfvars_file())
replace_tfvars('scm_pathext', '/', get_tfvars_file())
def update_sonarqube_terraform(sonarelb, sonaruserpass, sonarip):
replace_tfvars('sonar_server_elb', sonarelb, get_tfvars_file())
replace_tfvars('sonar_username', sonaruserpass[0], get_tfvars_file())
replace_tfvars('sonar_passwd', sonaruserpass[1], get_tfvars_file())
replace_tfvars('sonar_server_public_ip', sonarip, get_tfvars_file())
replace_tfvars('codequality_type', 'sonarqube', get_tfvars_file())
replace_tfvars('codeq', 1, get_tfvars_file())
def update_sonarqube_terraform(sonarelb, sonaruserpass, sonarip):
replace_tfvars('sonar_server_elb', sonarelb, get_tfvars_file())
replace_tfvars('sonar_username', sonaruserpass[0], get_tfvars_file())
replace_tfvars('sonar_passwd', sonaruserpass[1], get_tfvars_file())
replace_tfvars('sonar_server_public_ip', sonarip, get_tfvars_file())
replace_tfvars('codequality_type', 'sonarqube', get_tfvars_file())
replace_tfvars('codeq', 1, get_tfvars_file())
def update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet):
replace_tfvars('jenkins_elb', '{0}:{1}'.format(endpoint, defaultport), get_tfvars_file())
replace_tfvars('jenkins_rawendpoint', endpoint, get_tfvars_file())
replace_tfvars('jenkins_security_group', secgrp, get_tfvars_file())
replace_tfvars('jenkins_subnet', subnet, get_tfvars_file())
replace_tfvars('jenkinsuser', userpw[0], get_tfvars_file())
replace_tfvars('jenkinspasswd', userpw[1], get_tfvars_file())
replace_tfvars('jenkins_ssh_login', sshuser, get_tfvars_file())
replace_tfvars('jenkins_ssh_port', ssh_port, get_tfvars_file())
replace_tfvars('jenkins_ssh_key', '{0}'.format(jenkins_pem), get_tfvars_file())
def update_jenkins_terraform(endpoint, defaultport, userpw, sshuser, ssh_port, secgrp, subnet):
replace_tfvars('jenkins_elb', '{0}:{1}'.format(endpoint, defaultport), get_tfvars_file())
replace_tfvars('jenkins_rawendpoint', endpoint, get_tfvars_file())
replace_tfvars('jenkins_security_group', secgrp, get_tfvars_file())
replace_tfvars('jenkins_subnet', subnet, get_tfvars_file())
replace_tfvars('jenkinsuser', userpw[0], get_tfvars_file())
replace_tfvars('jenkinspasswd', userpw[1], get_tfvars_file())
replace_tfvars('jenkins_ssh_login', sshuser, get_tfvars_file())
replace_tfvars('jenkins_ssh_port', ssh_port, get_tfvars_file())
replace_tfvars('jenkins_ssh_key', '{0}'.format(jenkins_pem), get_tfvars_file())