Skip to content

Commit

Permalink
adding support for consul-dataplane etc
Browse files Browse the repository at this point in the history
  • Loading branch information
rboyer committed Mar 8, 2023
1 parent 487a268 commit 9ce36fb
Show file tree
Hide file tree
Showing 63 changed files with 2,830 additions and 638 deletions.
54 changes: 47 additions & 7 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:
push:

env:
GO_VERSION: 1.19
GOLANGCI_LINT_VERSION: v1.50.1
DOCKER_BUILDKIT: '1'
GO_VERSION: '1.20'
GOLANGCI_LINT_VERSION: v1.51.1

# This workflow runs for not-yet-reviewed external contributions and so it
# intentionally has no write access and only limited read access to the
Expand Down Expand Up @@ -132,26 +133,35 @@ jobs:
run: |
make
mv $(which devconsul) /usr/local/bin
mv ./bin/clustertool /usr/local/bin
devconsul help
clustertool catalog-sync -h
- name: upload binary
- name: upload devconsul binary
uses: actions/upload-artifact@v3
with:
name: devconsul
path: /usr/local/bin/devconsul
if-no-files-found: error

- name: upload clustertool binary
uses: actions/upload-artifact@v3
with:
name: clustertool
path: /usr/local/bin/clustertool
if-no-files-found: error

get-consul-binary:
runs-on: ubuntu-22.04

steps:
- name: fetch consul
shell: bash
run: |
docker pull consul:latest
docker tag consul:latest consul-dev:latest
docker pull hashicorp/consul:latest
docker tag hashicorp/consul:latest consul-dev:latest
docker rm -f consul-extract || true
docker create --name consul-extract consul:latest
docker create --name consul-extract consul-dev:latest
docker cp consul-extract:/bin/consul "/usr/local/bin/consul"
docker rm -f consul-extract || true
Expand Down Expand Up @@ -180,6 +190,12 @@ jobs:
name: devconsul
path: /usr/local/bin/

- name: download clustertool binary
uses: actions/download-artifact@v3
with:
name: clustertool
path: ./bin/

- name: download consul binary
uses: actions/download-artifact@v3
with:
Expand All @@ -189,9 +205,10 @@ jobs:
- name: fix permissions
shell: bash
run: |
chmod 755 /usr/local/bin/devconsul /usr/local/bin/consul
chmod 755 /usr/local/bin/devconsul /usr/local/bin/consul ./bin/clustertool
consul version
devconsul help
./bin/clustertool catalog-sync -h
- name: test container
timeout-minutes: 10
Expand All @@ -200,3 +217,26 @@ jobs:
docker pull consul:latest
docker tag consul:latest consul-dev:latest
./test-configs/test.sh "${{matrix.config_file}}"
- name: capture failed container logs
if: failure()
shell: bash
run: |
cd test-configs
devconsul dump-logs || true
cp -a cache cache-output
devconsul down &>/dev/null || true
- uses: actions/upload-artifact@v3
if: failure()
with:
name: "docker-logs-${{matrix.config_file}}"
path: ./test-configs/logs
if-no-files-found: ignore

- uses: actions/upload-artifact@v3
if: failure()
with:
name: "run-cache-${{matrix.config_file}}"
path: ./test-configs/cache-output
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ linters-settings:

run:
timeout: 10m
concurrency: 4
concurrency: 1
8 changes: 8 additions & 0 deletions Dockerfile-cdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG DATAPLANE_IMAGE
FROM busybox:latest
FROM ${DATAPLANE_IMAGE}
COPY --from=0 /bin/busybox /bin/busybox
USER 0:0
RUN ["busybox", "--install", "/bin", "-s"]
USER 100:0
ENTRYPOINT []
5 changes: 5 additions & 0 deletions Dockerfile-tool
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:latest
RUN addgroup clustertool && adduser -S -G clustertool clustertool
COPY clustertool /bin/clustertool
USER clustertool
ENTRYPOINT ["/bin/clustertool"]
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ SHELL := /bin/bash
all: install

.PHONY: install
install:
install: clustertool
@go install

.PHONY: clustertool
clustertool:
@mkdir -p bin
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-w' -o bin ./clustertool
@#docker build -t local/clustertool -f Dockerfile-tool ./bin

.PHONY: tidy
tidy:
go mod tidy
Expand Down
6 changes: 6 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"time"

"github.com/hashicorp/go-hclog"

Expand All @@ -25,6 +26,7 @@ type Core = App
type App struct {
logger hclog.Logger
rootDir string
timeout time.Duration // check-mesh

config *config.Config
topology *infra.Topology
Expand All @@ -34,6 +36,10 @@ type App struct {
BootInfo // for boot
}

func (c *App) SetTimeout(v time.Duration) {
c.timeout = v
}

func New(logger hclog.Logger) (*App, error) {
c := &App{
logger: logger,
Expand Down
Loading

0 comments on commit 9ce36fb

Please sign in to comment.