logging.info("Using app path %s", app_path)
zone = "us-central1-a"
os.environ["ZONE"] = zone
if not zone:
raise ValueError("Could not get zone being used")
// We need to specify a valid email because
// 1. We need to create appropriate RBAC rules to allow the current user
// to create the required K8s resources.
// 2. Setting the IAM policy will fail if the email is invalid.
email = util.run(["gcloud", "config", "get-value", "account"])
os.environ["EMAIL"] = email
if not email:
raise ValueError("Could not determine GCP account being used.")
os.environ["PROJECT"] = project
if not project:
raise ValueError("Could not get project being used")
// username and password are passed as env vars and won"t appear in the logs
//
config_spec = get_config_spec(config_path, project, email)
// Set KfDef name to be unique
regex = re.compile("[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?")
kfdef_name = regex.findall(app_path)[-1]
config_spec["metadata"]["name"] = kfdef_name
if not os.path.exists(parent_dir):
os.makedirs(parent_dir)
if not os.path.exists(app_path):
os.makedirs(app_path)
with open(os.path.join(parent_dir, "tmp.yaml"), "w") as f:
yaml.dump(config_spec, f)