From 542dd17ac9914eff80b278c4ed9b346c0b378b85 Mon Sep 17 00:00:00 2001 From: Michael Barroco Date: Mon, 8 Jul 2024 21:45:17 +0200 Subject: [PATCH] [dss] Ensure clean workspace for releases --- .dockerignore | 1 + Dockerfile | 14 +++----------- cmds/core-service/main.go | 2 ++ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index 61d3b70c8..f3f73145d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ build/workspace +**/.terraform diff --git a/Dockerfile b/Dockerfile index a6659b229..aa2ca51be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,17 +17,9 @@ WORKDIR /app # Get dependencies - will also be cached if we won't change mod/sum RUN go mod download -COPY .git /app/.git -COPY cmds /app/cmds -RUN mkdir -p cmds/db-manager - -COPY pkg /app/pkg -COPY cmds/db-manager cmds/db-manager - -RUN go install ./... - -COPY scripts /app/scripts -COPY Makefile /app +# In order to reliably compute the version of the build, all files must be present. +# This is required to detect a dirty workspace using `scripts/git/version.sh`. +COPY . /app RUN make interuss diff --git a/cmds/core-service/main.go b/cmds/core-service/main.go index 2b3b129b0..e69017e67 100644 --- a/cmds/core-service/main.go +++ b/cmds/core-service/main.go @@ -32,6 +32,7 @@ import ( ridc "github.com/interuss/dss/pkg/rid/store/cockroach" "github.com/interuss/dss/pkg/scd" scdc "github.com/interuss/dss/pkg/scd/store/cockroach" + "github.com/interuss/dss/pkg/version" "github.com/interuss/stacktrace" "github.com/robfig/cron/v3" "go.uber.org/zap" @@ -207,6 +208,7 @@ func createSCDServer(ctx context.Context, logger *zap.Logger) (*scd.Server, erro // RunHTTPServer starts the DSS HTTP server. func RunHTTPServer(ctx context.Context, ctxCanceler func(), address, locality string) error { logger := logging.WithValuesFromContext(ctx, logging.Logger).With(zap.String("address", address)) + logger.Info("version", zap.Any("version", version.Current())) logger.Info("build", zap.Any("description", build.Describe())) logger.Info("config", zap.Bool("scd", *enableSCD))