Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
226caa6
fix(provider): prepare updates before publishing
skevetter Oct 11, 2026
efb67cf
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 11, 2026
c0886a0
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 13, 2026
7b93484
fix(provider): preserve prepared binary families during updates
skevetter Oct 13, 2026
9342c26
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 13, 2026
5d3003f
test(provider): require Windows update preservation coverage
skevetter Oct 13, 2026
bcff13c
fix(provider): handle confined Windows parent symlinks
skevetter Oct 13, 2026
2e737f6
test(provider): classify unavailable Windows symlink privileges
skevetter Oct 13, 2026
4be8541
Merge remote-tracking branch 'origin/main' into codex/provider-update…
skevetter Oct 13, 2026
37df5eb
fix(provider): retain successful updates after staging cleanup errors
skevetter Oct 13, 2026
a9b8d08
fix(provider): normalize archive symlink separators on Windows
skevetter Oct 13, 2026
e7a22ed
chore: integrate shared MicroSandbox test foundation
skevetter Oct 13, 2026
e47c360
fix(ci): avoid Windows Go cache post-job timeouts
skevetter Oct 13, 2026
b983124
fix(provider): validate staged aliases and restore directory modes
skevetter Oct 13, 2026
6f1a04e
chore(runtime): integrate MicroSandbox compatibility coverage
skevetter Oct 13, 2026
0d86035
fix(ci): report all Windows provider coverage failures
skevetter Oct 13, 2026
6f54850
test(provider): check symlink capability for staged alias coverage
skevetter Oct 13, 2026
3ebbcf5
fix(ci): retain Windows Go caching with cold-run headroom
skevetter Oct 13, 2026
5edb781
fix(provider): preserve valid staged update inputs
skevetter Oct 13, 2026
339604e
test(ssh): observe owned reverse-forward listener closure
skevetter Oct 14, 2026
304d654
test(provider): validate sparse archives on Windows
skevetter Oct 14, 2026
a61350a
chore(provider): integrate latest main
skevetter Oct 14, 2026
564d2b6
chore(provider): integrate latest main
skevetter Oct 14, 2026
d5a4759
fix(provider): preserve contiguous tar files during updates
skevetter Oct 14, 2026
495c4a3
refactor(ci): extract provider and MicroSandbox workflow helpers
skevetter Oct 14, 2026
aaec200
refactor(ci): implement provider test helpers in Go
skevetter Oct 14, 2026
a9c7fbb
refactor(ci): avoid shadowing builtin in output capture
skevetter Oct 14, 2026
11379f6
refactor(ci): discover provider update test coverage
skevetter Oct 14, 2026
4497f09
test(ci): preserve portable MicroSandbox helper coverage
skevetter Oct 14, 2026
3cfd899
fix(ci): discard invalid MicroSandbox installer archives
skevetter Oct 14, 2026
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
134 changes: 61 additions & 73 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- '.goreleaser.yml'
- 'e2e/**'
- 'hack/microsandbox/**'
- 'hack/provider_update_ci/**'
- 'hack/run-managed-policy-e2e.sh'
- '.github/workflows/pr-ci.yml'
- 'hack/licenses/**'
Expand Down Expand Up @@ -133,6 +134,38 @@ jobs:
go test -race -short -count=1 -v ./e2e/tests/up-docker-compose \
-run '^TestExpectedUIDMapping$'

provider-update-windows:
name: Provider Update Tests (windows-latest)
needs: [changes]
if: needs.changes.outputs.go == 'true'
runs-on: windows-latest
# Allow cold Go compilation and the post-job cache save to complete.
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod

- name: test Go CI helpers on Windows
run: go test -race -count=1 -timeout 10m ./hack/microsandbox ./hack/provider_update_ci

- name: run provider update tests and require Windows coverage
shell: pwsh
run: go run ./hack/provider_update_ci --artifacts-dir "$env:RUNNER_TEMP"

- name: upload provider update test JSON on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: provider-update-windows-test-json
path: |
${{ runner.temp }}/provider-update-windows.jsonl
${{ runner.temp }}/provider-update-windows.exitcode
if-no-files-found: ignore

can-read-secret:
name: Can Read Secret
runs-on: ubuntu-latest
Expand All @@ -158,7 +191,8 @@ jobs:
- runner: ubuntu-latest
- runner: macos-latest
- runner: windows-latest
job_timeout_minutes: 30
# Cold builds need room to save the Go cache after artifact uploads.
job_timeout_minutes: 45
runs-on: ${{ matrix.runner }}
timeout-minutes: ${{ matrix.job_timeout_minutes || 20 }}
steps:
Expand All @@ -167,8 +201,6 @@ jobs:
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod
# Windows cache archiving can consume the post-job budget after a successful build.
cache: ${{ runner.os != 'Windows' }}

- name: get operating system lowercase
id: os
Expand Down Expand Up @@ -219,6 +251,19 @@ jobs:
name: devsy-${{ steps.os.outputs.runner_os }}
path: dist/devsy-${{ steps.os.outputs.runner_os }}_*/devsy-${{ steps.os.outputs.runner_os }}-*

- name: build MicroSandbox CI helper
if: runner.os == 'Linux'
env:
CGO_ENABLED: 0
run: go build -trimpath -o "${RUNNER_TEMP}/devsy-ci-microsandbox" ./hack/microsandbox

- name: upload MicroSandbox CI helper
if: runner.os == 'Linux'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: devsy-ci-microsandbox-linux
path: ${{ runner.temp }}/devsy-ci-microsandbox

- name: build e2e test binary
if: matrix.runner == 'ubuntu-latest' || matrix.runner == 'windows-latest'
shell: bash
Expand Down Expand Up @@ -383,6 +428,15 @@ jobs:
name: e2e-test-linux
path: ./e2e/

- name: download MicroSandbox CI helper
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: devsy-ci-microsandbox-linux
path: ${{ runner.temp }}

- name: setup MicroSandbox CI helper
run: chmod +x "${RUNNER_TEMP}/devsy-ci-microsandbox"

- name: setup executable
shell: bash
working-directory: ./e2e
Expand All @@ -394,9 +448,6 @@ jobs:
chmod +x ./e2e.test
ls -R ./bin/

- name: test Ginkgo report validator
run: python3 -m unittest discover -s hack/microsandbox -p 'test_*.py'

- name: cache microsandbox release bundle (Linux)
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
Expand All @@ -405,82 +456,17 @@ jobs:

- name: install checksum-pinned microsandbox (Linux)
timeout-minutes: 5
run: |
archive="${RUNNER_TEMP}/microsandbox-linux-x86_64-v0.7.7.tar.gz"
if [ ! -f "$archive" ]; then
curl -fsSL --retry 3 -o "$archive" \
https://github.com/superradcompany/microsandbox/releases/download/v0.7.7/microsandbox-linux-x86_64.tar.gz
fi
echo "b3cc4a5e3f52dfdd938a6f67ac4a9a959ddfe304bab56de4964044b8613f01bb $archive" | sha256sum -c -
staging="$(mktemp -d)"
trap 'rm -rf "$staging"' EXIT
tar -xzf "$archive" -C "$staging"
mkdir -p "$HOME/.microsandbox/bin" "$HOME/.microsandbox/lib" "$HOME/.local/bin"
install -m 755 "$staging/msb" "$HOME/.microsandbox/bin/msb"
install -m 644 "$staging/libkrunfw.so.5.6.1" "$HOME/.microsandbox/lib/"
ln -sf libkrunfw.so.5.6.1 "$HOME/.microsandbox/lib/libkrunfw.so.5"
ln -sf libkrunfw.so.5 "$HOME/.microsandbox/lib/libkrunfw.so"
ln -sf "$HOME/.microsandbox/bin/msb" "$HOME/.local/bin/msb"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
"$HOME/.local/bin/msb" --version
sudo test -r /dev/kvm
sudo test -w /dev/kvm
run: '"${RUNNER_TEMP}/devsy-ci-microsandbox" install-linux'

- name: run MicroSandbox test
shell: bash
working-directory: ./e2e
env:
GH_USERNAME: ${{ github.repository_owner }}
GH_ACCESS_TOKEN: ${{ github.token }}
GH_CREDENTIAL_USERNAME: x-access-token
TEST_TIMEOUT: 1200s
DEVSY_REQUIRE_MICROSANDBOX: "true"
run: |
set -uo pipefail
report="${RUNNER_TEMP}/microsandbox-${{ matrix.label }}.json"
test_log="${RUNNER_TEMP}/microsandbox-${{ matrix.label }}.log"
command=(./e2e.test -test.v -ginkgo.v -test.timeout "${TEST_TIMEOUT}"
-ginkgo.fail-on-empty -ginkgo.flake-attempts=1
--ginkgo.label-filter="${{ matrix.label }}" -ginkgo.json-report="$report")
fixture_environment=()
if [ "${{ matrix.label }}" = "up-provider-microsandbox-managed-recreate" ]; then
command=(../hack/run-managed-policy-e2e.sh "${command[@]}")
fixture_environment=(DEVSY_REQUIRE_MSB_MANAGED_POLICY_FIXTURE=true "RUNNER_TEMP=${RUNNER_TEMP}")
fi
set +e
sudo \
DEVSY_REQUIRE_MICROSANDBOX="${DEVSY_REQUIRE_MICROSANDBOX}" \
GH_USERNAME="${GH_USERNAME}" \
GH_ACCESS_TOKEN="${GH_ACCESS_TOKEN}" \
GH_CREDENTIAL_USERNAME="${GH_CREDENTIAL_USERNAME}" \
KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}" \
${DOCKER_HOST:+DOCKER_HOST="${DOCKER_HOST}"} \
PATH="${PATH}" \
"${fixture_environment[@]}" "${command[@]}" 2>&1 | tee "$test_log"
pipeline_status=("${PIPESTATUS[@]}")
set -e
test_status=${pipeline_status[0]}
log_status=${pipeline_status[1]}
chown_status=0
if [ -e "$report" ]; then
sudo chown "$(id -u):$(id -g)" "$report" || chown_status=$?
fi
report_status=0
if [ "$chown_status" -ne 0 ]; then
echo "::error::could not make Ginkgo report readable for artifact upload"
report_status="$chown_status"
else
python3 ../hack/microsandbox/verify_report.py \
--report "$report" --label "${{ matrix.label }}" \
--expected-count "${{ matrix.expected-spec-count }}" || report_status=$?
fi
if [ "$test_status" -ne 0 ]; then
exit "$test_status"
fi
if [ "$log_status" -ne 0 ]; then
exit "$log_status"
fi
exit "$report_status"
run: '"${RUNNER_TEMP}/devsy-ci-microsandbox" run --label "${{ matrix.label }}" --expected-count "${{ matrix.expected-spec-count }}"'

- name: upload MicroSandbox test evidence
if: always()
Expand Down Expand Up @@ -1247,6 +1233,7 @@ jobs:
- lint
- agent-skill
- unit-tests
- provider-update-windows
- licenses
- build-cli
- integration-tests-unprivileged
Expand Down Expand Up @@ -1284,6 +1271,7 @@ jobs:
check_result "lint" "${{ needs.lint.result }}" false || status=1
check_result "agent-skill" "${{ needs.agent-skill.result }}" false || status=1
check_result "unit-tests" "${{ needs.unit-tests.result }}" true || status=1
check_result "provider-update-windows" "${{ needs.provider-update-windows.result }}" true || status=1
check_result "licenses" "${{ needs.licenses.result }}" true || status=1
check_result "build-cli" "${{ needs.build-cli.result }}" true || status=1
check_result "integration-tests-unprivileged" "${{ needs.integration-tests-unprivileged.result }}" true || status=1
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ repos:
rev: v2.13.2
hooks:
- id: golangci-lint
language_version: 1.26.8
language_version: 1.26.9
args: ["--timeout=10m"]
- id: golangci-lint-fmt
language_version: 1.26.8
language_version: 1.26.9
- repo: local
hooks:
- id: golangci-lint-ci-parity
Expand Down
41 changes: 30 additions & 11 deletions cmd/workspace/gpg_tunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"path/filepath"
"slices"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -104,15 +105,15 @@ func TestGPGTunnelRebindsWhenManagedReverseForwardExits(t *testing.T) {
replacement := tunnel.forward
tunnel.stopForward()
waitForManagedReverseForward(t, replacement)
assertReverseForwardListenerReleased(t, forwards.listeners[1])
assertManagedReverseForwardListenerClosed(t, forwards.listeners[1])
}

type testGPGReverseForwards struct {
t *testing.T
userMapping string
userForward *managedReverseForward
userListener net.Listener
listeners []net.Listener
listeners []*closeObservedListener
}

func (f *testGPGReverseForwards) start(
Expand Down Expand Up @@ -164,13 +165,30 @@ func assertUserReverseForwardActive(
}
}

func assertReverseForwardListenerReleased(t *testing.T, stopped net.Listener) {
func assertManagedReverseForwardListenerClosed(t *testing.T, stopped *closeObservedListener) {
t.Helper()
if listener, err := net.Listen("tcp", stopped.Addr().String()); err != nil {
t.Fatalf("replacement listener still bound after stop: %v", err)
} else {
_ = listener.Close()
select {
case <-stopped.closed:
default:
t.Fatal("managed forward completed without closing its owned listener")
}
}

type closeObservedListener struct {
net.Listener
closed chan struct{}
once sync.Once
}

func (l *closeObservedListener) Close() error {
if err := l.Listener.Close(); err != nil {
if errors.Is(err, net.ErrClosed) {
l.once.Do(func() { close(l.closed) })
}
return err
}
l.once.Do(func() { close(l.closed) })
return nil
}

func TestGPGTunnelRetriesUserMappingsAfterInitialBindFailure(t *testing.T) {
Expand Down Expand Up @@ -210,11 +228,12 @@ func TestGPGTunnelRetriesUserMappingsAfterInitialBindFailure(t *testing.T) {
func startTestManagedReverseForward(
ctx context.Context,
client *ssh.Client,
) (*managedReverseForward, net.Listener, error) {
) (*managedReverseForward, *closeObservedListener, error) {
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
return nil, nil, err
}
observed := &closeObservedListener{Listener: listener, closed: make(chan struct{})}
forwardCtx, cancel := context.WithCancel(ctx)
done := make(chan error, 1)
go runManagedReverseForward(managedReverseForwardRun{
Expand All @@ -224,14 +243,14 @@ func startTestManagedReverseForward(
forward: boundReverseForward{
portMapping: "gpg socket",
mapping: port.Mapping{
Host: port.Address{Protocol: "tcp", Address: listener.Addr().String()},
Host: port.Address{Protocol: "tcp", Address: observed.Addr().String()},
Container: port.Address{Protocol: "tcp", Address: "127.0.0.1:1"},
},
listener: listener,
listener: observed,
},
doneChan: done,
})
return &managedReverseForward{cancel: cancel, done: done}, listener, nil
return &managedReverseForward{cancel: cancel, done: done}, observed, nil
}

func waitForManagedReverseForward(t *testing.T, forward *managedReverseForward) {
Expand Down
9 changes: 6 additions & 3 deletions e2e/tests/up/MICROSANDBOX.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ callbacks into the session.
## Continuous integration

The dedicated `integration-tests-microsandbox` job in
`.github/workflows/pr-ci.yml` owns the suite catalogue and common setup. Each
suite still gets a fresh runner, a 25-minute job limit and a 20-minute test limit,
`.github/workflows/pr-ci.yml` owns the suite catalogue, runner configuration and
artifact uploads. The Go utility in `hack/microsandbox` installs and checks the
pinned Linux bundle and owns test execution, managed fixture selection, output
capture and report validation. The Linux build job supplies its CI-only executable;
it is not a Devsy release artifact. Each suite still gets a fresh runner, a 25-minute job limit and a 20-minute test limit,
with one attempt. The checked runtime bundle, build artifacts, required KVM gate
and credentials are configured once in the job definition.

Each matrix entry names its Ginkgo label and expected scenario count.
`hack/microsandbox/verify_report.py` requires a real successful run with that
The helper's `verify-report` command requires a real successful run with that
exact count, split equally between the explicit `microsandbox-builtin` and
`microsandbox-external` labels. Missing cases, skips, retries, dry runs and
programmatic focus fail the gate. Reports and test output are retained even when
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/devsy-org/devsy

go 1.26.8
go 1.26.9

require (
al.essio.dev/pkg/shellescape v1.6.1
Expand Down
33 changes: 33 additions & 0 deletions hack/microsandbox/command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"errors"
"io"
"os/exec"
)

type suiteConfig struct {
label string
expectedCount int
repositoryDir string
tempDir string
testTimeout string
}

type commandRunner func(*exec.Cmd) error

type commandOutput struct {
stdout io.Writer
stderr io.Writer
}

func commandExitCode(err error) int {
if err == nil {
return 0
}
var exitErr *exec.ExitError
if errors.As(err, &exitErr) && exitErr.ExitCode() > 0 {
return exitErr.ExitCode()
}
return 1
}
Loading
Loading