This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
name: Controller CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ces-control
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
GITEA_JOB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout controller source
|
||||
run: |
|
||||
git init .
|
||||
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
|
||||
git -c http.extraHeader="Authorization: token $GITEA_JOB_TOKEN" fetch --depth 1 origin "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
|
||||
- name: Verify controller
|
||||
run: |
|
||||
python3 -m py_compile controller.py
|
||||
python3 -m unittest discover -s tests -v
|
||||
|
||||
- name: Confirm no paid action ran
|
||||
run: |
|
||||
echo "Controller CI only validates code; it never creates an AutoDL instance."
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Manage AutoDL GPU runner
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
operation:
|
||||
description: discover, provision, status, or shutdown
|
||||
required: true
|
||||
default: discover
|
||||
image_uuid:
|
||||
description: Required only for provision
|
||||
required: false
|
||||
default: ""
|
||||
confirm_spend:
|
||||
description: Type CREATE to provision a billed instance
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
manage:
|
||||
runs-on: ces-control
|
||||
timeout-minutes: 180
|
||||
env:
|
||||
AUTODL_API_TOKEN: ${{ secrets.AUTODL_API_TOKEN }}
|
||||
TRAINING_RUNNER_REGISTRATION_TOKEN: ${{ secrets.TRAINING_RUNNER_REGISTRATION_TOKEN }}
|
||||
GITEA_JOB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
OPERATION: ${{ inputs.operation }}
|
||||
IMAGE_UUID: ${{ inputs.image_uuid }}
|
||||
CONFIRM_SPEND: ${{ inputs.confirm_spend }}
|
||||
steps:
|
||||
- name: Checkout controller source
|
||||
run: |
|
||||
git init .
|
||||
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
|
||||
git -c http.extraHeader="Authorization: token $GITEA_JOB_TOKEN" fetch --depth 1 origin "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
|
||||
- name: Validate requested operation
|
||||
run: |
|
||||
case "$OPERATION" in
|
||||
discover|provision|status|shutdown) ;;
|
||||
*) echo "Unsupported operation" >&2; exit 2 ;;
|
||||
esac
|
||||
|
||||
- name: Manage AutoDL Pro instance
|
||||
run: |
|
||||
python3 controller.py "$OPERATION" \
|
||||
--image-uuid "$IMAGE_UUID" \
|
||||
--confirm-spend "$CONFIRM_SPEND"
|
||||
|
||||
- name: Controller host details
|
||||
if: always()
|
||||
run: |
|
||||
echo "host=$(hostname)"
|
||||
date -Iseconds
|
||||
test -f /root/.local/state/ces-autodl-controller/state.json && \
|
||||
python3 -c 'import json; p="/root/.local/state/ces-autodl-controller/state.json"; d=json.load(open(p)); d.pop("root_password", None); print(json.dumps(d, indent=2))' || true
|
||||
Reference in New Issue
Block a user