enable buildkit and timestamped logging

pull/467/head
iwilltry42 4 years ago
parent b5c055f436
commit 98a48a0fc6
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 4
      .drone.yml
  2. 6
      Makefile
  3. 20
      cmd/root.go
  4. 1
      tests/dind.sh

@ -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

@ -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 ##########

@ -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() {

@ -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")

Loading…
Cancel
Save