Skip to content

Commit

Permalink
Merge pull request #524 from mutagen-io/v018-backports
Browse files Browse the repository at this point in the history
all: backport Docker transport fix in #523
  • Loading branch information
xenoscopic authored Feb 24, 2025
2 parents 2414b7d + ada6a60 commit 55a5f6f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23.2'
go-version: '1.23.6'
- name: "Install sha256sum"
run: brew install coreutils
- run: scripts/ci/setup_go.sh
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
goversion: ['1.22.8', '1.23.2']
goversion: ['1.22.12', '1.23.6']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -93,7 +93,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23.2'
go-version: '1.23.6'
- run: scripts/ci/setup_go.sh
shell: bash
- run: scripts/ci/setup_docker.sh
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23.2'
go-version: '1.23.6'
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
Expand Down
4 changes: 2 additions & 2 deletions images/sidecar/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use an Alpine-based Go builder.
FROM golang:1.23.2-alpine3.20 AS builder
FROM golang:1.23.6-alpine3.21 AS builder

# Disable cgo in order to match the behavior of our release binaries (and to
# avoid the need for gcc on certain architectures).
Expand All @@ -21,7 +21,7 @@ RUN ["go", "build", "-o", "mutagen-agent-sspl", "-tags", "mutagenagent,mutagenss


# Switch to a vanilla Alpine base for the final image.
FROM alpine:3.20 AS base
FROM alpine:3.21 AS base

# Copy the sidecar entry point from the builder.
COPY --from=builder ["/mutagen/mutagen-sidecar", "/usr/bin/mutagen-sidecar"]
Expand Down
17 changes: 16 additions & 1 deletion pkg/agent/transport/docker/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,20 @@ func (t *dockerTransport) ClassifyError(processState *os.ProcessState, errorOutp
return false, false, fmt.Errorf("unable to probe container: %w", err)
}

// Check if the error code indicates that an agent installation attempt is
// warranted. In Docker v28.0.0 and later, the exit codes for "invalid
// command" and "command not found" are properly delineated (into 126 and
// 127, respectively). Prior to that, they were both returned as 126. The
// remainder of this comment applies to pre-v28.0.0 Docker versions and is
// retained for posterity. It makes suggestions about how we might use these
// delineated values to better detect Windows containers, which might be an
// optimization worth pursuing at some point, but it would involve probing
// the Docker engine version and adjusting behavior accordingly. Also, this
// new delineated behavior might not apply on Windows, so we'd need to check
// that first.
//
// For Docker pre-v28.0.0:
//
// Docker alises cases of both "invalid command" (POSIX shell error 126) and
// "command not found" (POSIX shell error 127) to an exit code of 126. It
// even aliases the Windows container equivalents of these errors to 126.
Expand All @@ -533,7 +547,8 @@ func (t *dockerTransport) ClassifyError(processState *os.ProcessState, errorOutp
// Anyway, the exit code we need to look out for with both POSIX and Windows
// containers is 126, and since we know the remote platform already, we can
// return that information without needing to resort to the error string.
if !process.IsPOSIXShellInvalidCommand(processState) {
if !(process.IsPOSIXShellInvalidCommand(processState) ||
process.IsPOSIXShellCommandNotFound(processState)) {
return false, false, errors.New("unknown process exit error")
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/docker/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set the base image.
FROM alpine:3.20
FROM alpine:3.21

# Add the HTTP demo server.
COPY ["httpdemo", "/httpdemo"]
Expand Down

0 comments on commit 55a5f6f

Please sign in to comment.