Files
SnarfCode/scripts/upgrade_jenkins.py

24 lines
803 B
Python

import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
def run(cmd):
print(f"=== {cmd} ===")
_, out, err = ssh.exec_command(cmd)
res = out.read().decode().strip()
if res:
print(res)
e = err.read().decode().strip()
if e:
print("ERR:", e)
print("[*] Upgrading Jenkins StatefulSet to 2.589-jdk21 on Spaceport...")
run("kubectl set image statefulset/jenkins jenkins=docker.io/jenkins/jenkins:2.589-jdk21 -n infrastructure")
run("kubectl rollout status statefulset/jenkins -n infrastructure --timeout=300s")
run("kubectl get pods -n infrastructure -l app.kubernetes.io/name=jenkins -o wide")
ssh.close()