@@ -149,7 +149,7 @@ def apply_vars_gorp(gorp_kind, yaml_dict, gorp, gorp_dict, variables_clean_all_b
149149 # Compare existing vars with yaml vars
150150 # If any difference, print
151151 if (
152- gorp_var .value != str (var ["value" ])
152+ ( gorp_var .value != str (var ["value" ]) and not ( gorp_var . value is None and var [ "value" ] is None ) )
153153 or
154154 gorp_var .variable_type != var ["variable_type" ]
155155 or
@@ -161,7 +161,7 @@ def apply_vars_gorp(gorp_kind, yaml_dict, gorp, gorp_dict, variables_clean_all_b
161161 ):
162162 print ("changed: {scope} / {var}:" .format (scope = var ["environment_scope" ], var = var ["key" ]))
163163 # Print old -> new
164- if gorp_var .value != str (var ["value" ]):
164+ if gorp_var .value != str (var ["value" ]) and not ( gorp_var . value is None and var [ "value" ] is None ) :
165165 print (" value: {old} -> {new}" .format (old = gorp_var .value , new = var ["value" ]))
166166 if gorp_var .variable_type != var ["variable_type" ]:
167167 print (" variable_type: {old} -> {new}" .format (old = gorp_var .variable_type , new = var ["variable_type" ]))
@@ -503,7 +503,7 @@ def create_var(var):
503503 if not args .dry_run_gitlab :
504504
505505 # CI Variables
506- if "variables" in project_dict :
506+ if "variables" in project_dict and not ( "jobs_enabled" in project_dict and project_dict [ "jobs_enabled" ] is False ) :
507507
508508 logger .info ("Found project yaml definition for vars: {variables}" .format (variables = project_dict ["variables" ]))
509509
@@ -720,8 +720,6 @@ def create_var(var):
720720 project .container_registry_enabled = project_dict ["container_registry_enabled" ]
721721 if "jobs_enabled" in project_dict :
722722 project .jobs_enabled = project_dict ["jobs_enabled" ]
723- if "jobs_enabled" in project_dict :
724- project .jobs_enabled = project_dict ["jobs_enabled" ]
725723 if "lfs_enabled" in project_dict :
726724 project .lfs_enabled = project_dict ["lfs_enabled" ]
727725 if "merge_requests_enabled" in project_dict :
@@ -1081,7 +1079,7 @@ def create_var(var):
10811079 project .runners .create ({'runner_id' : runner .id })
10821080
10831081 # Protected envs
1084- if "protected_environments" in project_dict :
1082+ if "protected_environments" in project_dict and not ( "jobs_enabled" in project_dict and project_dict [ "jobs_enabled" ] is False ) :
10851083 for env in project_dict ["protected_environments" ]:
10861084 # Create env first
10871085 if not any (p_env .name == env ["name" ] for p_env in project .environments .list (get_all = True )):
@@ -1125,7 +1123,7 @@ def create_var(var):
11251123 logger .info (process .stderr )
11261124
11271125 # CI Variables
1128- if "variables" in project_dict :
1126+ if "variables" in project_dict and not ( "jobs_enabled" in project_dict and project_dict [ "jobs_enabled" ] is False ) :
11291127
11301128 # Check variables_clean_all_before_set
11311129 if args .variables_clean_all_before_set or ("variables_clean_all_before_set" in project_dict and project_dict ["variables_clean_all_before_set" ]):
0 commit comments