diff --git a/.drone.yml b/.drone.yml index 13e16c69..f979fe0f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -107,6 +107,8 @@ steps: - name: docker_build_push_dind image: plugins/docker + environment: + DOCKER_BUILDKIT: "1" settings: repo: rancher/k3d tags: @@ -130,6 +132,8 @@ steps: - tag - name: docker_build_push_binary + environment: + DOCKER_BUILDKIT: "1" image: plugins/docker settings: repo: rancher/k3d diff --git a/Makefile b/Makefile index b1cc1375..ada4f913 100644 --- a/Makefile +++ b/Makefile @@ -124,14 +124,14 @@ build-cross: # build a specific docker target ( '%' matches the target as specified in the Dockerfile) build-docker-%: @echo "Building Docker image k3d:$(K3D_IMAGE_TAG)-$*" - docker build . -t k3d:$(K3D_IMAGE_TAG)-$* --target $* + DOCKER_BUILDKIT=1 docker build . -t k3d:$(K3D_IMAGE_TAG)-$* --target $* # build helper images build-helper-images: @echo "Building docker image rancher/k3d-proxy:$(GIT_TAG)" - docker build proxy/ -f proxy/Dockerfile -t rancher/k3d-proxy:$(GIT_TAG) + DOCKER_BUILDKIT=1 docker build proxy/ -f proxy/Dockerfile -t rancher/k3d-proxy:$(GIT_TAG) @echo "Building docker image rancher/k3d-tools:$(GIT_TAG)" - docker build --no-cache tools/ -f tools/Dockerfile -t rancher/k3d-tools:$(GIT_TAG) --build-arg GIT_TAG=$(GIT_TAG) + DOCKER_BUILDKIT=1 docker build --no-cache tools/ -f tools/Dockerfile -t rancher/k3d-tools:$(GIT_TAG) --build-arg GIT_TAG=$(GIT_TAG) ############################## ########## Cleaning ########## diff --git a/cmd/root.go b/cmd/root.go index cea30784..1e3d8ff6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -46,9 +46,10 @@ import ( // RootFlags describes a struct that holds flags that can be set on root level of the command type RootFlags struct { - debugLogging bool - traceLogging bool - version bool + debugLogging bool + traceLogging bool + timestampedLogging bool + version bool } var flags = RootFlags{} @@ -97,6 +98,7 @@ func init() { rootCmd.PersistentFlags().BoolVar(&flags.debugLogging, "verbose", false, "Enable verbose output (debug logging)") rootCmd.PersistentFlags().BoolVar(&flags.traceLogging, "trace", false, "Enable super verbose output (trace logging)") + rootCmd.PersistentFlags().BoolVar(&flags.timestampedLogging, "timestamps", false, "Enable Log timestamps") // add local flags rootCmd.Flags().BoolVar(&flags.version, "version", false, "Show k3d and default k3s version") @@ -161,9 +163,17 @@ func initLogging() { log.TraceLevel, }, }) - log.SetFormatter(&log.TextFormatter{ + + formatter := &log.TextFormatter{ ForceColors: true, - }) + } + + if flags.timestampedLogging || os.Getenv("LOG_TIMESTAMPS") != "" { + formatter.FullTimestamp = true + } + + log.SetFormatter(formatter) + } func initRuntime() { diff --git a/tests/dind.sh b/tests/dind.sh index 25200a7a..edede4a7 100755 --- a/tests/dind.sh +++ b/tests/dind.sh @@ -22,6 +22,7 @@ k3de2e=$(docker run -d \ -e E2E_INCLUDE="$E2E_INCLUDE" \ -e E2E_EXCLUDE="$E2E_EXCLUDE" \ -e E2E_EXTRA="$E2E_EXTRA" \ + -e LOG_TIMESTAMPS="true" \ --add-host "k3d-registrytest-registry:127.0.0.1" \ --name "k3d-e2e-runner-$TIMESTAMP" \ "k3d:$K3D_IMAGE_TAG")