Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/security-release-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
env:
DAPPER_IMAGE: pasturestack/compose-cli-dapper:${{ github.sha }}
TRIVY_IMAGE: aquasec/trivy:0.74.0@sha256:62b1e65e8869bc4b4c6aa4fa2b21595256c7c2f6018a9d9ad61caf87187c1969
VERSION_OVERRIDE: 0.14.44
VERSION_OVERRIDE: 0.14.45
PLATFORM_COMPAT_JAR_URL: https://api.github.com/repos/PastureStack/orchestration-engine/releases/assets/503322721
PLATFORM_COMPAT_JAR_SHA256: da2a8a51562ed16e296f7e29e99482bb44042ff0834cca679bbe01d951ba1682

Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
}

run_ci
artifact="dist/artifacts/compose-executor-0.14.44-linux-amd64.gz"
artifact="dist/artifacts/compose-executor-0.14.45-linux-amd64.gz"
test -s "$artifact"
cp "$artifact" /tmp/compose-executor-first.gz

Expand All @@ -83,7 +83,7 @@ jobs:
mkdir -p evidence/product
gzip -cd "$artifact" > evidence/product/compose-executor
chmod +x evidence/product/compose-executor
evidence/product/compose-executor --version | grep -F '0.14.44' >/dev/null
evidence/product/compose-executor --version | grep -F '0.14.45' >/dev/null
cp "$artifact" evidence/
(
cd evidence
Expand Down
16 changes: 16 additions & 0 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Compatibility Contract

## 0.14.45 source: bounded Stack transition observation

Stack rollback and finish-upgrade observe each transitioning child for at most
five minutes, polling every 500 ms and publishing original-event progress at
most every ten seconds while pending. These replies use the existing Engine
keepalive protocol; they do not complete the Stack or repeat a child action.
Active children are untouched. Canceled/upgraded rollback and upgraded finish
retain their native owners, configuration and reply contract.

The event worker is the single terminal-error owner. Timeouts, child errors,
reload failures and progress-publish failures propagate instead of disappearing
inside the old WithTimeout wrapper. Deterministic-clock and real HTTP-client
tests cover delayed settling, exactly-once dispatch, keepalive, deadline and
error propagation. Current source tests and normal release qualification do
not establish matching Server native acceptance.

## 0.14.44: cancelled Stack service rollback

The native Compose Stack rollback handler recognizes `canceled-upgrade` instead
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ PastureStack is an independent community effort to preserve, audit, and moderniz

## Project status

The next source candidate, 0.14.45, replaces the three-second child-service
wait with bounded observation and progress replies for Stack rollback and
finish-upgrade. The event worker owns terminal errors; handler failures are
no longer swallowed. Each child action is dispatched once. Current published
artifacts remain 0.14.44 until the normal release checks complete.

The maintained source uses Ubuntu 26.04, Go 1.27.3, and Python 3.14.9 for integration-source verification. Ubuntu build packages, the base image, and Go archives are fixed by snapshot, exact version, and SHA-256. Go dependencies are managed by `go.mod` and a reproducible module vendor tree. AWS access uses AWS SDK for Go v2; container structures use the maintained Moby API module; the command parser uses urfave/cli v3. The abandoned AWS SDK v1, Rancher generated-client modules, event-subscriber module, `docker/libcompose`, and other GOPATH-era dependencies have been removed. The small Rancher 1.6 protocol boundary retained by this compatibility CLI is maintained and tested locally. The Dapper builder does not embed a Docker CLI or mount a Docker socket; Docker is required only on the host to create and run the isolated builder. The maintained binaries are `pasturestack-compose` and `compose-executor`; `platform-compose.yml` is the preferred companion file. Releases are built and verified from the preserved source history; this repository does not enable automated deployment.

The current published [v0.14.44](https://github.com/PastureStack/compose-cli/releases/tag/v0.14.44)
Expand Down
28 changes: 28 additions & 0 deletions docs/releases/compose-executor-0.14.45.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Compose Executor v0.14.45

Stack rollback and finish-upgrade no longer abandon a transitioning service
after six half-second polls. Each child is observed for up to five minutes.
While waiting, progress replies keep the original Engine event alive through
its existing keepalive contract. The executor does not repeat the Stack
handler or reissue an already dispatched child action.

The old WithTimeout adapter swallowed every handler error. Handlers now return
their original errors to the event worker, which alone publishes the terminal
error reply. Timeout, reload, child-transition and progress-publish failures
remain failures rather than a missing completion response. Active children,
previous Stack environment restoration and native service actions are preserved.

Deterministic-clock regressions cover children settling beyond both the old
three-second limit and the Engine's ordinary event timeout, periodic original-
event keepalive, exactly-once rollback/finish dispatch, active-child isolation,
the bounded deadline and failure propagation. No wall-clock sleep determines
test success. Existing Catalog delegation and control-channel tests remain in
the affected-package checks. The toolchain, dependency graph and security gates
are unchanged; normal release qualification still requires reproducible builds,
race tests, native compatibility, full security evidence and CodeQL.

Matching Server runtime acceptance is separate from component qualification.
A successful Stack reply alone does not prove workload readiness or data
preservation. Keep the previous qualified Server image for rollback. Restoring
0.14.44 also restores its short-wait/error-suppression limitation; do not delete
workload data, volumes or an unresolved operation to recover it.
13 changes: 0 additions & 13 deletions executor/handlers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package handlers

import (
"errors"
"fmt"

"github.com/PastureStack/compose-cli/internal/events"
"github.com/PastureStack/compose-cli/internal/rancherclient/v2"
"github.com/sirupsen/logrus"
)

var (
Expand Down Expand Up @@ -48,14 +46,3 @@ func reply(event *events.Event, apiClient *client.RancherClient, data map[string
reply.Data = data
return publishReply(reply, apiClient)
}

func WithTimeout(f func(event *events.Event, apiClient *client.RancherClient) error) func(event *events.Event, apiClient *client.RancherClient) error {
return func(event *events.Event, apiClient *client.RancherClient) error {
err := f(event, apiClient)
if err == ErrTimeout {
logrus.Infof("Timeout processing %s", fmt.Sprintf("%s:%s", event.ResourceType, event.ResourceID))
return nil
}
return nil
}
}
1 change: 0 additions & 1 deletion executor/handlers/create_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func CreateStack(event *events.Event, apiClient *client.RancherClient) error {
err = errors.New("CatalogLaunchDispatchFailed")
}
logger.Errorf("Stack Create Event Failed: %s", logging.SafeLogValue(err))
publishTransitioningReply(err.Error(), event, apiClient, true)
return err
}

Expand Down
75 changes: 75 additions & 0 deletions executor/handlers/service_wait.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package handlers

import (
"fmt"
"time"

"github.com/PastureStack/compose-cli/internal/events"
client "github.com/PastureStack/compose-cli/internal/rancherclient/v2"
)

const (
serviceWaitTimeout = 5 * time.Minute
servicePollInterval = 500 * time.Millisecond
serviceProgressInterval = 10 * time.Second
)

// Only observe the child after dispatch. Replaying the Stack handler while a
// child is transitioning could repeat a native mutation. Progress replies keep
// the original Engine event alive; its terminal reply stays with the handler.
type serviceWaiter struct {
reload func(*client.Service) error
progress func() error
now func() time.Time
sleep func(time.Duration)
}

func newServiceWaiter(event *events.Event, apiClient *client.RancherClient) serviceWaiter {
return serviceWaiter{
reload: func(service *client.Service) error {
return apiClient.Reload(&service.Resource, service)
},
progress: func() error {
reply := newReply(event)
reply.Transitioning = "yes"
reply.TransitioningMessage = "Waiting for Stack services"
return publishReply(reply, apiClient)
},
now: time.Now,
sleep: time.Sleep,
}
}

func (w serviceWaiter) wait(service *client.Service) error {
deadline := w.now().Add(serviceWaitTimeout)
nextProgress := w.now()
for {
if err := w.reload(service); err != nil {
return err
}
switch service.Transitioning {
case "no":
return nil
case "yes":
// Continue observing below without repeating an action.
default:
return fmt.Errorf("Waiting for %s failed: %s", service.Name, service.TransitioningMessage)
}

now := w.now()
if !now.Before(deadline) {
return fmt.Errorf("%w: %s", ErrTimeout, service.Name)
}
if !now.Before(nextProgress) {
if err := w.progress(); err != nil {
return err
}
nextProgress = now.Add(serviceProgressInterval)
}
delay := servicePollInterval
if remaining := deadline.Sub(now); remaining < delay {
delay = remaining
}
w.sleep(delay)
}
}
96 changes: 96 additions & 0 deletions executor/handlers/service_wait_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package handlers

import (
"errors"
"testing"
"time"

client "github.com/PastureStack/compose-cli/internal/rancherclient/v2"
)

func TestServiceWaiterUsesBoundedObservationAndKeepalive(t *testing.T) {
for _, pendingReads := range []int{0, 8, 100} {
t.Run(time.Duration(pendingReads).String(), func(t *testing.T) {
now := time.Unix(0, 0)
reads, progress, pauses := 0, 0, 0
waiter := serviceWaiter{
now: func() time.Time { return now },
sleep: func(delay time.Duration) {
if delay != servicePollInterval {
t.Fatalf("unexpected observation interval: %s", delay)
}
now = now.Add(delay)
pauses++
},
reload: func(s *client.Service) error {
reads++
s.Transitioning = "yes"
if reads > pendingReads {
s.Transitioning = "no"
}
return nil
},
progress: func() error { progress++; return nil },
}
if err := waiter.wait(&client.Service{}); err != nil {
t.Fatal(err)
}
wantProgress := 0
if pendingReads > 0 {
wantProgress = (pendingReads-1)/20 + 1
}
if reads != pendingReads+1 || pauses != pendingReads || progress != wantProgress {
t.Fatalf("reads/pauses/progress = %d/%d/%d", reads, pauses, progress)
}
})
}
}

func TestServiceWaiterReportsDeadlineAndErrors(t *testing.T) {
for _, failure := range []string{"deadline", "reload", "progress", "child"} {
t.Run(failure, func(t *testing.T) {
now := time.Unix(0, 0)
reads, progress, pauses := 0, 0, 0
original := errors.New("original failure")
waiter := serviceWaiter{
now: func() time.Time { return now },
sleep: func(delay time.Duration) { now = now.Add(delay); pauses++ },
reload: func(s *client.Service) error {
reads++
s.Transitioning = "yes"
if failure == "reload" {
return original
}
if failure == "child" {
s.Transitioning = "error"
s.TransitioningMessage = "child failed"
}
return nil
},
progress: func() error {
progress++
if failure == "progress" {
return original
}
return nil
},
}
err := waiter.wait(&client.Service{Name: "one-child"})
if err == nil {
t.Fatal("failure was swallowed")
}
if failure == "deadline" {
if !errors.Is(err, ErrTimeout) || now.Sub(time.Unix(0, 0)) != serviceWaitTimeout || reads != 601 || pauses != 600 || progress != 30 {
t.Fatalf("unbounded or early timeout: %v, reads=%d pauses=%d progress=%d", err, reads, pauses, progress)
}
} else if failure == "reload" || failure == "progress" {
if err != original {
t.Fatalf("original failure replaced: %v", err)
}
}
if failure != "deadline" && pauses != 0 {
t.Fatal("retried a failed operation")
}
})
}
}
Loading
Loading