Skip to content

Commit

Permalink
Merge pull request #549 from stakater/thunef/cache-ga-docker
Browse files Browse the repository at this point in the history
Adds cache to GA docker build to speedup build times
  • Loading branch information
MuneebAijaz authored Nov 2, 2023
2 parents 93120d6 + 4abafde commit 7fdd9e2
Show file tree
Hide file tree
Showing 16 changed files with 117 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ jobs:
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
version: v1.54
only-new-issues: false
args: --timeout 10m

Expand Down Expand Up @@ -113,7 +113,8 @@ jobs:
pull: true
push: true
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
cache-to: type=inline
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm,linux/arm64
tags: |
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }}
Expand Down
8 changes: 8 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ package config

import (
"reflect"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"testing"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

const (
configFilePath = "../../examples/configs/test-config-uptimerobot.yaml"
correctTestConfigName = "UptimeRobot"
Expand Down
8 changes: 8 additions & 0 deletions pkg/http/httpClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ package http

import (
"net/http"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"testing"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestCreateHttpClient(t *testing.T) {
url := "https://google.com"
client := CreateHttpClient(url)
Expand Down
8 changes: 8 additions & 0 deletions pkg/kube/wrappers/ingress-wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ import (

"github.com/stakater/IngressMonitorController/v2/pkg/util"
v1 "k8s.io/api/networking/v1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
fakekubeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

const (
testUrl = "testurl.stackator.com"
)
Expand Down
8 changes: 8 additions & 0 deletions pkg/kube/wrappers/routeWrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ import (

routev1 "github.com/openshift/api/route/v1"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
fakekubeclient "sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

const (
routeTestUrl = "testurl.stackator.com/"
)
Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/appinsights/appinsights-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ import (
insightsAlert "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights"
endpointmonitorv1alpha1 "github.com/stakater/IngressMonitorController/v2/api/v1alpha1"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestAppinsightsMonitorService_createWebTest(t *testing.T) {

location := "westeurope"
Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/grafana/grafana-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ import (
"github.com/stakater/IngressMonitorController/v2/pkg/config"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"testing"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestAddMonitorWithCorrectValues(t *testing.T) {
config := config.GetControllerConfigTest()

Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/monitor-proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ import (
"testing"

"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestMonitorServiceProxyOfTypeWithCorrectType(t *testing.T) {
monitorType := "UptimeRobot"
uptime := (&MonitorServiceProxy{}).OfType(monitorType)
Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/pingdom/pingdom-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import (
"github.com/stakater/IngressMonitorController/v2/pkg/config"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestAddMonitorWithCorrectValues(t *testing.T) {
config := config.GetControllerConfigTest()

Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/statuscake/statuscake-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ import (
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
"gotest.tools/assert"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestAddMonitorWithCorrectValues(t *testing.T) {
config := config.GetControllerConfigTest()

Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/updown/updown-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ import (
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
"github.com/stretchr/testify/assert"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

type Block struct {
Try func()
Catch func(Exception)
Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/uptime/uptime-mappers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import (

endpointmonitorv1alpha1 "github.com/stakater/IngressMonitorController/v2/api/v1alpha1"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestUptimeMonitorMonitorToBaseMonitorMapper(t *testing.T) {
uptimeMonitorObject := UptimeMonitorMonitor{Name: "Test Monitor",
PK: 124,
Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/uptime/uptime-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import (
"github.com/stakater/IngressMonitorController/v2/pkg/config"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestGetAllMonitors(t *testing.T) {
config := config.GetControllerConfigTest()

Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/uptimerobot/uptime-mappers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ import (
endpointmonitorv1alpha1 "github.com/stakater/IngressMonitorController/v2/api/v1alpha1"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

func TestUptimeMonitorMonitorToBaseMonitorMapper(t *testing.T) {
uptimeMonitorObject := UptimeMonitorMonitor{FriendlyName: "Test Monitor", ID: 124, URL: "https://stakater.com", Interval: 900}

Expand Down
8 changes: 8 additions & 0 deletions pkg/monitors/uptimerobot/uptime-monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ import (
"github.com/stakater/IngressMonitorController/v2/pkg/config"
"github.com/stakater/IngressMonitorController/v2/pkg/models"
"github.com/stakater/IngressMonitorController/v2/pkg/util"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)

func init() {
// To allow normal logging to be printed if tests fails
// Dev mode is an extra feature to make output more readable
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
}

// Not a test case. Cleanup to remove added dummy Monitors
func TestRemoveDanglingMonitors(t *testing.T) {
config := config.GetControllerConfigTest()
Expand Down

0 comments on commit 7fdd9e2

Please sign in to comment.