From 62b1b8fb494e8f8484ac96a74bd0e242cce019c7 Mon Sep 17 00:00:00 2001 From: Marvin Preuss Date: Mon, 23 Sep 2024 11:31:05 +0200 Subject: [PATCH] build: moving things around --- Dockerfile | 3 --- Taskfile.yml | 27 ++++++++++++++++++++------- test/integration/integration_test.go | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ef2bcb3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM scratch -ENTRYPOINT ["/caddy-log-exporter"] -COPY caddy-log-exporter / diff --git a/Taskfile.yml b/Taskfile.yml index 0a1d5db..30b6d05 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,22 +1,29 @@ version: "3" + vars: NIX_CMD_BASE: nix develop . -c + tasks: ci: cmds: + - task: clean - task: lint - - task: test - - task: docker-local-import - - task: test-integration + - task: test-all ci-publish: cmds: + - task: clean - task: lint - - task: test - - task: test-integration + - task: test-all - task: docker-publish + clean: + cmds: + - rm -rf result + docker-build: + status: + - test -f result cmds: - nix build .#docker @@ -29,12 +36,12 @@ tasks: --insecure-policy \ copy \ docker-archive:$(readlink -f result) \ - docker-daemon:caddy-log-exporter:latest + docker-daemon:caddy-log-exporter:NOTUSE - | {{.NIX_CMD_BASE}} \ skopeo \ inspect \ - docker-daemon:caddy-log-exporter:latest + docker-daemon:caddy-log-exporter:NOTUSE docker-publish: requires: @@ -75,10 +82,16 @@ tasks: test-integration: cmds: + - task: docker-local-import - | {{.NIX_CMD_BASE}} \ go test -v -race ./test/integration/... + test-all: + cmds: + - task: test + - task: test-integration + tidy: cmds: - go mod tidy diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index 01a6b23..ff004c1 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -99,7 +99,7 @@ func TestIntegration(t *testing.T) { "CADDY_LOG_EXPORTER_LOG_FILES": "/var/log/caddy/caddy.log", }, Mounts: vol, - Image: "caddy-log-exporter:latest", + Image: "caddy-log-exporter:NOTUSE", ExposedPorts: []string{"2112:2112"}, WaitingFor: wait.ForHTTP("http://127.0.0.1:2112/healthz"). WithStartupTimeout(5 * time.Minute),