Skip to content

Commit

Permalink
chore: merge main fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Jul 28, 2024
2 parents 099d915 + 567de23 commit dbc3f2f
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.20-alpine as builder
FROM golang:1.20-alpine AS builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
7 changes: 7 additions & 0 deletions apis/lagoon/v1beta1/lagoonbuild_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ var (
BuildStatusComplete.String(),
BuildStatusCancelled.String(),
}
// BuildRunningPendingStatus .
BuildRunningPendingFailedStatus = []string{
BuildStatusPending.String(),
BuildStatusQueued.String(),
BuildStatusRunning.String(),
BuildStatusFailed.String(),
}
)

// BuildContainsStatus .
Expand Down
7 changes: 7 additions & 0 deletions apis/lagoon/v1beta1/lagoontask_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ var (
TaskStatusComplete.String(),
TaskStatusCancelled.String(),
}
// TaskRunningPendingStatus .
TaskRunningPendingFailedStatus = []string{
TaskStatusPending.String(),
TaskStatusQueued.String(),
TaskStatusRunning.String(),
TaskStatusFailed.String(),
}
)

// TaskContainsStatus .
Expand Down
7 changes: 7 additions & 0 deletions apis/lagoon/v1beta2/lagoonbuild_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ var (
BuildStatusComplete.String(),
BuildStatusCancelled.String(),
}
// BuildRunningPendingStatus .
BuildRunningPendingFailedStatus = []string{
BuildStatusPending.String(),
BuildStatusQueued.String(),
BuildStatusRunning.String(),
BuildStatusFailed.String(),
}
)

// BuildContainsStatus .
Expand Down
7 changes: 7 additions & 0 deletions apis/lagoon/v1beta2/lagoontask_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ var (
TaskStatusComplete.String(),
TaskStatusCancelled.String(),
}
// TaskRunningPendingStatus .
TaskRunningPendingFailedStatus = []string{
TaskStatusPending.String(),
TaskStatusQueued.String(),
TaskStatusRunning.String(),
TaskStatusFailed.String(),
}
)

// TaskContainsStatus .
Expand Down
2 changes: 1 addition & 1 deletion controllers/v1beta1/podmonitor_buildhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ func (r *LagoonMonitorReconciler) updateDeploymentWithLogs(
// if the buildstatus is pending or running, or the cancel flag is provided
// send the update status to lagoon
if helpers.ContainsString(
lagoonv1beta1.BuildRunningPendingStatus,
lagoonv1beta1.BuildRunningPendingFailedStatus,
lagoonBuild.Labels["lagoon.sh/buildStatus"],
) || cancel {
opLog.Info(
Expand Down
2 changes: 1 addition & 1 deletion controllers/v1beta1/podmonitor_taskhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (r *LagoonMonitorReconciler) updateTaskWithLogs(
// then update the task to reflect the current pod status
// we do this so we don't update the status of the task again
if helpers.ContainsString(
lagoonv1beta1.TaskRunningPendingStatus,
lagoonv1beta1.TaskRunningPendingFailedStatus,
lagoonTask.Labels["lagoon.sh/taskStatus"],
) || cancel {
opLog.Info(
Expand Down
2 changes: 1 addition & 1 deletion controllers/v1beta2/podmonitor_buildhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ func (r *LagoonMonitorReconciler) updateDeploymentWithLogs(
// if the buildstatus is pending or running, or the cancel flag is provided
// send the update status to lagoon
if helpers.ContainsString(
lagooncrd.BuildRunningPendingStatus,
lagooncrd.BuildRunningPendingFailedStatus,
lagoonBuild.Labels["lagoon.sh/buildStatus"],
) || cancel {
opLog.Info(
Expand Down
2 changes: 1 addition & 1 deletion controllers/v1beta2/podmonitor_taskhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (r *LagoonMonitorReconciler) updateTaskWithLogs(
// then update the task to reflect the current pod status
// we do this so we don't update the status of the task again
if helpers.ContainsString(
lagooncrd.TaskRunningPendingStatus,
lagooncrd.TaskRunningPendingFailedStatus,
lagoonTask.Labels["lagoon.sh/taskStatus"],
) || cancel {
opLog.Info(
Expand Down
6 changes: 6 additions & 0 deletions internal/harbor/harbor.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package harbor

import (
"crypto/tls"
"net/http"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -35,11 +37,15 @@ type Harbor struct {
WebhookEventTypes []string
LagoonTargetName string
Config *config.Options
TLSSkipVerify bool
}

// New create a new harbor connection.
func New(harbor Harbor) (*Harbor, error) {
harbor.Log = ctrl.Log.WithName("controllers").WithName("HarborIntegration")
if harbor.TLSSkipVerify {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
c, err := harborclientv3.NewRESTClientForHost(harbor.API, harbor.Username, harbor.Password)
if err != nil {
return nil, err
Expand Down
9 changes: 1 addition & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ package main

import (
"context"
"crypto/tls"
"flag"
"fmt"
"net/http"
"net/url"
"os"
"strings"
Expand Down Expand Up @@ -632,6 +630,7 @@ func main() {
WebhookURL: harborLagoonWebhook,
LagoonTargetName: lagoonTargetName,
WebhookEventTypes: strings.Split(harborWebhookEventTypes, ","),
TLSSkipVerify: tlsSkipVerify,
}

deletion := deletions.New(mgr.GetClient(),
Expand Down Expand Up @@ -998,9 +997,3 @@ func main() {
os.Exit(1)
}
}

func init() {
if tlsSkipVerify {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
}

0 comments on commit dbc3f2f

Please sign in to comment.