Skip to content

Commit cc77180

Browse files
authored
Merge branch 'main' into patch-1
2 parents a21575f + 1e66057 commit cc77180

File tree

18 files changed

+406
-112
lines changed

18 files changed

+406
-112
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-0.1x
8+
tags:
9+
- v[0-9]+.[0-9]+.[0-9]+*
10+
pull_request:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
name: Build
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
29+
with:
30+
go-version-file: ${{ github.workspace }}/go.mod
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
34+
35+
- name: Set up Docker Buildx
36+
id: buildx
37+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
38+
39+
- name: Dry-run GoReleaser
40+
run: |
41+
make release-dry-run
42+
43+
- name: Run debug commands on failure
44+
if: ${{ failure() }}
45+
run: |
46+
echo "--- Environment variables ---"
47+
env | sort
48+
echo "--- GO Environment ---"
49+
go env | sort
50+
echo "--- Git status ---"
51+
git status
52+
echo "--- Docker logs ---"
53+
docker compose logs
54+
echo "--- Docker ps ---"
55+
docker compose ps -a

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2424

2525
- name: Set up Go
2626
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2525
with:
2626
fetch-depth: 0
2727

@@ -31,13 +31,13 @@ jobs:
3131
go-version-file: ${{ github.workspace }}/go.mod
3232

3333
- name: Login to Docker Hub
34-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
34+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
3535
with:
3636
username: ${{ secrets.DOCKERHUB_USERNAME }}
3737
password: ${{ secrets.DOCKERHUB_TOKEN }}
3838

3939
- name: Login to GitHub Container Registry
40-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
40+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
4141
with:
4242
registry: ghcr.io
4343
username: ${{ github.actor }}

.github/workflows/scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: Checkout code
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2727
with:
2828
persist-credentials: false
2929

@@ -43,6 +43,6 @@ jobs:
4343

4444
# Upload the results to GitHub's code scanning dashboard (optional).
4545
- name: "Upload to code-scanning"
46-
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
46+
uses: github/codeql-action/upload-sarif@192325c86100d080feab897ff886c34abd4c83a3 # v3.29.5
4747
with:
4848
sarif_file: results.sarif

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@v9
10+
- uses: actions/stale@v10
1111
with:
1212
stale-issue-message: 'This issue has been marked as stale because it has been open for 120 days without activity. Please remove the stale label or add a comment; otherwise, it will be closed in 7 days.'
1313
days-before-stale: 120

.github/workflows/go.yml renamed to .github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout code
41-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4242

4343
- name: Set up Go
4444
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
@@ -59,7 +59,7 @@ jobs:
5959
6060
6161
- name: Upload coverage results
62-
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
62+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
6363
with:
6464
files: cover.out
6565
flags: agent

.github/workflows/version-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- name: Checkout code
15-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1616
with:
1717
fetch-depth: 0
1818

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ builds:
44
- binary: mongodb_exporter
55
id: mongodb_exporter
66
env:
7+
- CGO_ENABLED=0
78
goos:
89
- linux
910
- darwin
10-
- windows
1111
goarch:
1212
- amd64
1313
- arm

Makefile

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build clean default help init test format check-license
1+
.PHONY: all build clean default help init test format check-license release-dry-run
22
default: help
33

44
GO_TEST_PATH ?= ./...
@@ -9,6 +9,7 @@ GO_TEST_CODECOV ?=
99
BUILD_DATE ?= $(shell date +%FT%T%z)
1010
GOVERSION ?= $(shell go version | cut -d " " -f3)
1111
COMPONENT_VERSION ?= $(shell cat VERSION)
12+
IMAGE_TAG ?= $(shell cat VERSION | cut -c 2-)
1213
COMPONENT_BRANCH ?= $(shell git describe --always --contains --all)
1314
PMM_RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD)
1415
GO_BUILD_LDFLAGS = -X main.version=${COMPONENT_VERSION} -X main.buildDate=${BUILD_DATE} -X main.commit=${PMM_RELEASE_FULLCOMMIT} -X main.Branch=${COMPONENT_BRANCH} -X main.GoVersion=${GOVERSION} -s -w
@@ -17,7 +18,7 @@ REPO ?= percona/$(NAME)
1718
GORELEASER_FLAGS ?=
1819
UID ?= $(shell id -u)
1920

20-
export TEST_MONGODB_IMAGE?=mongo:4.4
21+
export TEST_MONGODB_IMAGE?=mongo:6.0
2122
export TEST_MONGODB_ADMIN_USERNAME?=
2223
export TEST_MONGODB_ADMIN_PASSWORD?=
2324
export TEST_MONGODB_USERNAME?=
@@ -71,7 +72,10 @@ init: ## Install linters
7172
cd tools && go generate -x -tags=tools
7273

7374
build: ## Build exporter binary using plain go build.
74-
go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mongodb_exporter
75+
CGO_ENABLED=0 go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mongodb_exporter
76+
77+
docker-build: build
78+
docker build -t ${NAME}:${IMAGE_TAG} .
7579

7680
build-gssapi: ## Build exporter binary with GSSAPI support (requires CGO enabled).
7781
CGO_ENABLED=1 go build -ldflags="$(GO_BUILD_LDFLAGS)" -tags gssapi -o $(PMM_RELEASE_PATH)/mongodb_exporter
@@ -83,6 +87,21 @@ release: ## Build the binaries using goreleaser
8387
-w /go/src/github.com/user/repo \
8488
goreleaser/goreleaser release --snapshot --skip=publish --clean
8589

90+
release-dry-run: ## Build cross-platform binaries locally without publishing
91+
@echo "Building cross-platform binaries with GoReleaser..."
92+
@if command -v goreleaser >/dev/null 2>&1; then \
93+
goreleaser build --snapshot --clean; \
94+
else \
95+
echo "GoReleaser not found. Installing via Docker..."; \
96+
docker run --rm --privileged \
97+
-v ${PWD}:/go/src/github.com/percona/mongodb_exporter \
98+
-v /var/run/docker.sock:/var/run/docker.sock \
99+
-w /go/src/github.com/percona/mongodb_exporter \
100+
goreleaser/goreleaser build --snapshot --clean; \
101+
fi
102+
@find build -name mongodb_exporter -type f | sort
103+
104+
86105
FILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
87106

88107
format: ## Format source code

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Currently, these metric sources are implemented:
2121

2222
## Supported MongoDB versions
2323

24-
The exporter works with Percona Server for MongoDB and MongoDB Community or Enterprise Edition versions 4.4 and newer. Older versions might also work but are not tested anymore.
24+
The exporter works with Percona Server for MongoDB and MongoDB Community or Enterprise Edition versions 6.0 and newer. Older versions might also work but are not tested anymore.
2525

2626
## Info on Percona MongoDB exporter versions
2727

0 commit comments

Comments
 (0)