Skip to content

Commit b91ed40

Browse files
author
callummole
committed
move ban call to update_networkbans()
1 parent 1a1c821 commit b91ed40

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

deploy.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,29 +113,35 @@ def setup_auth_gcloud(release, cluster=None):
113113
]
114114
)
115115

116+
def update_networkbans(cluster):
117+
"""
118+
Run secrets/ban.py to update network bans
119+
"""
120+
121+
print(BOLD + GREEN + f"Updating network-bans for {cluster}" + NC, flush=True)
122+
123+
# some members have special logic in ban.py,
124+
# in which case they must be specified on the command-line
125+
ban_command = [sys.executable, "secrets/ban.py"]
126+
if cluster in {"turing-prod", "turing-staging", "turing", "ovh"}:
127+
ban_command.append(cluster)
128+
129+
subprocess.check_call(ban_command)
130+
116131

117132
def deploy(release, name=None):
118133
"""Deploys a federation member to a k8s cluster.
119134
120135
The deployment is done in the following steps:
121136
122-
1. Run secrets/ban.py to update network bans
123-
2. Deploy cert-manager
124-
3. Deploy mybinder helm chart
125-
4. Await deployed deployment and daemonsets to become Ready
137+
1. Deploy cert-manager
138+
2. Deploy mybinder helm chart
139+
3. Await deployed deployment and daemonsets to become Ready
126140
"""
127141
if not name:
128142
name = release
129143

130-
print(BOLD + GREEN + f"Updating network-bans for {release}" + NC, flush=True)
131-
132-
# some members have special logic in ban.py,
133-
# in which case they must be specified on the command-line
134-
ban_command = [sys.executable, "secrets/ban.py"]
135-
if release in {"turing-prod", "turing-staging", "turing", "ovh"}:
136-
ban_command.append(release)
137-
138-
subprocess.check_call(ban_command)
144+
139145

140146
setup_certmanager()
141147

@@ -265,6 +271,9 @@ def main():
265271
)
266272

267273
args = argparser.parse_args()
274+
275+
# if one argument given make cluster == release
276+
cluster = args.cluster or args.release
268277

269278
# Check if the local flag is set
270279
if not args.local:
@@ -293,7 +302,6 @@ def main():
293302
raise ValueError("Unrecognised input. Expecting either yes or no.")
294303

295304
# script is running on CI, proceed with auth and helm setup
296-
cluster = args.cluster or args.release
297305

298306
if cluster == "ovh":
299307
setup_auth_ovh(args.release, cluster)
@@ -304,6 +312,7 @@ def main():
304312
else:
305313
raise Exception("Cloud cluster not recognised!")
306314

315+
update_networkbans(cluster)
307316
deploy(args.release, args.name)
308317

309318

0 commit comments

Comments
 (0)