Skip to content

Commit 22ade90

Browse files
blink-so[bot]f0ssel
andcommitted
update build scripts and workflows for cmd/jail project structure
Updated all build tooling to work with the moved main.go: ## Files Updated ### Makefile - Updated build target: ./cmd/jail instead of . - Updated build-all target: all cross-platform builds use ./cmd/jail - Version injection still works with -X main.version= ### Build Script (scripts/build.sh) - Updated to build from ./cmd/jail directory - All platform builds now use correct path ### GitHub Actions Workflows - build.yml: Updated build command to use ./cmd/jail - release.yml: Updated build command to use ./cmd/jail - Version injection path remains main.version (package didn't change) ### README.md - Updated build examples: go build -o jail ./cmd/jail - Updated development section manual commands - Updated Quick Start build example ## Tested - ✅ make build works correctly - ✅ ./scripts/build.sh creates all 4 binaries - ✅ Version injection works (dev-dd5ba1d) - ✅ Cross-platform builds succeed - ✅ Tests run (though some may have existing issues) ## Compatibility All existing workflows and build processes continue to work with the new cmd/jail project structure. The change is fully backward compatible from a user perspective. Co-authored-by: f0ssel <[email protected]>
1 parent dd5ba1d commit 22ade90

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
fi
6969
7070
# Build using Go directly for cross-compilation
71-
go build -ldflags="-s -w -X main.version=$VERSION" -o ${{ matrix.name }} .
71+
go build -ldflags="-s -w -X main.version=$VERSION" -o ${{ matrix.name }} ./cmd/jail
7272
7373
- name: Upload binary as artifact
7474
uses: actions/upload-artifact@v4

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
export CGO_ENABLED=0
6363
6464
# Build using Go directly for cross-compilation
65-
go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o ${{ matrix.name }} .
65+
go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" -o ${{ matrix.name }} ./cmd/jail
6666
6767
- name: Upload binary as artifact
6868
uses: actions/upload-artifact@v4

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ all: build
1515
build:
1616
@echo "Building $(BINARY_NAME) for current platform..."
1717
@echo "Version: $(VERSION)"
18-
go build -ldflags="$(LDFLAGS)" -o $(BINARY_NAME) .
18+
go build -ldflags="$(LDFLAGS)" -o $(BINARY_NAME) ./cmd/jail
1919
@echo "✓ Built $(BINARY_NAME)"
2020

2121
# Build for all supported platforms
@@ -25,13 +25,13 @@ build-all:
2525
@echo "Version: $(VERSION)"
2626
@mkdir -p $(BUILD_DIR)
2727
@echo "Building Linux amd64..."
28-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 .
28+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/jail
2929
@echo "Building Linux arm64..."
30-
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 .
30+
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/jail
3131
@echo "Building macOS amd64..."
32-
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 .
32+
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/jail
3333
@echo "Building macOS arm64..."
34-
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 .
34+
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/jail
3535
@echo "✓ All binaries built successfully!"
3636
@echo "Binaries are in the '$(BUILD_DIR)' directory:"
3737
@ls -la $(BUILD_DIR)/

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ sudo mv jail /usr/local/bin/
3131
```bash
3232
git clone https://github.com/coder/jail
3333
cd jail
34-
make build # or: go build -o jail .
34+
make build # or: go build -o jail ./cmd/jail
3535
```
3636

3737
### Usage
@@ -162,7 +162,7 @@ cd jail
162162
make build
163163

164164
# Or directly with Go
165-
go build -o jail .
165+
go build -o jail ./cmd/jail
166166
```
167167

168168
## Command-Line Options
@@ -207,14 +207,14 @@ make lint
207207

208208
```bash
209209
# Build directly with Go
210-
go build -o jail .
210+
go build -o jail ./cmd/jail
211211

212212
# Run tests
213213
go test ./...
214214

215215
# Cross-compile manually
216-
GOOS=linux GOARCH=amd64 go build -o jail-linux .
217-
GOOS=darwin GOARCH=amd64 go build -o jail-macos .
216+
GOOS=linux GOARCH=amd64 go build -o jail-linux ./cmd/jail
217+
GOOS=darwin GOARCH=amd64 go build -o jail-macos ./cmd/jail
218218

219219
# Use build script for all platforms
220220
./scripts/build.sh

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ for config in "${configs[@]}"; do
3939

4040
env GOOS="$goos" GOARCH="$goarch" CGO_ENABLED=0 go build \
4141
-ldflags="-s -w -X main.version=$VERSION" \
42-
-o "$BUILD_DIR/$name" .
42+
-o "$BUILD_DIR/$name" ./cmd/jail
4343

4444
if [ $? -eq 0 ]; then
4545
size=$(du -h "$BUILD_DIR/$name" | cut -f1)

0 commit comments

Comments
 (0)