Skip to content

Commit e54bd7a

Browse files
authored
Merge branch 'main' into main
2 parents 63ab004 + dac67a8 commit e54bd7a

File tree

83 files changed

+5124
-2993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+5124
-2993
lines changed

.github/check-license.go

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
// mongodb_exporter
22
// Copyright (C) 2017 Percona LLC
33
//
4-
// This program is free software: you can redistribute it and/or modify
5-
// it under the terms of the GNU Affero General Public License as published by
6-
// the Free Software Foundation, either version 3 of the License, or
7-
// (at your option) any later version.
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
87
//
9-
// This program is distributed in the hope that it will be useful,
10-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
// GNU Affero General Public License for more details.
8+
// http://www.apache.org/licenses/LICENSE-2.0
139
//
14-
// You should have received a copy of the GNU Affero General Public License
15-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
1615

1716
//go:build ignore
1817
// +build ignore
1918

20-
// check-license checks that AGPL license header in all files matches header in this file.
19+
// check-license checks that Apache 2.0 header in all files matches header in this file.
2120
package main
2221

2322
import (
@@ -36,35 +35,33 @@ var (
3635
copyrightText = `// mongodb_exporter
3736
// Copyright (C) 2022 Percona LLC
3837
//
39-
// This program is free software: you can redistribute it and/or modify
40-
// it under the terms of the GNU Affero General Public License as published by
41-
// the Free Software Foundation, either version 3 of the License, or
42-
// (at your option) any later version.
38+
// Licensed under the Apache License, Version 2.0 (the "License");
39+
// you may not use this file except in compliance with the License.
40+
// You may obtain a copy of the License at
4341
//
44-
// This program is distributed in the hope that it will be useful,
45-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
46-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47-
// GNU Affero General Public License for more details.
42+
// http://www.apache.org/licenses/LICENSE-2.0
4843
//
49-
// You should have received a copy of the GNU Affero General Public License
50-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
44+
// Unless required by applicable law or agreed to in writing, software
45+
// distributed under the License is distributed on an "AS IS" BASIS,
46+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47+
// See the License for the specific language governing permissions and
48+
// limitations under the License.
5149
`
5250

5351
copyrightPattern = regexp.MustCompile(`^// mongodb_exporter
5452
// Copyright \(C\) 20\d{2} Percona LLC
5553
//
56-
// This program is free software: you can redistribute it and/or modify
57-
// it under the terms of the GNU Affero General Public License as published by
58-
// the Free Software Foundation, either version 3 of the License, or
59-
// \(at your option\) any later version.
54+
// Licensed under the Apache License, Version 2\.0 \(the "License"\);
55+
// you may not use this file except in compliance with the License.
56+
// You may obtain a copy of the License at
6057
//
61-
// This program is distributed in the hope that it will be useful,
62-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
63-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64-
// GNU Affero General Public License for more details.
58+
// http://www\.apache\.org/licenses/LICENSE-2\.0
6559
//
66-
// You should have received a copy of the GNU Affero General Public License
67-
// along with this program. If not, see <https://www.gnu.org/licenses/>.
60+
// Unless required by applicable law or agreed to in writing, software
61+
// distributed under the License is distributed on an "AS IS" BASIS,
62+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
63+
// See the License for the specific language governing permissions and
64+
// limitations under the License\.
6865
`)
6966
)
7067

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ updates:
99
directory: "/tools"
1010
schedule:
1111
interval: "weekly"
12+
- package-ecosystem: "docker"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
1216
- package-ecosystem: "github-actions"
1317
directory: "/"
1418
schedule:

.github/pull_request_template.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
[PMM-XXXX](https://jira.percona.com/browse/PMM-XXXX) (optional, if ticket reported)
22

3-
- [ ] Links to other linked pull requests (optional).
3+
- [ ] Links to related pull requests (optional).
44

55
---
66

7-
- [ ] Tests passed.
8-
- [ ] Fix conflicts with target branch.
9-
- [ ] Update jira ticket description if needed.
10-
- [ ] Attach screenshots/console output to confirm new behavior to jira ticket, if applicable.
7+
Below we provide a basic checklist of things that would make it a good PR:
8+
- Make sure to sign the CLA (Contributor License Agreement).
9+
- Make sure all tests pass.
10+
- Keep current with the target branch and fix conflicts if necessary.
11+
- Update jira ticket description if necessary.
12+
- Attach screenshots and/or console output to the jira ticket to confirm new behavior, if applicable.
13+
- Leave notes to the reviewers if you need to focus their attention on something specific.
1114

12-
Once all checks pass and the code is ready for review, please add `pmm-review-exporters` team as the reviewer. That would assign people from the review team automatically. Report any issues on our [Forum](https://forums.percona.com) or [Discord](https://per.co.na/discord).
15+
Once all checks pass and the code is ready for review, please add `pmm-review-exporters` team as the reviewer. That would assign people from the review team automatically. Report any issues on our [Forum](https://forums.percona.com).

.github/workflows/go.yml

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Go
33
on:
44
schedule:
55
# run every Sunday
6-
- cron: "0 13 * * 0"
6+
- cron: '0 13 * * 0'
77
push:
88
branches:
99
- main
@@ -19,67 +19,26 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
go-version:
23-
- 1.17.x
2422
image:
25-
- mongo:4.2
2623
- mongo:4.4
2724
- mongo:5.0
28-
- percona/percona-server-mongodb:4.2
2925
- percona/percona-server-mongodb:4.4
3026
- percona/percona-server-mongodb:5.0
31-
os: [ubuntu-latest]
32-
may-fail: [false]
3327

34-
include:
35-
# test only one image on tip to detect major Go changes earlier
36-
# without wasting too much time on CI
37-
- go-version: tip
38-
image: mongo:4.4
39-
os: ubuntu-latest
40-
may-fail: true
41-
42-
continue-on-error: ${{ matrix.may-fail }}
43-
runs-on: ${{ matrix.os }}
28+
runs-on: ubuntu-latest
4429

4530
steps:
46-
- name: Set up Go release
47-
if: matrix.go-version != 'tip'
48-
uses: percona-platform/setup-go@v2
49-
with:
50-
go-version: ${{ matrix.go-version }}
51-
52-
- name: Set up Go tip
53-
if: matrix.go-version == 'tip'
54-
run: |
55-
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
56-
cd $HOME/gotip/src
57-
./make.bash
58-
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
59-
echo "$HOME/gotip/bin" >> $GITHUB_PATH
60-
61-
- name: Check out code into the Go module directory
62-
uses: percona-platform/checkout@v3
31+
- name: Checkout code
32+
uses: actions/checkout@v4
6333

64-
- name: Initialize dependencies and linters
65-
run: |
66-
make init
67-
68-
- name: Diff
69-
if: startsWith( ${{ matrix.go-version }}, '1.17')
70-
run: |
71-
make format
72-
git diff --exit-code
34+
- name: Set up Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version-file: ${{ github.workspace }}/go.mod
7338

7439
- name: Test
7540
run: |
7641
TEST_MONGODB_IMAGE=${{ matrix.image }} make test-cluster
42+
sleep 10
7743
make test-race
7844
make test-cluster-clean
79-
80-
- name: Run checks/linters
81-
run: |
82-
# use GITHUB_TOKEN because only it has access to GitHub Checks API
83-
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
84-
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
85-
make check-license

.github/workflows/lint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Lint
2+
3+
on:
4+
schedule:
5+
# run every Sunday
6+
- cron: '0 13 * * 0'
7+
push:
8+
branches:
9+
- main
10+
- release-0.1x
11+
tags:
12+
- v[0-9]+.[0-9]+.[0-9]+*
13+
pull_request:
14+
15+
jobs:
16+
lint:
17+
name: Lint Check
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version-file: ${{ github.workspace }}/go.mod
29+
30+
- name: Initialize dependencies and linters
31+
run: make init
32+
33+
- name: Diff
34+
run: |
35+
make format
36+
git diff --exit-code
37+
- name: Run checks/linters
38+
run: |
39+
# use GITHUB_TOKEN because only it has access to GitHub Checks API
40+
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
41+
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
42+
make check-license

.github/workflows/release.yml

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,45 @@ on:
77
- v*
88
# manually trigger the release
99
workflow_dispatch:
10+
1011
jobs:
1112
goreleaser:
1213
runs-on: ubuntu-latest
1314
steps:
14-
-
15-
name: Checkout
16-
uses: percona-platform/checkout@v3
15+
- name: Checkout
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19-
-
20-
name: Set up Go
21-
uses: percona-platform/setup-go@v2
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
2222
with:
23-
go-version: 1.17
24-
-
25-
name: Login to Docker Hub
26-
uses: percona-platform/login-action@v2
23+
go-version-file: ${{ github.workspace }}/go.mod
24+
25+
- name: Login to Docker Hub
26+
uses: docker/login-action@v3
2727
with:
2828
username: ${{ secrets.DOCKERHUB_USERNAME }}
2929
password: ${{ secrets.DOCKERHUB_TOKEN }}
3030

31-
-
32-
name: Login to GitHub Container Registry
33-
uses: percona-platform/login-action@v2
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v3
3433
with:
3534
registry: ghcr.io
3635
username: ${{ github.actor }}
3736
password: ${{ secrets.GITHUB_TOKEN }}
3837

39-
-
40-
name: Set up QEMU
41-
uses: docker/setup-qemu-action@v2
38+
- name: Set up QEMU
39+
uses: docker/setup-qemu-action@v3
4240

43-
-
44-
name: Set up Docker Buildx
41+
- name: Set up Docker Buildx
4542
id: buildx
46-
uses: docker/setup-buildx-action@v2
43+
uses: docker/setup-buildx-action@v3
4744

48-
-
49-
name: Run GoReleaser
50-
uses: percona-platform/goreleaser-action@v3
45+
- name: Run GoReleaser
46+
uses: goreleaser/goreleaser-action@v6
5147
with:
52-
version: latest
53-
args: release --rm-dist
48+
version: "~> v2"
49+
args: release --clean
5450
env:
5551
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ bin
66
build
77
dist
88
mongodb_exporter
9+
.DS_Store

.golangci-required.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
---
2+
linters-settings:
3+
# prevent import of "errors" instead of "github.com/pkg/errors"
4+
depguard:
5+
rules:
6+
# Name of a rule.
7+
main:
8+
# Packages that are not allowed where the value is a suggestion.
9+
deny:
10+
- pkg: "errors"
11+
desc: Should be replaced by github.com/pkg/errors package
12+
213
# The most valuable linters; they are required to pass for PR to be merged.
314
linters:
415
disable-all: true

.golangci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
linters-settings:
33
# prevent import of "errors" instead of "github.com/pkg/errors"
44
depguard:
5-
list-type: blacklist
6-
include-go-root: true
7-
packages:
8-
- errors
5+
rules:
6+
# Name of a rule.
7+
main:
8+
# Packages that are not allowed where the value is a suggestion.
9+
deny:
10+
- pkg: "errors"
11+
desc: Should be replaced by github.com/pkg/errors package
912

1013
lll:
1114
line-length: 140

0 commit comments

Comments
 (0)