aoh

A tool for running Ansible playbooks with `curl <url> | python` commands
git clone https://git.ashermorgan.net/aoh/
Log | Files | Refs | README

commit 4fc74d1790541021f3a5692860b5d748d4f83441
parent d265b6fd15ec86aa218285102c6fa6b6869ec712
Author: Asher Morgan <asher@ashermorgan.net>
Date:   Sun, 13 Sep 2026 14:03:33 -0700

Setup CI

Diffstat:
A.github/workflows/ci.yml | 28++++++++++++++++++++++++++++
Ddemo/client.Dockerfile | 9---------
Atests/e2e/client.Dockerfile | 6++++++
Atests/e2e/run.sh | 48++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 82 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: Run tests + +on: + push: + pull_request: + +jobs: + run-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run unit tests + run: python -m unittest tests.unit + + - name: Run end-to-end tests + run: ./tests/e2e/run.sh diff --git a/demo/client.Dockerfile b/demo/client.Dockerfile @@ -1,9 +0,0 @@ -# A sample image that may be used for running client commands - -FROM docker.io/ubuntu:26.04 - -RUN apt-get update && apt-get -y install curl python3 sudo - -RUN echo 'hunter2' | passwd --stdin ubuntu - -USER ubuntu diff --git a/tests/e2e/client.Dockerfile b/tests/e2e/client.Dockerfile @@ -0,0 +1,6 @@ +FROM docker.io/ubuntu:26.04 + +RUN apt-get update && apt-get -y install curl python3 sudo + +# Not used by e2e tests, but useful for testing during development: +RUN echo 'hunter2' | passwd --stdin ubuntu diff --git a/tests/e2e/run.sh b/tests/e2e/run.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e + +cd $(dirname $0) + +DOCKER=${DOCKER:-docker} # Set DOCKER=podman to use podman instead of docker + +log=$(mktemp) + +function on_exit() { + echo 'Cleaning up...' + rm -f $log + $DOCKER stop aoh-test-server || true # ignore if already stopped +} +trap on_exit EXIT + +$DOCKER build -t aoh-test-client -f client.Dockerfile . +$DOCKER build -t aoh-test-server ../../ +$DOCKER network create aoh-test || true # ignore if already created + +for i in {1..4}; do + echo ================================ + echo Running test$i.yml... + echo ================================ + + echo > $log + + $DOCKER run --rm --network aoh-test --detach -h aoh-test-server \ + --name aoh-test-server -v ./:/aoh aoh-test-server + sleep 1 + $DOCKER run --rm --network aoh-test --tty aoh-test-client bash -c \ + "curl http://aoh-test-server:8000/run | python3 - test$i.yml" \ + | tee $log + $DOCKER stop aoh-test-server + + if grep 'failed=0' < $log; then + echo ================================ + echo test$i.yml passed. + echo ================================ + echo + else + echo ================================ + echo test$i.yml failed. + echo ================================ + exit 1 + fi +done