Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -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-file: ${{ github.workspace }}/go.mod

- 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
20 changes: 12 additions & 8 deletions .github/workflows/toolkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,24 @@ jobs:
uses: actions/setup-go@v6
with:
go-version-file: ${{ github.workspace }}/go.mod

- 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.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
with:
Expand Down
24 changes: 0 additions & 24 deletions .whitesource

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM oraclelinux:9-slim
RUN microdnf -y update
COPY bin/* /usr/bin/
6 changes: 3 additions & 3 deletions src/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/go/pt-k8s-debug-collector/dumper/dumper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading