From ce7e6eaca8dce4367c40bc3741f4e2bd6f5b9349 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 22 May 2026 22:11:03 -0400 Subject: [PATCH 1/2] chore: Replace Makefile with Taskfile across repo and labs Replaces all Makefiles (root, lab/network, lab/gvpc) with Taskfile.yaml. Prunes dead targets (kustomize, docker-push, docker-buildx, setup/cleanup-test-e2e, lint-config) and updates all documentation references accordingly. Co-Authored-By: Claude Sonnet 4.6 --- .devcontainer/README.md | 27 +++--- AGENTS.md | 14 +-- CONVENTIONS.md | 4 +- Makefile | 183 -------------------------------------- README.md | 32 +++++++ Taskfile.yaml | 130 +++++++++++++++++++++++++++ lab/README.md | 16 ++-- lab/gvpc/Makefile | 46 ---------- lab/gvpc/README.md | 12 +-- lab/gvpc/Taskfile.yaml | 71 +++++++++++++++ lab/network/Makefile | 35 -------- lab/network/README.md | 17 ++-- lab/network/Taskfile.yaml | 57 ++++++++++++ 13 files changed, 336 insertions(+), 308 deletions(-) delete mode 100644 Makefile create mode 100644 Taskfile.yaml delete mode 100644 lab/gvpc/Makefile create mode 100644 lab/gvpc/Taskfile.yaml delete mode 100644 lab/network/Makefile create mode 100644 lab/network/Taskfile.yaml diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 61006c8..617d7ed 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -35,7 +35,7 @@ This devcontainer provides a complete development environment for the Galactic m - **protoc 25.1** - Protocol Buffer compiler - **protoc-gen-go** - Go code generation for protobuf - **protoc-gen-go-grpc** - gRPC code generation for Go -- **make** - Build automation +- **task** - Build automation - **gcc/build-essential** - C compiler for CGO dependencies - **jq** - JSON processor - **git** - Version control @@ -93,37 +93,38 @@ After the container starts and post-create completes: ```bash # Build the galactic binary -make build +task build # Run unit tests -make test +task test # Run the agent locally -make run-agent +task run-agent # Lint Go code -make lint +task lint # Format Go code -make fmt +task fmt ``` ## Testing ### Unit Tests ```bash -make test +task test ``` ### E2E Tests ```bash -# Automatically creates/tears down Kind cluster -make test-e2e +# Create a Kind cluster +kind create cluster --name galactic-e2e -# Or manually manage the cluster -make setup-test-e2e +# Run e2e tests go test ./test/e2e/ -v -ginkgo.v -make cleanup-test-e2e + +# Tear down +kind delete cluster --name galactic-e2e ``` ## Network Development @@ -153,7 +154,7 @@ Build and test containers inside the devcontainer: ```bash # Build the galactic image -make docker-build +task docker-build # Create a Kind cluster kind create cluster --name galactic-dev diff --git a/AGENTS.md b/AGENTS.md index 65c678e..d756bed 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,13 +23,13 @@ Galactic is the SRv6 data plane for multi-cloud VPC networking. It consists of a ## Development Workflow ``` -make build # produces bin/galactic -make test # fmt + vet + unit tests with coverage -make lint # golangci-lint; lint-fix applies safe auto-fixes -make run-agent # run agent (requires root / CAP_NET_ADMIN) +task build # produces bin/galactic +task test # fmt + vet + unit tests with coverage +task lint # golangci-lint; lint-fix applies safe auto-fixes +task run-agent # run agent (requires root / CAP_NET_ADMIN) ``` -**Before every PR:** `make lint test`. +**Before every PR:** `task lint test`. ## Code Standards @@ -55,12 +55,12 @@ See `lab/README.md` for quick-start commands and prerequisites for each environm ## New Developer Entry Points -1. Run `make build` to verify toolchain; run `make test` to confirm unit tests pass. +1. Run `task build` to verify toolchain; run `task test` to confirm unit tests pass. 2. Read `internal/cni/cni.go` (cmdAdd/cmdDel) to understand the container attach path. 3. Read `internal/agent/srv6/srv6.go` to understand the agent entry point and how it manages SRv6 routes and VRFs. 4. Read `pkg/proto/local/local.go` to understand the gRPC interface between the CNI and the agent. 5. Explore `pkg/common/` for shared utilities (VRF management, sysctl helpers, CNI types). **Likely trip-ups:** -- `make run-agent` requires elevated privileges (netlink, VRF, SRv6 operations need `CAP_NET_ADMIN`). +- `task run-agent` requires elevated privileges (netlink, VRF, SRv6 operations need `CAP_NET_ADMIN`). - There is no operator or webhook in this repository; those components are in a separate project. diff --git a/CONVENTIONS.md b/CONVENTIONS.md index 32765b8..f4bcfbf 100644 --- a/CONVENTIONS.md +++ b/CONVENTIONS.md @@ -87,7 +87,7 @@ Generated protobuf files (`*.pb.go`, `*_grpc.pb.go` in `pkg/proto/local/`) must ### Linting -Run `make lint` before every PR. All linters listed in `.golangci.yml` must pass. Suppressions require a comment explaining why. Notable active linters: `errcheck`, `staticcheck`, `govet`, `revive`, `gocyclo`, `dupl`, `unused`. +Run `task lint` before every PR. All linters listed in `.golangci.yml` must pass. Suppressions require a comment explaining why. Notable active linters: `errcheck`, `staticcheck`, `govet`, `revive`, `gocyclo`, `dupl`, `unused`. Exclusions by path: - `lll` is excluded from `internal/*` @@ -161,7 +161,7 @@ Fixes #42 Before opening a pull request, run all of the following and ensure they pass: ```sh -make lint test +task lint test ``` Agent and CNI kernel-path code is not covered by unit tests. New code in those paths should prefer integration or e2e tests over mock-heavy unit tests. diff --git a/Makefile b/Makefile deleted file mode 100644 index 40039fc..0000000 --- a/Makefile +++ /dev/null @@ -1,183 +0,0 @@ -# Image URL to use all building/pushing image targets -IMG ?= ghcr.io/datum-cloud/galactic:latest - -# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) -ifeq (,$(shell go env GOBIN)) -GOBIN=$(shell go env GOPATH)/bin -else -GOBIN=$(shell go env GOBIN) -endif - -# CONTAINER_TOOL defines the container tool to be used for building images. -# Be aware that the target commands are only tested with Docker which is -# scaffolded by default. However, you might want to replace it to use other -# tools. (i.e. podman) -CONTAINER_TOOL ?= docker - -# Setting SHELL to bash allows bash commands to be executed by recipes. -# Options are set to exit when a recipe line exits non-zero or a piped command fails. -SHELL = /usr/bin/env bash -o pipefail -.SHELLFLAGS = -ec - -.PHONY: all -all: build - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk command is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -.PHONY: help -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Development - -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - GOOS=linux go vet ./... - -.PHONY: test -test: fmt vet ## Run tests. - GOOS=linux go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out - -KIND_CLUSTER ?= galactic-e2e - -.PHONY: setup-test-e2e -setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist - @command -v $(KIND) >/dev/null 2>&1 || { \ - echo "Kind is not installed. Please install Kind manually."; \ - exit 1; \ - } - @case "$$($(KIND) get clusters)" in \ - *"$(KIND_CLUSTER)"*) \ - echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \ - *) \ - echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \ - $(KIND) create cluster --name $(KIND_CLUSTER) ;; \ - esac - -.PHONY: cleanup-test-e2e -cleanup-test-e2e: ## Tear down the Kind cluster used for e2e tests - @$(KIND) delete cluster --name $(KIND_CLUSTER) - -.PHONY: lint -lint: golangci-lint ## Run golangci-lint linter - $(GOLANGCI_LINT) run - -.PHONY: lint-fix -lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes - $(GOLANGCI_LINT) run --fix - -.PHONY: lint-config -lint-config: golangci-lint ## Verify golangci-lint linter configuration - $(GOLANGCI_LINT) config verify - -.PHONY: notice -notice: go-licenses ## Generate NOTICE file with third-party dependency license information. - $(GO_LICENSES) report ./... --ignore go.datum.net/galactic --template scripts/licenses/notice.tmpl > NOTICE - -##@ Build - -.PHONY: build -build: fmt vet ## Build galactic binary. - go build -o bin/galactic cmd/galactic/main.go - -.PHONY: run-agent -run-agent: fmt vet ## Run agent from your host. - go run ./cmd/galactic/main.go agent - -# If you wish to build the image targeting other platforms you can use the --platform flag. -# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it. -# More info: https://docs.docker.com/develop/develop-images/build_enhancements/ -.PHONY: docker-build -docker-build: ## Build docker image with the unified binary. - $(CONTAINER_TOOL) build -t ${IMG} -f containers/galactic/Dockerfile . - -.PHONY: docker-push -docker-push: ## Push docker image with the unified binary. - $(CONTAINER_TOOL) push ${IMG} - -# PLATFORMS defines the target platforms for the image build. Requires docker buildx and BuildKit. -# Usage: make docker-buildx IMG=myregistry/galactic:0.0.1 -# Requires IMG to be set to a valid registry/tag or the push will fail. -PLATFORMS ?= linux/amd64,linux/arm64 -.PHONY: docker-buildx -docker-buildx: ## Build and push docker image for the unified binary for cross-platform support - # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile - sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' containers/galactic/Dockerfile > containers/galactic/Dockerfile.cross - - $(CONTAINER_TOOL) buildx create --name galactic-builder - $(CONTAINER_TOOL) buildx use galactic-builder - - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f containers/galactic/Dockerfile.cross . - - $(CONTAINER_TOOL) buildx rm galactic-builder - rm containers/galactic/Dockerfile.cross - -##@ Cleanup - -.PHONY: clean -clean: ## Remove build artifacts and temporary files - rm -rf bin/ - rm -rf dist/ - rm -f cover.out - -##@ Dependencies - -## Location to install dependencies to -LOCALBIN ?= $(shell pwd)/bin -$(LOCALBIN): - mkdir -p $(LOCALBIN) - -## Tool Binaries -KUBECTL ?= kubectl -KIND ?= kind -KUSTOMIZE ?= $(LOCALBIN)/kustomize -GOLANGCI_LINT = $(LOCALBIN)/golangci-lint -GO_LICENSES ?= $(LOCALBIN)/go-licenses - -## Tool Versions -KUSTOMIZE_VERSION ?= v5.6.0 -GOLANGCI_LINT_VERSION ?= v2.1.6 -GO_LICENSES_VERSION ?= v1.6.0 - -.PHONY: kustomize -kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. -$(KUSTOMIZE): $(LOCALBIN) - $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION)) - -.PHONY: golangci-lint -golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. -$(GOLANGCI_LINT): $(LOCALBIN) - $(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION)) - -.PHONY: go-licenses -go-licenses: $(GO_LICENSES) ## Download go-licenses locally if necessary. -$(GO_LICENSES): $(LOCALBIN) - $(call go-install-tool,$(GO_LICENSES),github.com/google/go-licenses,$(GO_LICENSES_VERSION)) - -# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist -# $1 - target path with name of binary -# $2 - package url which can be installed -# $3 - specific version of package -define go-install-tool -@[ -f "$(1)-$(3)" ] || { \ -set -e; \ -package=$(2)@$(3) ;\ -echo "Downloading $${package}" ;\ -rm -f $(1) || true ;\ -GOBIN=$(LOCALBIN) go install $${package} ;\ -mv $(1) $(1)-$(3) ;\ -} ;\ -ln -sf $(1)-$(3) $(1) -endef diff --git a/README.md b/README.md index 396dc82..5dfa5c5 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,38 @@ Two ContainerLab environments are available under [`lab/`](./lab/): See the [DevContainer](./.devcontainer/) for development environment setup. +## Development + +This project uses [Task](https://taskfile.dev) as its build tool. All build, test, lint, and lab operations are defined in `Taskfile.yaml` files at the repo root and under each `lab/` subdirectory. + +### Install Task + +```bash +# macOS +brew install go-task + +# Linux (official installer) +sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin + +# Go toolchain +go install github.com/go-task/task/v3/cmd/task@latest +``` + +See [taskfile.dev/installation](https://taskfile.dev/installation/) for the full list of options. + +### Usage + +```bash +task # list available tasks +task build # build the galactic binary +task test # run tests (fmt + vet + unit) +task lint # run golangci-lint +task lint-fix # auto-fix lint issues +task clean # remove build artifacts +``` + +Lab environments have their own `Taskfile.yaml`; run `task` from the relevant directory (`lab/network/` or `lab/gvpc/`) to see available tasks. + ## License See [LICENSE](./LICENSE) for details. diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..171fdb3 --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,130 @@ +version: '3' + +vars: + IMG: '{{.IMG | default "ghcr.io/datum-cloud/galactic:latest"}}' + CONTAINER_TOOL: '{{.CONTAINER_TOOL | default "docker"}}' + LOCALBIN: + sh: echo "$(pwd)/bin" + GOBIN: + sh: | + gobin=$(go env GOBIN) + [ -n "$gobin" ] && echo "$gobin" || echo "$(go env GOPATH)/bin" + GOLANGCI_LINT: '{{.LOCALBIN}}/golangci-lint' + GO_LICENSES: '{{.LOCALBIN}}/go-licenses' + GOLANGCI_LINT_VERSION: v2.1.6 + GO_LICENSES_VERSION: v1.6.0 + +tasks: + default: + silent: true + cmds: + - task --list + + ## + ## Development + ## + + fmt: + desc: Run go fmt against code + run: once + cmds: + - go fmt ./... + + vet: + desc: Run go vet against code + run: once + cmds: + - GOOS=linux go vet ./... + + test: + desc: Run tests + deps: [fmt, vet] + cmds: + - GOOS=linux go test $(go list ./... | grep -v /e2e) -coverprofile cover.out + + lint: + desc: Run golangci-lint linter + deps: [golangci-lint] + cmds: + - '{{.GOLANGCI_LINT}} run' + + lint-fix: + desc: Run golangci-lint linter and perform fixes + deps: [golangci-lint] + cmds: + - '{{.GOLANGCI_LINT}} run --fix' + + notice: + desc: Generate NOTICE file with third-party dependency license information + deps: [go-licenses] + cmds: + - '{{.GO_LICENSES}} report ./... --ignore go.datum.net/galactic --template scripts/licenses/notice.tmpl > NOTICE' + + ## + ## Build + ## + + build: + desc: Build galactic binary + deps: [fmt, vet] + cmds: + - go build -o bin/galactic cmd/galactic/main.go + + run-agent: + desc: Run agent from your host + deps: [fmt, vet] + cmds: + - go run ./cmd/galactic/main.go agent + + docker-build: + desc: Build docker image with the unified binary + cmds: + - '{{.CONTAINER_TOOL}} build -t {{.IMG}} -f containers/galactic/Dockerfile .' + + ## + ## Cleanup + ## + + clean: + desc: Remove build artifacts and temporary files + cmds: + - rm -rf bin/ + - rm -rf dist/ + - rm -f cover.out + + ## + ## Dependencies + ## + + golangci-lint: + desc: Download golangci-lint locally if necessary + run: once + cmds: + - task: install-tool + vars: + TARGET: '{{.GOLANGCI_LINT}}' + PACKAGE: github.com/golangci/golangci-lint/v2/cmd/golangci-lint + VERSION: '{{.GOLANGCI_LINT_VERSION}}' + + go-licenses: + internal: true + run: once + cmds: + - task: install-tool + vars: + TARGET: '{{.GO_LICENSES}}' + PACKAGE: github.com/google/go-licenses + VERSION: '{{.GO_LICENSES_VERSION}}' + + install-tool: + internal: true + cmds: + - mkdir -p {{.LOCALBIN}} + - | + if [ ! -f "{{.TARGET}}-{{.VERSION}}" ]; then + echo "Downloading {{.PACKAGE}}@{{.VERSION}}" + rm -f "{{.TARGET}}" || true + GOBIN={{.LOCALBIN}} go install {{.PACKAGE}}@{{.VERSION}} + mv "{{.TARGET}}" "{{.TARGET}}-{{.VERSION}}" + fi + ln -sf "{{.TARGET}}-{{.VERSION}}" "{{.TARGET}}" diff --git a/lab/README.md b/lab/README.md index ed62ec0..a2e78ee 100644 --- a/lab/README.md +++ b/lab/README.md @@ -29,10 +29,10 @@ verification commands. ```bash cd network -make build # build the gobgp-pe container image -make up # apply host sysctls and deploy the lab -make inspect # show node addresses -make down # tear down +task build # build the gobgp-pe container image +task up # apply host sysctls and deploy the lab +task inspect # show node addresses +task down # tear down ``` --- @@ -58,8 +58,8 @@ verification commands. ```bash cd gvpc -make up # build Kind node image, apply host sysctls, deploy lab -make underlay # apply FRR DaemonSets to all three clusters -make overlay # apply GoBGP DaemonSets to iad and sjc clusters -make down # tear down +task up # build Kind node image, apply host sysctls, deploy lab +task underlay # apply FRR DaemonSets to all three clusters +task overlay # apply GoBGP DaemonSets to iad and sjc clusters +task down # tear down ``` diff --git a/lab/gvpc/Makefile b/lab/gvpc/Makefile deleted file mode 100644 index ae009b8..0000000 --- a/lab/gvpc/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -LAB_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -LAB := $(shell awk '/^name:/ {print $$2; exit}' *.clab.yaml) -TOPO := $(wildcard *.clab.yaml) - -.PHONY: help build up down reload inspect graph host-setup underlay overlay clean - -.DEFAULT_GOAL := help - -help: ## Show available targets - @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) \ - | awk 'BEGIN {FS = ":.*##"}; {printf " \033[36m%-24s\033[0m %s\n", $$1, $$2}' \ - | sort - -build: ## Build container images (Kind node) - docker build --network=host -t kindest/node:galactic $(LAB_DIR)containers/kindest-node-galactic - -up: build host-setup ## Build the Kind node image and deploy the lab - sudo containerlab deploy -t $(TOPO) - -down: ## Destroy the lab and clean generated state - sudo containerlab destroy -t $(TOPO) --cleanup - -reload: down up ## Full rebuild and redeploy - -inspect: ## Inspect deployed nodes and management addresses - sudo containerlab inspect -t $(TOPO) - -graph: ## Generate a draw.io diagram for the current topology - sudo containerlab graph -t $(TOPO) --drawio --drawio-dir . - -host-setup: ## Apply host sysctls for this dual-stack lab - sudo ./scripts/host-setup.sh --no-persist - -underlay: ## Apply FRR DaemonSets to all clusters - ./scripts/install-underlay.sh - -overlay: ## Pull GoBGP image, load into clusters, and apply DaemonSets to iad and sjc - docker pull osrg/gobgp:latest - kind load docker-image osrg/gobgp:latest --name iad - kind load docker-image osrg/gobgp:latest --name sjc - ./scripts/install-overlay.sh - -clean: down ## Destroy the lab, remove ContainerLab state, and delete container images - docker rmi kindest/node:galactic || true - docker rmi osrg/gobgp:latest || true - rm -rf clab-$(LAB) diff --git a/lab/gvpc/README.md b/lab/gvpc/README.md index ea68c89..2da0a67 100644 --- a/lab/gvpc/README.md +++ b/lab/gvpc/README.md @@ -113,7 +113,7 @@ Worker SRv6 node SIDs (on `lo-galactic`): ``` gvpc/ ├── gvpc.clab.yaml -├── Makefile +├── Taskfile.yaml ├── containers/ │ └── kindest-node-galactic/ # Custom Kind node image (Cilium, Multus, cert-manager) ├── resources/ @@ -149,14 +149,14 @@ gvpc/ ## Quick start ```bash -make up # build Kind node image, apply host sysctls, deploy lab -make underlay # apply FRR DaemonSets to all three clusters -make overlay # apply GoBGP DaemonSets to iad and sjc clusters +task up # build Kind node image, apply host sysctls, deploy lab +task underlay # apply FRR DaemonSets to all three clusters +task overlay # apply GoBGP DaemonSets to iad and sjc clusters ``` -## Make targets +## Tasks -| Target | Description | +| Task | Description | |------------------|-----------------------------------------------------------| | `build` | Build the custom `kindest/node:galactic` image | | `up` | Build, apply host sysctls, and deploy the lab | diff --git a/lab/gvpc/Taskfile.yaml b/lab/gvpc/Taskfile.yaml new file mode 100644 index 0000000..c3ecd22 --- /dev/null +++ b/lab/gvpc/Taskfile.yaml @@ -0,0 +1,71 @@ +version: '3' + +vars: + LAB: + sh: awk '/^name:/ {print $2; exit}' *.clab.yaml + TOPO: + sh: echo *.clab.yaml + +tasks: + default: + silent: true + cmds: + - task --list + + build: + desc: Build container images (Kind node) + cmds: + - docker build --network=host -t kindest/node:galactic containers/kindest-node-galactic + + up: + desc: Build the Kind node image and deploy the lab + deps: [build, host-setup] + cmds: + - sudo containerlab deploy -t {{.TOPO}} + + down: + desc: Destroy the lab and clean generated state + cmds: + - sudo containerlab destroy -t {{.TOPO}} --cleanup + + reload: + desc: Full rebuild and redeploy + cmds: + - task: down + - task: up + + inspect: + desc: Inspect deployed nodes and management addresses + cmds: + - sudo containerlab inspect -t {{.TOPO}} + + graph: + desc: Generate a draw.io diagram for the current topology + cmds: + - sudo containerlab graph -t {{.TOPO}} --drawio --drawio-dir . + + host-setup: + desc: Apply host sysctls for this dual-stack lab + cmds: + - sudo ./scripts/host-setup.sh --no-persist + + underlay: + desc: Apply FRR DaemonSets to all clusters + cmds: + - ./scripts/install-underlay.sh + + overlay: + desc: Pull GoBGP image, load into clusters, and apply DaemonSets to iad and sjc + cmds: + - docker pull osrg/gobgp:latest + - kind load docker-image osrg/gobgp:latest --name iad + - kind load docker-image osrg/gobgp:latest --name sjc + - ./scripts/install-overlay.sh + + clean: + desc: Destroy the lab, remove ContainerLab state, and delete container images + cmds: + - task: down + - docker rmi kindest/node:galactic || true + - docker rmi osrg/gobgp:latest || true + - rm -rf clab-{{.LAB}} diff --git a/lab/network/Makefile b/lab/network/Makefile deleted file mode 100644 index d0121c4..0000000 --- a/lab/network/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -LAB := $(shell awk '/^name:/ {print $$2; exit}' *.clab.yaml) -TOPO := $(wildcard *.clab.yaml) - -.PHONY: help build up down reload inspect graph host-setup clean - -.DEFAULT_GOAL := help - -help: ## Show available targets - @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) \ - | awk 'BEGIN {FS = ":.*##"}; {printf " \033[36m%-24s\033[0m %s\n", $$1, $$2}' \ - | sort - -build: ## Build the custom GoBGP + FRR image - docker build -t gobgp-pe:latest containers/gobgp-pe - -up: build host-setup ## Build the image and deploy the lab - sudo containerlab deploy -t $(TOPO) - -down: ## Destroy the lab and clean generated state - sudo containerlab destroy -t $(TOPO) --cleanup - -reload: down up ## Full rebuild and redeploy - -inspect: ## Inspect deployed nodes and management addresses - sudo containerlab inspect -t $(TOPO) - -graph: ## Generate a draw.io diagram for the current topology - sudo containerlab graph -t $(TOPO) --drawio --drawio-dir . - -host-setup: ## Apply host sysctls for this dual-stack lab - sudo ./scripts/host-setup.sh --no-persist - -clean: down ## Destroy the lab, remove ContainerLab state, and delete the gobgp-pe image - docker rmi gobgp-pe:latest || true - rm -rf clab-$(LAB) diff --git a/lab/network/README.md b/lab/network/README.md index 440e70b..a2b090c 100644 --- a/lab/network/README.md +++ b/lab/network/README.md @@ -82,34 +82,35 @@ uSID block: `fc00::/32` — 32-bit block | 16-bit node | 16-bit function │ └── gobgp-pe/ Dockerfile ├── scripts/ │ └── host-setup.sh -└── Makefile +└── Taskfile.yaml ``` ## Prerequisites - ContainerLab ≥ 0.54 - Docker with access to `frrouting/frr:latest` -- Custom `gobgp-pe:latest` image (built locally via `make build`) +- Custom `gobgp-pe:latest` image (built locally via `task build`) - Host kernel ≥ 5.18 for SRv6 `encap.red` support -- `make` and standard Linux utilities +- `task` and standard Linux utilities ## Quick start ```bash -make build # build gobgp-pe:latest from containers/gobgp-pe/Dockerfile -make up # apply host sysctls and deploy lab -make inspect # show node management addresses +task build # build gobgp-pe:latest from containers/gobgp-pe/Dockerfile +task up # apply host sysctls and deploy lab +task inspect # show node management addresses ``` -## Make targets +## Tasks -| Target | Description | +| Task | Description | |----------------------|-----------------------------------------------------| | `build` | Build the custom `gobgp-pe:latest` image | | `up` | Apply host sysctls then deploy the lab | | `down` | Destroy the lab and remove state | | `reload` | Full rebuild — destroy then redeploy | | `inspect` | Show running nodes and management addresses | +| `graph` | Generate a draw.io diagram for the current topology | | `host-setup` | Apply required host sysctls (IPv6 forwarding etc.) | | `clean` | Destroy the lab, remove state, and delete the image | diff --git a/lab/network/Taskfile.yaml b/lab/network/Taskfile.yaml new file mode 100644 index 0000000..f2cc39d --- /dev/null +++ b/lab/network/Taskfile.yaml @@ -0,0 +1,57 @@ +version: '3' + +vars: + LAB: + sh: awk '/^name:/ {print $2; exit}' *.clab.yaml + TOPO: + sh: echo *.clab.yaml + +tasks: + default: + silent: true + cmds: + - task --list + + build: + desc: Build the custom GoBGP + FRR image + cmds: + - docker build -t gobgp-pe:latest containers/gobgp-pe + + up: + desc: Build the image and deploy the lab + deps: [build, host-setup] + cmds: + - sudo containerlab deploy -t {{.TOPO}} + + down: + desc: Destroy the lab and clean generated state + cmds: + - sudo containerlab destroy -t {{.TOPO}} --cleanup + + reload: + desc: Full rebuild and redeploy + cmds: + - task: down + - task: up + + inspect: + desc: Inspect deployed nodes and management addresses + cmds: + - sudo containerlab inspect -t {{.TOPO}} + + graph: + desc: Generate a draw.io diagram for the current topology + cmds: + - sudo containerlab graph -t {{.TOPO}} --drawio --drawio-dir . + + host-setup: + desc: Apply host sysctls for this dual-stack lab + cmds: + - sudo ./scripts/host-setup.sh --no-persist + + clean: + desc: Destroy the lab, remove ContainerLab state, and delete the gobgp-pe image + cmds: + - task: down + - docker rmi gobgp-pe:latest || true + - rm -rf clab-{{.LAB}} From 3592189e61651358450a8e9362664ac6af5a4ec7 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 22 May 2026 22:12:52 -0400 Subject: [PATCH 2/2] chore: Update CI workflow to use task instead of make Adds arduino/setup-task@v2 to the build and test-e2e jobs and replaces make calls with task equivalents. Also removes the broken Install CRDs and Verify CRDs steps from test-e2e (operator and CRDs were removed). Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ci.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dad656..dc9b2ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,8 +58,13 @@ jobs: with: go-version: ${{ env.GO_VERSION }} + - uses: arduino/setup-task@v2 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build binary - run: make build + run: task build - name: Verify binary run: | @@ -97,6 +102,11 @@ jobs: with: go-version: ${{ env.GO_VERSION }} + - uses: arduino/setup-task@v2 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Kind run: | go install sigs.k8s.io/kind@latest @@ -109,16 +119,9 @@ jobs: - name: Build and load image run: | - make docker-build IMG=galactic:e2e + task docker-build IMG=galactic:e2e kind load docker-image galactic:e2e --name galactic-e2e - - name: Install CRDs - run: make install - - - name: Verify CRDs - run: | - kubectl get crd network-attachment-definitions.k8s.cni.cncf.io - - name: Cleanup if: always() run: kind delete cluster --name galactic-e2e