def ensure_sa_secret(strict=False): """Method creates a secret with MoM-EE service account private key. It relies on the global `install_enterprise_cli` fixture to install the enterprise-cli-package. """ if common.has_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME): common.delete_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME) common.create_sa_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME, MOM_EE_SERVICE_ACCOUNT, strict) assert common.has_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME)
def cleanup(): if is_mom_ee_deployed(): remove_mom_ee() if common.has_service_account(MOM_EE_SERVICE_ACCOUNT): common.delete_service_account(MOM_EE_SERVICE_ACCOUNT) if common.has_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME): common.delete_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME) if common.has_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME): common.delete_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME)
def ensure_docker_config_secret(): # Docker username and password should be passed as environment variables `DOCKER_HUB_USERNAME` # and `DOCKER_HUB_PASSWORD` (usually by jenkins) assert 'DOCKER_HUB_USERNAME' in os.environ, "Couldn't find docker hub username. $DOCKER_HUB_USERNAME is not set" assert 'DOCKER_HUB_PASSWORD' in os.environ, "Couldn't find docker hub password. $DOCKER_HUB_PASSWORD is not set" if common.has_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME): common.delete_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME) username = os.environ['DOCKER_HUB_USERNAME'] password = os.environ['DOCKER_HUB_PASSWORD'] config_json = common.create_docker_pull_config_json(username, password) common.create_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME, value=json.dumps(config_json)) assert common.has_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME)
def ensure_docker_config_secret(): """Method creates a secret with the docker credentials that is later used to pull the image from our private docker repository. It relies on the global `install_enterprise_cli` fixture to install the enterprise-cli-package. """ # Docker username and password should be passed as environment variables `DOCKER_HUB_USERNAME` # and `DOCKER_HUB_PASSWORD` (usually by jenkins) assert 'DOCKER_HUB_USERNAME' in os.environ, "Couldn't find docker hub username. $DOCKER_HUB_USERNAME is not set" assert 'DOCKER_HUB_PASSWORD' in os.environ, "Couldn't find docker hub password. $DOCKER_HUB_PASSWORD is not set" if common.has_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME): common.delete_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME) username = os.environ['DOCKER_HUB_USERNAME'] password = os.environ['DOCKER_HUB_PASSWORD'] config_json = common.create_docker_pull_config_json(username, password) common.create_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME, value=json.dumps(config_json)) assert common.has_secret(MOM_EE_DOCKER_CONFIG_SECRET_NAME)
def ensure_sa_secret(strict=False): if common.has_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME): common.delete_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME) common.create_sa_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME, MOM_EE_SERVICE_ACCOUNT, strict) assert common.has_secret(MOM_EE_SERVICE_ACCOUNT_SECRET_NAME)