Skip to content

Commit

Permalink
chore: other lint/fmt fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Dec 10, 2024
1 parent 62cf101 commit 9f1bfdd
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.22.0
toolchain go1.22.2

require (
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
github.com/cheshir/go-mq/v2 v2.0.1
github.com/coreos/go-semver v0.3.1
github.com/go-logr/logr v1.4.2
Expand Down Expand Up @@ -88,6 +89,7 @@ require (
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rabbitmq/amqp091-go v1.7.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0=
github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
Expand Down Expand Up @@ -1154,6 +1155,7 @@ github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvW
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/securego/gosec v0.0.0-20191002120514-e680875ea14d/go.mod h1:w5+eXa0mYznDkHaMCXA4XYffjlH+cy1oyKbfzJXa2Do=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/v1beta2/build_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func (r *LagoonBuildReconciler) createNamespaceBuild(ctx context.Context,
continue
}
// send the status change to lagoon
r.updateDeploymentAndEnvironmentTask(ctx, opLog, runningBuild, nil, buildCondition, "cancelled")
r.updateDeploymentAndEnvironmentTask(opLog, runningBuild, nil, buildCondition, "cancelled")
continue
}
// handle processing running but no pod/failed pod builds
Expand Down
12 changes: 6 additions & 6 deletions internal/controllers/v1beta2/build_deletionhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ Build cancelled
}
// send any messages to lagoon message queues
// update the deployment with the status of cancelled in lagoon
r.buildStatusLogsToLagoonLogs(ctx, opLog, &lagoonBuild, &lagoonEnv, lagooncrd.BuildStatusCancelled, "cancelled")
r.updateDeploymentAndEnvironmentTask(ctx, opLog, &lagoonBuild, &lagoonEnv, lagooncrd.BuildStatusCancelled, "cancelled")
r.buildLogsToLagoonLogs(ctx, opLog, &lagoonBuild, allContainerLogs, lagooncrd.BuildStatusCancelled)
r.buildStatusLogsToLagoonLogs(opLog, &lagoonBuild, &lagoonEnv, lagooncrd.BuildStatusCancelled, "cancelled")
r.updateDeploymentAndEnvironmentTask(opLog, &lagoonBuild, &lagoonEnv, lagooncrd.BuildStatusCancelled, "cancelled")
r.buildLogsToLagoonLogs(opLog, &lagoonBuild, allContainerLogs, lagooncrd.BuildStatusCancelled)
}
return nil
}

// buildLogsToLagoonLogs sends the build logs to the lagoon-logs message queue
// it contains the actual pod log output that is sent to elasticsearch, it is what eventually is displayed in the UI
func (r *LagoonBuildReconciler) buildLogsToLagoonLogs(ctx context.Context,
func (r *LagoonBuildReconciler) buildLogsToLagoonLogs(
opLog logr.Logger,
lagoonBuild *lagooncrd.LagoonBuild,
logs []byte,
Expand Down Expand Up @@ -266,7 +266,7 @@ func (r *LagoonBuildReconciler) buildLogsToLagoonLogs(ctx context.Context,

// updateDeploymentAndEnvironmentTask sends the status of the build and deployment to the controllerhandler message queue in lagoon,
// this is for the handler in lagoon to process.
func (r *LagoonBuildReconciler) updateDeploymentAndEnvironmentTask(ctx context.Context,
func (r *LagoonBuildReconciler) updateDeploymentAndEnvironmentTask(
opLog logr.Logger,
lagoonBuild *lagooncrd.LagoonBuild,
lagoonEnv *corev1.ConfigMap,
Expand Down Expand Up @@ -360,7 +360,7 @@ func (r *LagoonBuildReconciler) updateDeploymentAndEnvironmentTask(ctx context.C
}

// buildStatusLogsToLagoonLogs sends the logs to lagoon-logs message queue, used for general messaging
func (r *LagoonBuildReconciler) buildStatusLogsToLagoonLogs(ctx context.Context,
func (r *LagoonBuildReconciler) buildStatusLogsToLagoonLogs(
opLog logr.Logger,
lagoonBuild *lagooncrd.LagoonBuild,
lagoonEnv *corev1.ConfigMap,
Expand Down
44 changes: 22 additions & 22 deletions internal/controllers/v1beta2/podmonitor_buildhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ func (r *LagoonMonitorReconciler) buildLogsToLagoonLogs(
if value, ok := jobPod.Labels["lagoon.sh/buildStep"]; ok {
buildStep = value
}
envName := lagoonBuild.Spec.Project.Environment
envID := lagoonBuild.Spec.Project.EnvironmentID
projectName := lagoonBuild.Spec.Project.Name
projectID := lagoonBuild.Spec.Project.ID
if lagoonBuild == nil {
envName = namespace.ObjectMeta.Labels["lagoon.sh/environment"]
eID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
envID = helpers.UintPtr(uint(eID))
projectName = namespace.ObjectMeta.Labels["lagoon.sh/environment"]
pID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
projectID = helpers.UintPtr(uint(pID))
envName := namespace.ObjectMeta.Labels["lagoon.sh/environment"]
eID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
envID := helpers.UintPtr(uint(eID))
projectName := namespace.ObjectMeta.Labels["lagoon.sh/environment"]
pID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
projectID := helpers.UintPtr(uint(pID))
if lagoonBuild != nil {
envName = lagoonBuild.Spec.Project.Environment
envID = lagoonBuild.Spec.Project.EnvironmentID
projectName = lagoonBuild.Spec.Project.Name
projectID = lagoonBuild.Spec.Project.ID
}
remoteId := string(jobPod.ObjectMeta.UID)
if value, ok := jobPod.Labels["lagoon.sh/buildRemoteID"]; ok {
Expand Down Expand Up @@ -394,17 +394,17 @@ func (r *LagoonMonitorReconciler) buildStatusLogsToLagoonLogs(
if value, ok := jobPod.Labels["lagoon.sh/buildStep"]; ok {
buildStep = value
}
envName := lagoonBuild.Spec.Project.Environment
envID := lagoonBuild.Spec.Project.EnvironmentID
projectName := lagoonBuild.Spec.Project.Name
projectID := lagoonBuild.Spec.Project.ID
if lagoonBuild == nil {
envName = namespace.ObjectMeta.Labels["lagoon.sh/environment"]
eID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
envID = helpers.UintPtr(uint(eID))
projectName = namespace.ObjectMeta.Labels["lagoon.sh/environment"]
pID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
projectID = helpers.UintPtr(uint(pID))
envName := namespace.ObjectMeta.Labels["lagoon.sh/environment"]
eID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
envID := helpers.UintPtr(uint(eID))
projectName := namespace.ObjectMeta.Labels["lagoon.sh/environment"]
pID, _ := strconv.Atoi(namespace.ObjectMeta.Labels["lagoon.sh/environment"])
projectID := helpers.UintPtr(uint(pID))
if lagoonBuild != nil {
envName = lagoonBuild.Spec.Project.Environment
envID = lagoonBuild.Spec.Project.EnvironmentID
projectName = lagoonBuild.Spec.Project.Name
projectID = lagoonBuild.Spec.Project.ID
}
msg := schema.LagoonLog{
Severity: "info",
Expand Down

0 comments on commit 9f1bfdd

Please sign in to comment.