Lowercase all log strings (#3173)

from #3161

---------

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
qwerty287
2024-01-11 19:17:07 +01:00
committed by GitHub
parent f56f9cb1c0
commit b0a2b1cf2d
23 changed files with 82 additions and 81 deletions

View File

@@ -184,7 +184,7 @@ func (e *kube) SetupWorkflow(ctx context.Context, conf *types.Config, taskUUID s
}
}
}
log.Trace().Msgf("Adding extra hosts: %v", extraHosts)
log.Trace().Msgf("adding extra hosts: %v", extraHosts)
for _, stage := range conf.Stages {
for _, step := range stage.Steps {
step.ExtraHosts = extraHosts
@@ -201,7 +201,7 @@ func (e *kube) StartStep(ctx context.Context, step *types.Step, taskUUID string)
log.Trace().Msgf("StartStep got service '%s', ignoring it.", step.Name)
return nil
}
log.Trace().Str("taskUUID", taskUUID).Msgf("Starting step: %s", step.Name)
log.Trace().Str("taskUUID", taskUUID).Msgf("starting step: %s", step.Name)
_, err := startPod(ctx, e, step)
return err
}
@@ -214,7 +214,7 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
return nil, err
}
log.Trace().Str("taskUUID", taskUUID).Msgf("Waiting for pod: %s", podName)
log.Trace().Str("taskUUID", taskUUID).Msgf("waiting for pod: %s", podName)
finished := make(chan bool)
@@ -274,7 +274,7 @@ func (e *kube) TailStep(ctx context.Context, step *types.Step, taskUUID string)
return nil, err
}
log.Trace().Str("taskUUID", taskUUID).Msgf("Tail logs of pod: %s", podName)
log.Trace().Str("taskUUID", taskUUID).Msgf("tail logs of pod: %s", podName)
up := make(chan bool)
@@ -340,14 +340,14 @@ func (e *kube) DestroyStep(_ context.Context, step *types.Step, taskUUID string)
log.Trace().Msgf("DestroyStep got service '%s', ignoring it.", step.Name)
return nil
}
log.Trace().Str("taskUUID", taskUUID).Msgf("Stopping step: %s", step.Name)
log.Trace().Str("taskUUID", taskUUID).Msgf("stopping step: %s", step.Name)
err := stopPod(e.ctx, e, step, defaultDeleteOptions)
return err
}
// Destroy the pipeline environment.
func (e *kube) DestroyWorkflow(_ context.Context, conf *types.Config, taskUUID string) error {
log.Trace().Str("taskUUID", taskUUID).Msg("Deleting Kubernetes primitives")
log.Trace().Str("taskUUID", taskUUID).Msg("deleting Kubernetes primitives")
// Use noContext because the ctx sent to this function will be canceled/done in case of error or canceled by user.
for _, stage := range conf.Stages {

View File

@@ -205,7 +205,7 @@ func hostAlias(extraHost types.HostAlias) v1.HostAlias {
}
func imagePullSecretsReferences(imagePullSecretNames []string) []v1.LocalObjectReference {
log.Trace().Msgf("Using the image pull secrets: %v", imagePullSecretNames)
log.Trace().Msgf("using the image pull secrets: %v", imagePullSecretNames)
secretReferences := make([]v1.LocalObjectReference, len(imagePullSecretNames))
for i, imagePullSecretName := range imagePullSecretNames {
@@ -256,11 +256,11 @@ func nodeSelector(backendNodeSelector map[string]string, platform string) map[st
if platform != "" {
arch := strings.Split(platform, "/")[1]
nodeSelector[v1.LabelArchStable] = arch
log.Trace().Msgf("Using the node selector from the Agent's platform: %v", nodeSelector)
log.Trace().Msgf("using the node selector from the Agent's platform: %v", nodeSelector)
}
if len(backendNodeSelector) > 0 {
log.Trace().Msgf("Appending labels to the node selector from the backend options: %v", backendNodeSelector)
log.Trace().Msgf("appending labels to the node selector from the backend options: %v", backendNodeSelector)
maps.Copy(nodeSelector, backendNodeSelector)
}
@@ -271,7 +271,7 @@ func tolerations(backendTolerations []types.Toleration) []v1.Toleration {
var tolerations []v1.Toleration
if len(backendTolerations) > 0 {
log.Trace().Msgf("Tolerations that will be used in the backend options: %v", backendTolerations)
log.Trace().Msgf("tolerations that will be used in the backend options: %v", backendTolerations)
for _, backendToleration := range backendTolerations {
toleration := toleration(backendToleration)
tolerations = append(tolerations, toleration)
@@ -323,7 +323,7 @@ func podSecurityContext(sc *types.SecurityContext, secCtxConf SecurityContextCon
RunAsGroup: group,
FSGroup: fsGroup,
}
log.Trace().Msgf("Pod security context that will be used: %v", securityContext)
log.Trace().Msgf("pod security context that will be used: %v", securityContext)
return securityContext
}
@@ -343,7 +343,7 @@ func containerSecurityContext(sc *types.SecurityContext, stepPrivileged bool) *v
securityContext := &v1.SecurityContext{
Privileged: privileged,
}
log.Trace().Msgf("Container security context that will be used: %v", securityContext)
log.Trace().Msgf("container security context that will be used: %v", securityContext)
return securityContext
}
@@ -368,7 +368,7 @@ func startPod(ctx context.Context, engine *kube, step *types.Step) (*v1.Pod, err
return nil, err
}
log.Trace().Msgf("Creating pod: %s", pod.Name)
log.Trace().Msgf("creating pod: %s", pod.Name)
return engine.client.CoreV1().Pods(engine.config.Namespace).Create(ctx, pod, metav1.CreateOptions{})
}
@@ -377,7 +377,7 @@ func stopPod(ctx context.Context, engine *kube, step *types.Step, deleteOpts met
if err != nil {
return err
}
log.Trace().Str("name", podName).Msg("Deleting pod")
log.Trace().Str("name", podName).Msg("deleting pod")
err = engine.client.CoreV1().Pods(engine.config.Namespace).Delete(ctx, podName, deleteOpts)
if errors.IsNotFound(err) {

View File

@@ -19,11 +19,12 @@ import (
"fmt"
"github.com/rs/zerolog/log"
"go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"go.woodpecker-ci.org/woodpecker/v2/pipeline/backend/types"
)
const (
@@ -81,12 +82,12 @@ func stopService(ctx context.Context, engine *kube, step *types.Step, deleteOpts
if err != nil {
return err
}
log.Trace().Str("name", svcName).Msg("Deleting service")
log.Trace().Str("name", svcName).Msg("deleting service")
err = engine.client.CoreV1().Services(engine.config.Namespace).Delete(ctx, svcName, deleteOpts)
if errors.IsNotFound(err) {
// Don't abort on 404 errors from k8s, they most likely mean that the pod hasn't been created yet, usually because pipeline was canceled before running all steps.
log.Trace().Err(err).Msgf("Unable to delete service %s", svcName)
log.Trace().Err(err).Msgf("unable to delete service %s", svcName)
return nil
}
return err

View File

@@ -81,7 +81,7 @@ func startVolume(ctx context.Context, engine *kube, name string) (*v1.Persistent
return nil, err
}
log.Trace().Msgf("Creating volume: %s", pvc.Name)
log.Trace().Msgf("creating volume: %s", pvc.Name)
return engine.client.CoreV1().PersistentVolumeClaims(engine.config.Namespace).Create(ctx, pvc, metav1.CreateOptions{})
}
@@ -90,12 +90,12 @@ func stopVolume(ctx context.Context, engine *kube, name string, deleteOpts metav
if err != nil {
return err
}
log.Trace().Str("name", pvcName).Msg("Deleting volume")
log.Trace().Str("name", pvcName).Msg("deleting volume")
err = engine.client.CoreV1().PersistentVolumeClaims(engine.config.Namespace).Delete(ctx, pvcName, deleteOpts)
if errors.IsNotFound(err) {
// Don't abort on 404 errors from k8s, they most likely mean that the pod hasn't been created yet, usually because pipeline was canceled before running all steps.
log.Trace().Err(err).Msgf("Unable to delete service %s", pvcName)
log.Trace().Err(err).Msgf("unable to delete service %s", pvcName)
return nil
}
return err