Skip to content

Commit

Permalink
Merge branch 'refs/heads/v3' into PMM-12013-rds-exporter
Browse files Browse the repository at this point in the history
# Conflicts:
#	api/managementpb/json/client/rds/add_rds_responses.go
#	api/managementpb/json/managementpb.json
#	api/managementpb/rds.pb.go
#	api/swagger/swagger-dev.json
#	api/swagger/swagger.json
#	managed/services/management/rds.go
  • Loading branch information
BupycHuk committed Aug 1, 2024
2 parents 3a0c27d + fb8105a commit ea4b65b
Show file tree
Hide file tree
Showing 1,297 changed files with 293,099 additions and 327,494 deletions.
13 changes: 2 additions & 11 deletions .devcontainer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def install_packages():
run_commands([
"dnf install -y gcc git make pkgconfig \
vim \
mc tmux psmisc lsof which iproute \
mc tmux psmisc lsof which iproute diffutils \
bash-completion \
man man-pages \
openssl-devel \
Expand All @@ -47,16 +47,7 @@ def install_go():

go_version = str(subprocess.check_output("gimme -r " + GO_VERSION, shell=True).strip().decode())

if GO_VERSION == "tip":
run_commands([
"mkdir $HOME/git_source",
"wget https://github.com/git/git/archive/refs/tags/v2.34.4.tar.gz -O $HOME/git.tar.gz",
"tar -xzf $HOME/git.tar.gz -C $HOME/git_source --strip-components 1",
"cd $HOME/git_source && make configure && ./configure --prefix=/usr && make all && make install",
])
gimme_go_dir = "go"
else:
gimme_go_dir = "go{go_version}.linux.amd64".format(go_version=go_version)
gimme_go_dir = "go{go_version}.linux.amd64".format(go_version=go_version)

run_commands([
"gimme " + go_version,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- "qan-api2/**"
- "update/**"
- "vmproxy/**"
- "ui/**"

jobs:
test:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "qan-api2/**"
- "update/**"
- "vmproxy/**"
- "ui/**"

jobs:
test:
Expand All @@ -27,13 +28,13 @@ jobs:
strategy:
matrix:
images:
- { mysql: 'mysql:5.6', mongo: 'mongo:4.2', postgres: 'postgres:10', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'mysql:5.6', mongo: 'mongo:4.4', postgres: 'postgres:10', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'mysql:5.7', mongo: 'mongo:4.4', postgres: 'postgres:11', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'mysql:8.0', mongo: 'mongo:4.4', postgres: 'postgres:12', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'mysql:8.0', mongo: 'mongo:4.4', postgres: 'postgres:13', pmm_server: 'perconalab/pmm-server:3-dev-latest' }

# Percona + latest PMM Server release
- { mysql: 'percona:5.6', mongo: 'percona/percona-server-mongodb:4.2', postgres: 'perconalab/percona-distribution-postgresql:11', pg_libs: 'pg_stat_statements,pg_stat_monitor', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'percona:5.6', mongo: 'percona/percona-server-mongodb:4.4', postgres: 'perconalab/percona-distribution-postgresql:11', pg_libs: 'pg_stat_statements,pg_stat_monitor', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'percona:5.7', mongo: 'percona/percona-server-mongodb:4.4', postgres: 'perconalab/percona-distribution-postgresql:12.8-pg_stat', pg_libs: 'pg_stat_statements,pg_stat_monitor', pmm_server: 'perconalab/pmm-server:3-dev-latest' }
- { mysql: 'percona:8.0', mongo: 'percona/percona-server-mongodb:4.4', postgres: 'perconalab/percona-distribution-postgresql:13.5-pg_stat', pg_libs: 'pg_stat_statements,pg_stat_monitor', pmm_server: 'perconalab/pmm-server:3-dev-latest' }

Expand Down Expand Up @@ -114,8 +115,8 @@ jobs:
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
echo "--- Environment variables ---"
env | sort
echo "--- GO Environment ---"
go env | sort
git status
2 changes: 1 addition & 1 deletion .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
run: |
docker run -e PMM_SERVER_URL=${{env.PMM_URL}} \
-e PMM_RUN_UPDATE_TEST=0 \
-e PMM_RUN_STT_TESTS=0 \
-e PMM_RUN_ADVISOR_TESTS=0 \
--name pmm-api-tests \
--network host \
percona/pmm-api-tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
run: echo "machine github.com login percona-robot password ${{ secrets.ROBOT_TOKEN }}" > $HOME/.netrc

- name: Set up Go release
if: matrix.go.version != 'tip'
Expand Down
39 changes: 29 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,26 @@ jobs:
- name: Run go-sumtype
run: bin/go-sumtype ./...

- name: Run linters
- name: Run API linter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }}
run: |
if out=$(bin/buf lint -v api); code="$?"; test "$code" -eq 0; then
echo "$out"
exit 0
fi
echo "API linter exited with code: $code"
echo "$out"
## buf uses exit code 100 for linter warnings
if [ "$code" -ne 100 ] || ${{ github.event.pull_request == null }}; then
exit $code
fi
# One may need to suppress passing to reviewdog because of https://github.com/reviewdog/reviewdog/issues/1696
echo "$out" | bin/reviewdog -f=buf -reporter=github-pr-review -fail-on-error=true
- name: Run code linters
uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }}
Expand All @@ -92,20 +111,20 @@ jobs:

- name: Run go-consistent
env:
COMMAND: 'bin/go-consistent -pedantic -exclude "tests" ./...'
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }}
run: |
if out=$( ${{ env.COMMAND }} ); exit_code=$?; [ $exit_code -ne 0 ]; then
if [ $exit_code -gt 1 ] || ${{ github.event.pull_request == null }}; then
echo "$out"
exit $exit_code
else
echo "$out" | bin/reviewdog -f=go-consistent -reporter=github-pr-review -fail-on-error=true
fi
else
if out=$(bin/go-consistent -pedantic -exclude "tests" ./...); exit_code=$?; [ $exit_code -eq 0 ]; then
echo "$out"
exit 0
fi
if [ $exit_code -gt 1 ] || ${{ github.event.pull_request == null }}; then
echo "$out"
exit $exit_code
fi
echo "$out" | bin/reviewdog -f=go-consistent -reporter=github-pr-review -fail-on-error=true
- name: Test common API
run: make test-common

Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- 'qan-api2/**'
- 'update/**'
- 'vmproxy/**'
- "ui/**"

jobs:
test:
Expand All @@ -43,6 +44,7 @@ jobs:
- name: Launch PMM Server (see docker-compose.yml)
run: |
make env-compose-up # the container workdir is /root/go/src/github.com/percona/pmm
docker exec -t pmm-server id -Z || :
docker logs pmm-server
- name: Mark the root directory of pmm as safe
Expand All @@ -68,6 +70,9 @@ jobs:
continue-on-error: true
run: docker exec -t pmm-server supervisorctl status

- name: Refresh yum cache for tests
run: docker exec -i pmm-server yum --verbose info updates pmm-managed || echo '1'

- name: Run tests
run: docker exec -i pmm-server make -C managed test-cover

Expand Down Expand Up @@ -120,7 +125,8 @@ jobs:
docker exec pmm-server go env | sort
docker exec pmm-server supervisorctl status || true
services=$(docker exec pmm-server supervisorctl status | awk '{print $1}')
while IFS= read -r service; do
services=(`echo ${services}`)
for service in "${services[@]}"; do
echo "Logs for $service:"
docker exec pmm-server supervisorctl tail $service
done <<< "$services"
done
1 change: 1 addition & 0 deletions .github/workflows/qan-api2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "managed/**"
- "update/**"
- "vmproxy/**"
- "ui/**"

jobs:
test:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: UI

on:
push:
branches:
- main
- v3
- pmm-*
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
paths-ignore:
- "admin/**"
- "agent/**"
- "api-tests/**"
- "cli-tests/**"
- "docs/**"
- "managed/**"
- "managed-dev/**"
- "qan-api2/**"
- "vmproxy/**"
- "update/**"

jobs:
ci:
name: CI
runs-on: ubuntu-22.04

defaults:
run:
working-directory: ${{ github.workspace }}/ui

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version-file: ui/.nvmrc
cache: yarn
cache-dependency-path: ui

- name: Run lint
run: |
make lint
- name: Run unit tests
run: |
make test
- name: Build application
run: |
make build
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- "managed/**"
- "qan-api2/**"
- "vmproxy/**"
- "ui/**"

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vmproxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "managed/**"
- "qan-api2/**"
- "update/**"
- "ui/**"

jobs:
test:
Expand Down
11 changes: 8 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ linters-settings:
cyclop:
max-complexity: 30

inamedparam:
# Skips check for interface methods with only a single parameter.
skip-single-param: true

depguard:
rules:
main:
Expand Down Expand Up @@ -81,11 +85,11 @@ linters:
enable-all: true
disable:
# keep the rules sorted alpahbetically
- deadcode # unmaintained, we leverage `unused`
- dupl # we can't avoid duplicating code
- execinquery # false positives only
- exhaustivestruct # too annoying
- exhaustruct # too many files to fix/nolint
- deadcode # unmaintained, we leverage `unused`
- dupl # we can't avoid duplicating code
- funlen # useless
- gochecknoglobals # mostly useless
- gochecknoinits # we use init functions
Expand All @@ -100,7 +104,7 @@ linters:
- maligned # deprecated
- nlreturn # too annoying
- nosnakecase # deprecated
- protogetter # mostly useless
- protogetter # we need direct access to proto fields
- rowserrcheck # disabled because of generics
- scopelint # too many false positives
- structcheck # replaced by unused
Expand Down Expand Up @@ -145,6 +149,7 @@ issues:
- forcetypeassert # for tests' brevity sake
- funlen # tests may be long
- gocognit # triggered by subtests
- goconst # not critical for tests
- gomnd # tests are full of magic numbers
- ireturn # we have exceptions, so need to silence them in tests
- lll # tests often require long lines
Expand Down
3 changes: 1 addition & 2 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ packages:
interfaces:
agentsRegistry:
agentsStateUpdater:
authProvider:
checksService:
connectionChecker:
grafanaClient:
Expand All @@ -47,7 +46,7 @@ packages:
serviceInfoBroker:
versionCache:
victoriaMetricsClient:
github.com/percona/pmm/managed/services/management/alerting:
github.com/percona/pmm/managed/services/alerting:
interfaces:
grafanaClient:
github.com/percona/pmm/managed/services/management/backup:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ RUN export GOPATH=$(go env GOPATH) && \
COPY . $GOPATH/src/github.com/percona/pmm/
WORKDIR $GOPATH/src/github.com/percona/pmm/api-tests/

CMD make init run-race
CMD ["make", "init", "run-race"]

Loading

0 comments on commit ea4b65b

Please sign in to comment.