From 4c7484b0eb903fc9493f1c21229bb36f9c6b8bf6 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 13 Nov 2024 15:12:58 +0000 Subject: [PATCH 1/3] consolidate actions --- .github/workflows/actions.yml | 31 --------- .github/workflows/common-workflows.yaml | 17 +++++ .github/workflows/go-version.yaml | 2 +- .github/workflows/linters.yaml | 92 ------------------------- .golangci.yaml | 30 -------- 5 files changed, 18 insertions(+), 154 deletions(-) create mode 100644 .github/workflows/common-workflows.yaml delete mode 100644 .github/workflows/linters.yaml delete mode 100644 .golangci.yaml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 968bc51..1d19730 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -5,16 +5,6 @@ on: pull_request: branches: [main] jobs: - code-check: - name: Check Go formatting, linting, vetting - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run the formatter, linter, and vetter - uses: dell/common-github-actions/go-code-formatter-linter-vetter@main - with: - directories: --vet-in-dir podmon ./... sanitize: name: Check for forbidden words runs-on: ubuntu-latest @@ -25,24 +15,3 @@ jobs: uses: dell/common-github-actions/code-sanitizer@main with: args: /github/workspace - go_security_scan: - name: Go security - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run Go Security - uses: securego/gosec@master - with: - args: -quiet ./... - malware_security_scan: - name: Malware Scanner - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run malware scan - uses: dell/common-github-actions/malware-scanner@main - with: - directories: . - options: -ri diff --git a/.github/workflows/common-workflows.yaml b/.github/workflows/common-workflows.yaml new file mode 100644 index 0000000..05e4e07 --- /dev/null +++ b/.github/workflows/common-workflows.yaml @@ -0,0 +1,17 @@ +name: Common Workflows +on: # yamllint disable-line rule:truthy + push: + branches: [main] + pull_request: + branches: ["**"] + +jobs: + + # golang static analysis checks + go-static-analysis: + uses: dell/common-github-actions/.github/workflows/go-static-analysis.yaml@main + name: Golang Validation + + common: + name: Quality Checks + uses: dell/common-github-actions/.github/workflows/go-common.yml@main diff --git a/.github/workflows/go-version.yaml b/.github/workflows/go-version.yaml index 1ba387e..51df53b 100644 --- a/.github/workflows/go-version.yaml +++ b/.github/workflows/go-version.yaml @@ -9,7 +9,7 @@ # Reusable workflow to perform go version update on Golang based projects name: Go Version Update -on: +on: # yamllint disable-line rule:truthy workflow_dispatch: repository_dispatch: types: [go-update-workflow] diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml deleted file mode 100644 index f43390a..0000000 --- a/.github/workflows/linters.yaml +++ /dev/null @@ -1,92 +0,0 @@ -name: linters - -on: - push: - branches: [main] - pull_request: - branches: ["**"] - -permissions: - contents: read - -jobs: - golangci-lint-common: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - cache: false - - name: Checkout the code - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v5 - with: - version: latest - skip-cache: true - working-directory: common - golangci-lint-migration: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - cache: false - - name: Checkout the code - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v5 - with: - version: latest - skip-cache: true - working-directory: migration - golangci-lint-podmon: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - cache: false - - name: Checkout the code - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v5 - with: - version: latest - skip-cache: true - working-directory: podmon - golangci-lint-replication: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - cache: false - - name: Checkout the code - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v5 - with: - version: latest - skip-cache: true - working-directory: replication - golangci-lint-volumeGroupSnapshot: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - cache: false - - name: Checkout the code - uses: actions/checkout@v4 - - name: golangci-lint - uses: golangci/golangci-lint-action@v5 - with: - version: latest - skip-cache: true - working-directory: volumeGroupSnapshot diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index bf5d979..0000000 --- a/.golangci.yaml +++ /dev/null @@ -1,30 +0,0 @@ -run: - timeout: 20m - issue-exit-code: 0 # we will change this later - tests: true - skip-dirs-use-default: true - modules-download-mode: readonly - -issues: - max-issues-per-linter: 0 - max-same-issues: 0 - new: false - -output: - print-linter-name: true - sort-results: true - uniq-by-line: false - print-issued-lines: true - -linters: - disable-all: true - fast: false - enable: - # A stricter replacement for gofmt. - - gofumpt - # Inspects source code for security problems. - - gosec - # Check for correctness of programs. - - govet - # Drop-in replacement of golint. - - revive \ No newline at end of file From e21a36c824797811d09ec65502f4693a62226cf3 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 13 Nov 2024 15:48:36 +0000 Subject: [PATCH 2/3] revert --- .github/workflows/actions.yml | 38 +++++++++- .github/workflows/common-workflows.yaml | 17 ----- .github/workflows/linters.yaml | 92 +++++++++++++++++++++++++ .golangci.yaml | 30 ++++++++ 4 files changed, 157 insertions(+), 20 deletions(-) delete mode 100644 .github/workflows/common-workflows.yaml create mode 100644 .github/workflows/linters.yaml create mode 100644 .golangci.yaml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 1d19730..6e5e83e 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -1,10 +1,21 @@ -name: Workflow -on: +name: Common Workflows +on: # yamllint disable-line rule:truthy push: branches: [main] pull_request: - branches: [main] + branches: ["**"] + jobs: + code-check: + name: Check Go formatting, linting, vetting + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + - name: Run the formatter and vetter + uses: dell/common-github-actions/go-code-formatter-vetter@main + with: + directories: --vet-in-dir podmon ./... sanitize: name: Check for forbidden words runs-on: ubuntu-latest @@ -15,3 +26,24 @@ jobs: uses: dell/common-github-actions/code-sanitizer@main with: args: /github/workspace + go_security_scan: + name: Go security + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + - name: Run Go Security + uses: securego/gosec@master + with: + args: -quiet ./... + malware_security_scan: + name: Malware Scanner + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + - name: Run malware scan + uses: dell/common-github-actions/malware-scanner@main + with: + directories: . + options: -ri diff --git a/.github/workflows/common-workflows.yaml b/.github/workflows/common-workflows.yaml deleted file mode 100644 index 05e4e07..0000000 --- a/.github/workflows/common-workflows.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Common Workflows -on: # yamllint disable-line rule:truthy - push: - branches: [main] - pull_request: - branches: ["**"] - -jobs: - - # golang static analysis checks - go-static-analysis: - uses: dell/common-github-actions/.github/workflows/go-static-analysis.yaml@main - name: Golang Validation - - common: - name: Quality Checks - uses: dell/common-github-actions/.github/workflows/go-common.yml@main diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml new file mode 100644 index 0000000..7f960f2 --- /dev/null +++ b/.github/workflows/linters.yaml @@ -0,0 +1,92 @@ +name: linters + +on: # yamllint disable-line rule:truthy + push: + branches: [main] + pull_request: + branches: ["**"] + +permissions: + contents: read + +jobs: + golangci-lint-common: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.23" + cache: false + - name: Checkout the code + uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + skip-cache: true + working-directory: common + golangci-lint-migration: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.23" + cache: false + - name: Checkout the code + uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + skip-cache: true + working-directory: migration + golangci-lint-podmon: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.23" + cache: false + - name: Checkout the code + uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + skip-cache: true + working-directory: podmon + golangci-lint-replication: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.23" + cache: false + - name: Checkout the code + uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + skip-cache: true + working-directory: replication + golangci-lint-volumeGroupSnapshot: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.23" + cache: false + - name: Checkout the code + uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + skip-cache: true + working-directory: volumeGroupSnapshot \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..56f5332 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,30 @@ +run: + timeout: 20m + issue-exit-code: 0 # we will change this later + tests: true + skip-dirs-use-default: true + modules-download-mode: readonly + +issues: + max-issues-per-linter: 0 + max-same-issues: 0 + new: false + +output: + print-linter-name: true + sort-results: true + uniq-by-line: false + print-issued-lines: true + +linters: + disable-all: true + fast: false + enable: + # A stricter replacement for gofmt. + - gofumpt + # Inspects source code for security problems. + - gosec + # Check for correctness of programs. + - govet + # Drop-in replacement of golint. + - revive From 46dd70464800126b1a07545eff120b3b9a4cdfd6 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 13 Nov 2024 15:49:24 +0000 Subject: [PATCH 3/3] add new line --- .github/workflows/linters.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index 7f960f2..a89f1f2 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -89,4 +89,4 @@ jobs: with: version: latest skip-cache: true - working-directory: volumeGroupSnapshot \ No newline at end of file + working-directory: volumeGroupSnapshot