From 25c4dd2b926492e8d7fa4fc837f66339ec952e7c Mon Sep 17 00:00:00 2001 From: Nurlan Moldomurov Date: Mon, 17 Feb 2025 18:39:57 +0300 Subject: [PATCH 1/3] PMM-7 CI pipelines --- .github/workflows/go.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/toolkit.yml | 8 +++++--- Dockerfile | 3 +++ src/go/Makefile | 2 +- 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/go.yml create mode 100644 Dockerfile diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 000000000..c9c466bfa --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,34 @@ +name: Go + +on: + push: + branches: + - 3.x + pull_request: + branches: + - 3.x + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + + - name: Install dependencies + run: go mod download + working-directory: src/go + + - name: Setup environment + run: make env-up + working-directory: src/go + + - name: Run tests + run: go test ./... + working-directory: src/go diff --git a/.github/workflows/toolkit.yml b/.github/workflows/toolkit.yml index 50e7d8f2f..6818c07e8 100644 --- a/.github/workflows/toolkit.yml +++ b/.github/workflows/toolkit.yml @@ -20,12 +20,14 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' + - name: Build - run: cd src/go; make linux-amd64; cd ../../ + working-directory: src/go + run: make linux-amd64 - name: Build the Docker image - run: echo "FROM oraclelinux:9-slim" > Dockerfile; echo "RUN microdnf -y update" >> Dockerfile; echo "COPY bin/* /usr/bin/" >> Dockerfile; docker build . --file Dockerfile --tag percona-toolkit:${{ github.sha }} + run: docker build . --file Dockerfile --tag percona-toolkit:${{ github.sha }} - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@0.29.0 with: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..59c81a4f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM oraclelinux:9-slim +RUN microdnf -y update +COPY bin/* /usr/bin/ diff --git a/src/go/Makefile b/src/go/Makefile index 0caceca45..594247fd8 100644 --- a/src/go/Makefile +++ b/src/go/Makefile @@ -173,7 +173,7 @@ test: ## Run tests format: ## Format source code. gofumpt -w -s $(FILES) - gofumports -local github.com/percona/pmm-managed -l -w $(FILES) + gofumports -local github.com/percona/percona-toolkit -l -w $(FILES) vet: ## Run vet on Go code @echo ">> vetting code" From ccd5a9341813e1e3b8a78a9236224355c42dbb9b Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Fri, 13 Mar 2026 18:14:55 +0300 Subject: [PATCH 2/3] PMM-7 Use docker compose instead of the plugin --- .whitesource | 24 ------------------------ src/go/Makefile | 4 ++-- 2 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 .whitesource diff --git a/.whitesource b/.whitesource deleted file mode 100644 index 13572a02f..000000000 --- a/.whitesource +++ /dev/null @@ -1,24 +0,0 @@ -{ - "scanSettings": { - "configMode": "AUTO", - "configExternalURL": "", - "projectToken": "", - "baseBranches": ["3.x"], - "enableLicenseViolations": true - }, - "checkRunSettings": { - "vulnerableCheckRunConclusionLevel": "failure", - "displayMode": "diff" - }, - "issueSettings": { - "minSeverityLevel": "NONE" - }, - "remediateSettings": { - "enableRenovate": false, - "dependencyDashboard": true, - "extends": [ - "github>whitesource/merge-confidence:beta", - "github>samq-ghdemo/renovate:demo" - ] - } -} diff --git a/src/go/Makefile b/src/go/Makefile index 594247fd8..e0bc16375 100644 --- a/src/go/Makefile +++ b/src/go/Makefile @@ -117,14 +117,14 @@ env: # TODO: create envs specific to products: MySQL, PostgreSQL, MongoDB, K8 env-up: env ## Start MongoDB docker containers cluster TEST_PSMDB_VERSION=$(TEST_PSMDB_VERSION) \ - docker-compose up \ + docker compose up \ --detach \ --force-recreate \ --always-recreate-deps \ --renew-anon-volumes env-down: env ## Clean-up MongoDB docker containers cluster - docker-compose down -v + docker compose down -v rm .env linux-amd64: ## Build Go tools for linux-amd64. From 7b84e88f110a38080960ba36ecca189df3e5540b Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Fri, 13 Mar 2026 18:25:28 +0300 Subject: [PATCH 3/3] PMM-7 Fix indentation --- .github/workflows/go.yml | 48 +++++++++---------- .github/workflows/toolkit.yml | 12 ++--- .../dumper/dumper_test.go | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c9c466bfa..9c3c7cb17 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,34 +1,34 @@ name: Go on: - push: - branches: - - 3.x - pull_request: - branches: - - 3.x + push: + branches: + - 3.x + pull_request: + branches: + - 3.x jobs: - test: - runs-on: ubuntu-latest + test: + runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 + steps: + - name: Checkout code + uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.23' + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: ${{ github.workspace }}/go.mod - - name: Install dependencies - run: go mod download - working-directory: src/go + - name: Install dependencies + run: go mod download + working-directory: src/go - - name: Setup environment - run: make env-up - working-directory: src/go + - name: Setup environment + run: make env-up + working-directory: src/go - - name: Run tests - run: go test ./... - working-directory: src/go + - name: Run tests + run: go test ./... + working-directory: src/go diff --git a/.github/workflows/toolkit.yml b/.github/workflows/toolkit.yml index e6b8a9ef6..007021e5e 100644 --- a/.github/workflows/toolkit.yml +++ b/.github/workflows/toolkit.yml @@ -32,12 +32,12 @@ jobs: - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@0.35.0 with: - image-ref: 'percona-toolkit:${{ github.sha }}' - format: 'table' - exit-code: '1' - ignore-unfixed: true - vuln-type: 'os,library' - severity: 'CRITICAL,HIGH' + image-ref: 'percona-toolkit:${{ github.sha }}' + format: 'table' + exit-code: '1' + ignore-unfixed: true + vuln-type: 'os,library' + severity: 'CRITICAL,HIGH' - name: Upload a Build Artifact uses: actions/upload-artifact@v7.0.0 diff --git a/src/go/pt-k8s-debug-collector/dumper/dumper_test.go b/src/go/pt-k8s-debug-collector/dumper/dumper_test.go index fc281a400..8e73fa5cc 100644 --- a/src/go/pt-k8s-debug-collector/dumper/dumper_test.go +++ b/src/go/pt-k8s-debug-collector/dumper/dumper_test.go @@ -24,7 +24,7 @@ Unit test for non-existing logs container name error handling */ func TestGetIndividualFilesError(t *testing.T) { - d := New("", "", "psmdb", "", "") + d := New("", "", "psmdb", "", "", true) err := d.getIndividualFiles("", "", "", "", nil)