diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index a1bfa37d..291a0675 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -39,9 +39,11 @@ jobs: - 'scripts/incus-canary.mjs' - '.dockerignore' - '.github/workflows/docker-build.yml' + - 'scripts/promote-main-image.sh' worker: - 'worker/**' - '.github/workflows/docker-build.yml' + - 'scripts/promote-main-image.sh' validation: - 'orchestrator/**' - 'worker/**' @@ -52,6 +54,7 @@ jobs: - 'scripts/agentor-incus-network-service.py' - 'scripts/setup-incus-host.sh' - 'scripts/profile-ci-workflow.py' + - 'scripts/promote-main-image.sh' - '.dockerignore' - 'tests/**' - 'docker-compose.tests.yml' @@ -366,11 +369,11 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/agentor-orchestrator tags: | - type=ref,event=branch + type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha - type=raw,value=latest,enable={{is_default_branch}} + type=sha,format=long - run: | cd /tmp/digests @@ -468,11 +471,11 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/agentor-worker tags: | - type=ref,event=branch + type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=sha - type=raw,value=latest,enable={{is_default_branch}} + type=sha,format=long - run: | cd /tmp/digests @@ -480,3 +483,49 @@ jobs: TAGS=$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") SOURCES=$(for f in *; do echo "$IMAGE@$(cat $f)"; done) docker buildx imagetools create $TAGS $SOURCES + + promote-main: + name: Promote main (${{ matrix.image }}) + needs: [merge-orchestrator, merge-worker] + if: >- + always() && github.ref == 'refs/heads/main' && + github.event_name != 'pull_request' && + (needs.merge-orchestrator.result == 'success' || needs.merge-worker.result == 'success') + strategy: + fail-fast: false + matrix: + include: + - image: agentor-orchestrator + merge-result: ${{ needs.merge-orchestrator.result }} + - image: agentor-worker + merge-result: ${{ needs.merge-worker.result }} + # Keep the freshness check and both shared tags under the same per-image lock. + concurrency: + group: main-image-promotion-${{ github.repository }}-${{ matrix.image }} + cancel-in-progress: false + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + if: matrix.merge-result == 'success' + with: + persist-credentials: false + + - uses: docker/setup-buildx-action@v3 + if: matrix.merge-result == 'success' + + - uses: docker/login-action@v3 + if: matrix.merge-result == 'success' + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Promote only the current main revision + if: matrix.merge-result == 'success' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IMAGE: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.image }} + run: bash scripts/promote-main-image.sh diff --git a/docs/image-publication.md b/docs/image-publication.md new file mode 100644 index 00000000..bb5c6ce1 --- /dev/null +++ b/docs/image-publication.md @@ -0,0 +1,30 @@ +# Image publication + +Orchestrator and worker builds publish multi-platform manifests only after the +CI test gate. Pull requests build without registry login or publication. Release +tags retain their existing version and major/minor tags. + +Each successful merge publishes `sha-` before shared-tag +promotion. The existing short SHA tags remain available for compatibility; +use the full SHA reference for commit-specific deployments. + +Main promotion uses a separate job with a per-image concurrency group and +`cancel-in-progress: false`. The lock covers the main HEAD check and the single +manifest command that updates `main` and `latest`. An older run finishing after +a newer run cannot move either shared tag back to its older revision. Pending +promotion jobs may be replaced by GitHub concurrency scheduling, but immutable +SHA publication has already completed outside that lock. + +A run whose commit is no longer main HEAD skips shared tags and reports that +its SHA references remain available. This also applies when a newer commit only +changes unrelated files: shared tags stay on the previously promoted image until +a current-head image build succeeds (a manual main run builds both images). +If the HEAD lookup fails, promotion fails closed with a bounded reason; it does +not affect the already published SHA references. Registry failures may partially +update shared tags; rerun the current main workflow to recover. + +Run the registry-free reverse-completion regression with: + +```sh +python3 -m unittest discover -s tests/helpers -p test_main_image_promotion.py +``` diff --git a/docs/pane-lifecycle.md b/docs/pane-lifecycle.md new file mode 100644 index 00000000..07ec63ed --- /dev/null +++ b/docs/pane-lifecycle.md @@ -0,0 +1,17 @@ +# Pane discovery during worker lifecycle changes + +`GET /api/containers/:id/panes` requires the same authenticated ownership checks +as before. It executes guest commands only for confirmed running compute without +an unsettled lifecycle operation. + +A confirmed stopped worker returns HTTP 409. Unknown/unresponsive or changing +compute returns HTTP 503. Both include `data.code: WORKER_PANES_UNAVAILABLE` and +the observed `data.status`; desired stopped intent alone is not proof of a stop. +Missing workers return 404. An expected lifecycle rejection never changes stopped +state into unknown, and delayed probes cannot overwrite newer lifecycle state. + +The GUI uses the shared worker inventory to suspend discovery when compute is +not confirmed running. Failed discovery backs off from six seconds to at most +48 seconds, without overlapping periodic requests. A verified transition back +to running resumes discovery immediately. Closing a pane cancels its polling, +including after a late response. diff --git a/docs/vm-vcpu-changes.md b/docs/vm-vcpu-changes.md index f7f25707..5033c01b 100644 --- a/docs/vm-vcpu-changes.md +++ b/docs/vm-vcpu-changes.md @@ -2,7 +2,7 @@ The **Virtual CPU cores** editor is available in ordinary VM settings and in platform/group administrative VM management. It shows the assigned count from -the owned VM definition and the maximum reported by the Incus backend. +the owned VM definition and the maximum allowed by the Incus backend and inherited group policy. 1. Stop the VM, then select **Refresh vCPU count**. 2. Enter a positive integer within the backend maximum and select **Save vCPU @@ -35,3 +35,50 @@ Administrative VM changes also require an installed host policy that advertises CPU-count update support. Older policy installations reject the update before changing compute. Follow the bounded policy update procedure in [administrative networking](incus-admin-private-networks.md). + +## Group ceilings and delegation + +Groups have an optional **Maximum vCPUs per worker** setting. It limits each VM +independently; there is no cumulative group CPU pool. The effective ceiling is +the lowest configured value in the group's ancestry, including the group itself. +A blank setting inherits. A new explicit child ceiling cannot exceed its effective +parent ceiling. The effective maximum shown by the CPU editor also respects the +backend's CPU capacity. + +Global administrators can configure root and child ceilings. Group administrators +can configure only descendant groups, within the effective parent ceiling; they +cannot raise or clear the ceiling of their own administrative group. No delegated +resize is allowed until an inherited ceiling has been configured. Ordinary owner +REST access remains subject to applicable group ceilings. Platform administrative +VMs remain restricted to global administration. + +Ceilings apply to ordinary and group administrative VM allocation, including new +VM definitions and replacement/import paths. Existing VM allocations remain +visible and are not automatically shrunk or stopped after a ceiling is lowered. +Their next new allocation must fit. Reading or reconciling an already submitted +CPU operation does not submit another allocation and remains available. + +Moving a capped worker to an uncapped or more permissive group is rejected; +a global administrator must first adjust the source ceiling. Group administrators +cannot reparent groups to escape an inherited ceiling. The server enforces these +checks for GUI, REST and management MCP callers. + +vCPU counts describe guest CPUs, not reserved host CPU time. A per-worker ceiling +does not prevent aggregate host CPU contention when many workers run together. + +## Management MCP + +Use `workers.cpu.get`, `workers.cpu.set`, and `workers.cpu.reconcile` for ordinary +workers (`workerId`). Use `admin-workspace.cpu.get/set/reconcile` for the calling +administrative workspace, and `groups.admin-workspace.cpu.get/set/reconcile` +with `groupId` for a group administrative workspace. Group identities can target +only their bound group and live descendants. Global identities can administer +all applicable targets. + +Set requests take a positive integer `vcpuCount` and, when required, `lockPassword`. +Stop the VM explicitly first, inspect its CPU settings, set the count, start it, +and inspect again. A caller timeout does not cancel the backend operation. +Inspect pending state and use the explicit reconciliation tool; it can observe +only the recorded operation and cannot create a new resize. Group ceilings can +be configured through `groups.create` and `groups.update` using `maxVcpuCount` +(a positive integer or null to inherit), subject to the delegation rules above. diff --git a/orchestrator/app/components/VcpuEditor.vue b/orchestrator/app/components/VcpuEditor.vue index 58f6e244..920b43bf 100644 --- a/orchestrator/app/components/VcpuEditor.vue +++ b/orchestrator/app/components/VcpuEditor.vue @@ -38,7 +38,7 @@ onMounted(() => { void request(); });

Stop the VM before changing its vCPU count. Save, then start it normally; storage is retained.