view pi-watchdog/tasks.py @ 332:d4893670f888 default tip

WIP: use watchdog reboot timer on pi
author drewp@bigasterisk.com
date Thu, 27 Feb 2025 11:09:29 -0800
parents
children
line wrap: on
line source

import datetime

from invoke import task

# todo- see https://github.com/GoogleContainerTools/skaffold/issues/9543 for one obstacle

now = datetime.datetime.now().replace(microsecond=0)
now = now.isoformat().replace(':', '_').replace('-', '_')
base = 'pi_watchdog'
localImage = f'{base}:{now}'
remoteImage = f'reg:5000/{base}:latest'


@task
def build(ctx):  # workaround for skaffold build
    ctx.run(f'podman manifest create {localImage}', echo=True)
    ctx.run(f'podman build --platform linux/arm64 --manifest {localImage} -f Dockerfile .', echo=True)
    ctx.run(f'podman manifest push {localImage} {remoteImage}', echo=True)
    print(f'{remoteImage} ready for use')


@task(pre=[build])
def run(ctx):
    ctx.run('kubectl apply -f deploy.yaml', echo=True)