Skip to content

Commit 658ef3d

Browse files
authored
Merge pull request #2139 from diggerhq/chore/breardon2011/move-taco-back-in
move taco back in, minus docs
2 parents 6c69422 + 75f113c commit 658ef3d

File tree

105 files changed

+18321
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+18321
-0
lines changed

taco/.dockerignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Documentation
6+
*.md
7+
docs/
8+
agents_*/
9+
10+
# Examples
11+
examples/
12+
13+
# Build artifacts
14+
statesman
15+
taco
16+
terraform-provider-opentaco
17+
*.test
18+
*.out
19+
20+
# Development files
21+
.devdata/
22+
*.log
23+
24+
# IDE files
25+
.vscode/
26+
.idea/
27+
*.swp
28+
*.swo
29+
30+
# OS files
31+
.DS_Store
32+
Thumbs.db
33+
34+
# Temporary files
35+
tmp/
36+
temp/

taco/AGENTS.md

Lines changed: 302 additions & 0 deletions
Large diffs are not rendered by default.

taco/Dockerfile_statesman

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
FROM golang:1.25 as builder
2+
ARG COMMIT_SHA
3+
RUN echo "commit sha: ${COMMIT_SHA}"
4+
5+
# Set the working directory
6+
WORKDIR /go/src/github.com/diggerhq/digger/taco
7+
8+
# Copy all source code
9+
COPY cmd/statesman/ ./cmd/statesman/
10+
COPY internal/ ./internal/
11+
COPY pkg/sdk/ ./pkg/sdk/
12+
13+
# Download dependencies and build
14+
RUN cd cmd/statesman && \
15+
go mod tidy && \
16+
CGO_ENABLED=0 GOOS=linux go build \
17+
-ldflags="-X 'main.Version=${COMMIT_SHA}' -s -w" \
18+
-a -installsuffix cgo \
19+
-o statesman .
20+
21+
# Multi-stage build - use a minimal image for runtime
22+
FROM ubuntu:24.04 as runner
23+
ARG COMMIT_SHA
24+
WORKDIR /app
25+
26+
# Install ca-certificates for HTTPS requests
27+
RUN apt-get update && \
28+
apt-get install -y ca-certificates && \
29+
apt-get clean && \
30+
rm -rf /var/lib/apt/lists/*
31+
32+
RUN echo "commit sha: ${COMMIT_SHA}"
33+
34+
# Copy the binary from builder stage
35+
COPY --from=builder /go/src/github.com/diggerhq/digger/taco/cmd/statesman/statesman /app/statesman
36+
37+
# Make the binary executable
38+
RUN chmod +x /app/statesman
39+
40+
# Expose the port that statesman runs on
41+
EXPOSE 8080
42+
43+
# Set environment variables with defaults
44+
ENV OPENTACO_PORT=8080
45+
ENV OPENTACO_STORAGE=memory
46+
47+
# Health check
48+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
49+
CMD curl -f http://localhost:8080/healthz || exit 1
50+
51+
# Run the statesman binary
52+
ENTRYPOINT ["/app/statesman"]

taco/Makefile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
.PHONY: all build test lint clean svc cli prov help docker-build-svc docker-run-svc docker-clean
2+
3+
# Default goal
4+
.DEFAULT_GOAL := help
5+
6+
# Build all components
7+
all: build ## Build all components
8+
9+
build: build-svc build-cli build-prov ## Build service, CLI, and provider
10+
11+
build-svc: ## Build the OpenTaco service
12+
@echo "Building OpenTaco service..."
13+
cd cmd/statesman && GOWORK=off go build -o ../../statesman .
14+
15+
build-cli: ## Build the taco CLI
16+
@echo "Building taco CLI..."
17+
cd cmd/taco && GOWORK=off go build -o ../../taco .
18+
19+
build-prov: ## Build the Terraform provider
20+
@echo "Building Terraform provider..."
21+
cd providers/terraform/opentaco && GOWORK=off go build -o ../../../terraform-provider-opentaco .
22+
23+
install: install-svc install-cli ## Install service and CLI
24+
25+
install-svc: ## Build the OpenTaco service
26+
@echo "Installing OpenTaco service..."
27+
cd cmd/statesman && GOWORK=off go install .
28+
29+
install-cli: ## Build the taco CLI
30+
@echo "Installing taco CLI..."
31+
cd cmd/taco && GOWORK=off go install .
32+
33+
# Run components
34+
svc: build-svc ## Run the OpenTaco service
35+
@echo "Starting OpenTaco service on :8080..."
36+
./statesman
37+
38+
cli: build-cli ## Build and show CLI help
39+
@echo "Taco CLI built. Run ./taco --help for usage"
40+
./taco --help
41+
42+
# Development
43+
test: ## Run tests
44+
@echo "Running tests..."
45+
cd cmd/statesman && go test ./...
46+
cd cmd/taco && go test ./...
47+
cd pkg/sdk && go test ./...
48+
cd providers/terraform/opentaco && go test ./...
49+
50+
lint: ## Run linters
51+
@echo "Running linters..."
52+
golangci-lint run ./...
53+
54+
clean: ## Clean build artifacts
55+
@echo "Cleaning build artifacts..."
56+
rm -f statesman taco terraform-provider-opentaco
57+
rm -rf .devdata/*
58+
find . -name "*.test" -delete
59+
find . -name "*.out" -delete
60+
61+
# Initialize modules
62+
init: ## Initialize Go modules
63+
@echo "Initializing Go modules..."
64+
cd cmd/statesman && go mod init github.com/digger/opentaco/cmd/statesman && go mod tidy
65+
cd cmd/taco && go mod init github.com/digger/opentaco/cmd/taco && go mod tidy
66+
cd pkg/sdk && go mod init github.com/digger/opentaco/pkg/sdk && go mod tidy
67+
cd providers/terraform/opentaco && go mod init github.com/digger/opentaco/providers/terraform/opentaco && go mod tidy
68+
69+
# Docker targets
70+
docker-build-svc: ## Build statesman Docker image
71+
@echo "Building statesman Docker image..."
72+
docker build -f Dockerfile_statesman -t statesman:latest --build-arg COMMIT_SHA=$(shell git rev-parse HEAD) .
73+
74+
docker-run-svc: ## Run statesman in Docker container
75+
@echo "Running statesman in Docker container..."
76+
docker run -p 8080:8080 \
77+
-e OPENTACO_STORAGE=memory \
78+
-e OPENTACO_AUTH_DISABLE=true \
79+
--name statesman-container \
80+
statesman:latest
81+
82+
docker-clean: ## Clean Docker images and containers
83+
@echo "Cleaning Docker artifacts..."
84+
docker stop statesman-container 2>/dev/null || true
85+
docker rm statesman-container 2>/dev/null || true
86+
docker rmi statesman:latest 2>/dev/null || true
87+
88+
help: ## Show this help
89+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)