Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke authored Sep 14, 2024
2 parents 58964d3 + 274d1fe commit d6af318
Show file tree
Hide file tree
Showing 13 changed files with 324 additions and 200 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
all-github-actions:
patterns: [ "*" ]

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
groups:
all-docker-versions:
patterns: [ "*" ]

- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
groups:
all-go-mod-patch-and-minor:
patterns: [ "*" ]
update-types: [ "patch", "minor" ]
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
password: ${{ secrets.QUAY_TOKEN }}

- name: ${{ inputs.publish && 'Build and push' || 'Build' }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.Dockerfile }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#############################################
# Build
#############################################
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as build
FROM --platform=$BUILDPLATFORM golang:1.23-alpine as build

RUN apk upgrade --no-cache --force
RUN apk add --update build-base make git
Expand Down
15 changes: 11 additions & 4 deletions logger.go → common.logger.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package main

import (
"log/slog"

"go.uber.org/zap"
"go.uber.org/zap/exp/zapslog"
"go.uber.org/zap/zapcore"
)

var (
logger *zap.SugaredLogger
logger *zap.SugaredLogger
slogger *slog.Logger
)

func initLogger() *zap.SugaredLogger {
var config zap.Config
if opts.Logger.Development {
if Opts.Logger.Development {
config = zap.NewDevelopmentConfig()
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
} else {
Expand All @@ -22,12 +26,12 @@ func initLogger() *zap.SugaredLogger {
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder

// debug level
if opts.Logger.Debug {
if Opts.Logger.Debug {
config.Level = zap.NewAtomicLevelAt(zapcore.DebugLevel)
}

// json log format
if opts.Logger.Json {
if Opts.Logger.Json {
config.Encoding = "json"

// if running in containers, logs already enriched with timestamp by the container runtime
Expand All @@ -39,6 +43,9 @@ func initLogger() *zap.SugaredLogger {
if err != nil {
panic(err)
}

logger = log.Sugar()
slogger = slog.New(zapslog.NewHandler(log.Core(), nil))

return logger
}
27 changes: 27 additions & 0 deletions common.system.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"github.com/KimMachineGun/automemlimit/memlimit"
humanize "github.com/dustin/go-humanize"
)

func initSystem() {
// set memory limit
goMemLimit, err := memlimit.SetGoMemLimitWithOpts(
memlimit.WithProvider(
memlimit.ApplyFallback(
memlimit.FromCgroup,
memlimit.FromSystem,
),
),
memlimit.WithLogger(slogger),
)

if goMemLimit > 0 {
logger.Infof(`GOMEMLIMIT updated to %v`, humanize.Bytes(uint64(goMemLimit)))
}

if err != nil {
logger.Fatal(err)
}
}
66 changes: 39 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,76 +1,88 @@
module github.com/webdevops/azure-devops-exporter

go 1.22.0

toolchain go1.22.3
go 1.23

require (
github.com/go-resty/resty/v2 v2.13.1
github.com/go-resty/resty/v2 v2.14.0
github.com/golang/protobuf v1.5.4 // indirect
github.com/prometheus/client_golang v1.19.1
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/client_golang v1.20.3
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sirupsen/logrus v1.9.3
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.2
github.com/jessevdk/go-flags v1.5.0
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
github.com/KimMachineGun/automemlimit v0.6.1
github.com/dustin/go-humanize v1.0.1
github.com/jessevdk/go-flags v1.6.1
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/remeh/sizedwaitgroup v1.0.0
github.com/webdevops/go-common v0.0.0-20240601093701-4ba105311439
github.com/webdevops/go-common v0.0.0-20240821190643-248b039cf4c0
go.uber.org/zap v1.27.0
go.uber.org/zap/exp v0.2.0
)

require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/cilium/ebpf v0.9.1 // indirect
github.com/containerd/cgroups/v3 v3.0.1 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/runtime-spec v1.0.2 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.30.1 // indirect
k8s.io/apimachinery v0.30.1 // indirect
k8s.io/client-go v0.30.1 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 // indirect
k8s.io/api v0.31.1 // indirect
k8s.io/apimachinery v0.31.1 // indirect
k8s.io/client-go v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect
k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
Expand Down
Loading

0 comments on commit d6af318

Please sign in to comment.