From 367290c7af4885557a3d737d3d053c5395853482 Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Wed, 26 Mar 2025 12:42:09 +0000 Subject: [PATCH 1/7] ci: update release drafter config file --- .github/release-drafter-config.yml | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/release-drafter-config.yml diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml new file mode 100644 index 0000000..51c3c56 --- /dev/null +++ b/.github/release-drafter-config.yml @@ -0,0 +1,46 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' + + +categories: +- title: '💥 Breaking Changes' + labels: + - breaking-change +- title: '🚀 New Features' + labels: + - feature + - enhancement +- title: '🐞 Bug Fixes' + labels: + - bug + - fix + - bugfix +- title: '⚙️ Technical Debt' + labels: + - refactor +- title: '📝 Documentation' + labels: + - documentation + +change-template: '- $TITLE (#$NUMBER) by @$AUTHOR' +no-changes-template: 'No significant changes' + +template: | + ## 🚀 Release + + ### What's Changed + $CHANGES + + **Contributors:** $CONTRIBUTORS + +version-resolver: + major: + labels: + - major + minor: + labels: + - minor + patch: + labels: + - patch + default: patch From c4c290e606e3d55d4984e2789337f7f9b54dab15 Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Wed, 26 Mar 2025 12:42:27 +0000 Subject: [PATCH 2/7] ci: update of common workflows --- .github/workflows/automatic-pr-labeler.yaml | 29 +++++++++++ .github/workflows/cla.yaml | 19 +++++++ .../workflows/pr-collect-commit-messages.yaml | 17 ++++++ .../workflows/pr-conventional-commits.yaml | 21 ++++++++ .github/workflows/pr-lint-title.yaml | 21 ++++++++ .github/workflows/profanity-filter.yaml | 18 +++++++ .github/workflows/super-linter.yaml | 52 +++++++++++++++++++ 7 files changed, 177 insertions(+) create mode 100644 .github/workflows/automatic-pr-labeler.yaml create mode 100644 .github/workflows/cla.yaml create mode 100644 .github/workflows/pr-collect-commit-messages.yaml create mode 100644 .github/workflows/pr-conventional-commits.yaml create mode 100644 .github/workflows/pr-lint-title.yaml create mode 100644 .github/workflows/profanity-filter.yaml create mode 100644 .github/workflows/super-linter.yaml diff --git a/.github/workflows/automatic-pr-labeler.yaml b/.github/workflows/automatic-pr-labeler.yaml new file mode 100644 index 0000000..543b8c2 --- /dev/null +++ b/.github/workflows/automatic-pr-labeler.yaml @@ -0,0 +1,29 @@ +--- + +# The workflow template for automatic PR labeler. +# It requires to have a configuration file with labels and conditions to apply them. +# The configuration file should be placed in the .github folder and named auto-labeler-config.yaml. +# Example file can be found there: +# https://github.com/Netcracker/qubership-workflow-hub/blob/main/docs/examples/auto-labeler-config.yaml + +name: Automatic PR Labeler + +on: + pull_request: + branches: [main] + types: + [opened, reopened, synchronize] + +permissions: + pull-requests: write + contents: read + issues: write + +jobs: + assign-labels: + uses: Netcracker/qubership-workflow-hub/.github/workflows/auto-labeler.yaml@main + name: Assign labels in pull request + if: github.event.pull_request.merged == false + with: + pull_request_number: ${{ github.event.pull_request.number }} + config_file: './.github/auto-labeler-config.yaml' diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml new file mode 100644 index 0000000..e494723 --- /dev/null +++ b/.github/workflows/cla.yaml @@ -0,0 +1,19 @@ +--- +name: CLA Assistant +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize] + +permissions: + actions: write + contents: read + pull-requests: write + statuses: write + +jobs: + cla_assistant: + uses: Netcracker/qubership-workflow-hub/.github/workflows/cla.yaml@main + secrets: + personal_access_token: ${{ secrets.CLA_ACCESS_TOKEN }} diff --git a/.github/workflows/pr-collect-commit-messages.yaml b/.github/workflows/pr-collect-commit-messages.yaml new file mode 100644 index 0000000..d41d3a5 --- /dev/null +++ b/.github/workflows/pr-collect-commit-messages.yaml @@ -0,0 +1,17 @@ +--- + +name: "Add commit messages to PR body" + +on: + pull_request: + types: [opened, synchronize] + +permissions: + pull-requests: write + +jobs: + update-pr-body: + runs-on: ubuntu-latest + steps: + - name: "Update PR body" + uses: netcracker/qubership-workflow-hub/actions/pr-add-messages@main diff --git a/.github/workflows/pr-conventional-commits.yaml b/.github/workflows/pr-conventional-commits.yaml new file mode 100644 index 0000000..1177d01 --- /dev/null +++ b/.github/workflows/pr-conventional-commits.yaml @@ -0,0 +1,21 @@ +--- + +name: Conventional Commits PR Check + +on: + pull_request: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: webiny/action-conventional-commits@v1.3.0 diff --git a/.github/workflows/pr-lint-title.yaml b/.github/workflows/pr-lint-title.yaml new file mode 100644 index 0000000..b5a54af --- /dev/null +++ b/.github/workflows/pr-lint-title.yaml @@ -0,0 +1,21 @@ +--- + +name: "Lint PR Title" + +on: + pull_request: + types: + - opened + - edited + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/profanity-filter.yaml b/.github/workflows/profanity-filter.yaml new file mode 100644 index 0000000..1ed41ba --- /dev/null +++ b/.github/workflows/profanity-filter.yaml @@ -0,0 +1,18 @@ +--- +name: Profanity filter + +on: + issue_comment: + types: [created, edited] + issues: + types: [opened, edited, reopened] + pull_request: + types: [opened, edited, reopened] + +permissions: + issues: write + pull-requests: write + +jobs: + call-apply-filter: + uses: Netcracker/qubership-workflow-hub/.github/workflows/profanityFilter.yaml@main diff --git a/.github/workflows/super-linter.yaml b/.github/workflows/super-linter.yaml new file mode 100644 index 0000000..8023649 --- /dev/null +++ b/.github/workflows/super-linter.yaml @@ -0,0 +1,52 @@ +--- +# This workflow executes several linters on changed files based on languages used in your code base whenever +# you push a code or open a pull request. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/super-linter/super-linter +# Configuration file for super-linter example: +# .github/super-linter.env +# Configuration files for individual linters should be placed in .github/linters + +name: Lint Code Base + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + workflow_dispatch: + inputs: + full_scan: + type: boolean + default: false + required: false + description: "Lint all codebase" +permissions: + contents: read + +jobs: + run-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "Load super-linter environment file" + run: | + # shellcheck disable=2086 + if [ -f "./.github/super-linter.env" ]; then + grep "\S" ./.github/super-linter.env | grep -v "^#" + grep "\S" ./.github/super-linter.env | grep -v "^#" >> $GITHUB_ENV + fi + + - name: Lint Code Base + uses: super-linter/super-linter@v7 + env: + VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }} + DEFAULT_BRANCH: "main" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c3f5869f8cbc039cab9505b3268072327262458a Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Wed, 26 Mar 2025 12:42:34 +0000 Subject: [PATCH 3/7] ci: update auto labeler config --- .github/auto-labeler-config.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/auto-labeler-config.yaml diff --git a/.github/auto-labeler-config.yaml b/.github/auto-labeler-config.yaml new file mode 100644 index 0000000..89be032 --- /dev/null +++ b/.github/auto-labeler-config.yaml @@ -0,0 +1,23 @@ +--- +conventional-commits: +- type: 'fix' + nouns: ['FIX', 'Fix', 'fix', 'FIXED', 'Fixed', 'fixed'] + labels: ['bug'] +- type: 'feature' + nouns: ['FEATURE', 'Feature', 'feature', 'FEAT', 'Feat', 'feat'] + labels: ['enhancement'] +- type: 'breaking_change' + nouns: ['BREAKING CHANGE', 'BREAKING', 'MAJOR'] + labels: ['breaking-change'] +- type: 'refactor' + nouns: ['refactor', 'Refactor'] + labels: ['refactor'] +- type: 'documentation' + nouns: ['docs', 'doc', 'document', 'documentation'] + labels: ['documentation'] +- type: 'build' + nouns: ['build', 'rebuild'] + labels: ['build'] +- type: 'config' + nouns: ['config', 'conf', 'configuration', 'configure'] + labels: ['config'] From ffd9b4ec0f720afef46ef4accb82d3037bbc83b8 Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Wed, 26 Mar 2025 12:42:45 +0000 Subject: [PATCH 4/7] ci: update of gitattributes file according to https://github.com/gitattributes/gitattributes templates --- .gitattributes | 148 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 125 insertions(+), 23 deletions(-) diff --git a/.gitattributes b/.gitattributes index 287a8c1..569df3f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,24 +1,126 @@ -*.js text eol=lf -*.ts text eol=lf -*.md text eol=lf -*.yaml text eol=lf -*.html text eol=lf -*.json text eol=lf +############################### +# Qubership common # +############################### +.editorconfig text +.flake8 text +.gitattributes text +.gitignore text +.helmignore text +.prettierignore text + +*.env text eol=lf +*.json text +*.md text +*.mod text +*.robot text +*.sum text +*.tpl text +*.txt text +*.yaml text +*.yml text + +LICENSE text +Dockerfile text + +/CHANGELOG.md merge=union +/contributors.json merge=union +/CODE-OF-CONDUCT.md text +/CONTRIBUTING.md text +/README.md text +/SECURITY.md text + +############################### +# Git Line Endings # +############################### + +# Set default behaviour to automatically normalize line endings. +* text=auto + + +# Force batch scripts to always use CRLF line endings so that if a repo is accessed +# in Windows via a file share from Linux, the scripts will work. +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf + +# Force bash scripts to always use LF line endings so that if a repo is accessed +# in Unix via a file share from Windows, the scripts will work. *.sh text eol=lf -*.svg text eol=lf -*.cjs text eol=lf -.browserslistrc text eol=lf -*.mp4 binary -*.png binary -*.jpg binary -*.gif binary -*.vsdx binary -*.ttf binary -*.eot binary -*.woff binary -*.woff2 binary -.gitignore text eol=lf -.npmignore text eol=lf -.gitattributes text eol=lf -LICENSE eol=lf -NOTICE eol=lf \ No newline at end of file +# gofmt defaults to LF for all the platforms: https://github.com/golang/go/issues/16355 +*.go text eol=lf + +########################################## +# Basic .gitattributes for a Java repo.# +########################################## + +# Java sources +*.java text diff=java +*.kt text diff=kotlin +*.groovy text diff=java +*.scala text diff=java +*.gradle text diff=java +*.gradle.kts text diff=kotlin + +# These files are text and should be normalized (Convert crlf => lf) +*.css text diff=css +*.scss text diff=css +*.sass text +*.df text +*.htm text diff=html +*.html text diff=html +*.js text +*.mjs text +*.cjs text +*.jsp text +*.jspf text +*.jspx text +*.properties text +*.tld text +*.tag text +*.tagx text +*.xml text + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.dll binary +*.ear binary +*.jar binary +*.so binary +*.war binary +*.jks binary + +# Common build-tool wrapper scripts ('.cmd' versions are handled by 'Common.gitattributes') +mvnw text eol=lf +gradlew text eol=lf + +########################################## +# Basic .gitattributes for a python repo.# +########################################## + +# Source files +# ============ +*.pxd text diff=python +*.py text diff=python +*.py3 text diff=python +*.pyw text diff=python +*.pyx text diff=python +*.pyz text diff=python +*.pyi text diff=python + +# Binary files +# ============ +*.db binary +*.p binary +*.pkl binary +*.pickle binary +*.pyc binary export-ignore +*.pyo binary export-ignore +*.pyd binary + +# Jupyter notebook +*.ipynb text eol=lf + +# Note: .db, .p, and .pkl files are associated +# with the python modules ``pickle``, ``dbm.*``, +# ``shelve``, ``marshal``, ``anydbm``, & ``bsddb`` +# (among others). From 8f02f2eaf5d3cf4a8ae47c7b375b7e4c69b7aa35 Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Wed, 26 Mar 2025 12:43:37 +0000 Subject: [PATCH 5/7] ci: update of superlinter config files --- .github/linters/.checkov.yaml | 22 ++++++++++++ .github/linters/.eslintrc.yml | 17 +++++++++ .github/linters/.flake8 | 2 ++ .github/linters/.golangci.yml | 2 ++ .github/linters/.jscpd.json | 9 +++++ .github/linters/.yaml-lint.yml | 65 ++++++++++++++++++++++++++++++++++ .github/linters/actionlint.yml | 5 +++ .github/super-linter.env | 19 ++++++++++ 8 files changed, 141 insertions(+) create mode 100644 .github/linters/.checkov.yaml create mode 100644 .github/linters/.eslintrc.yml create mode 100644 .github/linters/.flake8 create mode 100644 .github/linters/.golangci.yml create mode 100644 .github/linters/.jscpd.json create mode 100644 .github/linters/.yaml-lint.yml create mode 100644 .github/linters/actionlint.yml create mode 100644 .github/super-linter.env diff --git a/.github/linters/.checkov.yaml b/.github/linters/.checkov.yaml new file mode 100644 index 0000000..0b86e0d --- /dev/null +++ b/.github/linters/.checkov.yaml @@ -0,0 +1,22 @@ +--- + +quiet: true + +skip-check: +# https://www.checkov.io/5.Policy%20Index/kubernetes.html +- CKV_K8S_15 # Image Pull Policy should be Always +- CKV_K8S_21 # The default namespace should not be used +- CKV_K8S_22 # Use read-only filesystem for containers where possible +- CKV_K8S_35 # Prefer using secrets as files over secrets as environment variables +- CKV_K8S_38 # Ensure that Service Account Tokens are only mounted where necessary +- CKV_K8S_40 # Containers should run as a high UID to avoid host conflict +- CKV_K8S_43 # Image should use digest +- CKV2_K8S_5 # No ServiceAccount/Node should be able to read all secrets +- CKV2_K8S_6 # Minimize the admission of pods which lack an associated NetworkPolicy +# https://www.checkov.io/5.Policy%20Index/dockerfile.html +- CKV_DOCKER_2 # Ensure that HEALTHCHECK instructions have been added to container images +# https://www.checkov.io/5.Policy%20Index/secrets.html +- CKV_SECRET_6 # Base64 High Entropy String +# https://www.checkov.io/5.Policy%20Index/github_actions.html +- CKV2_GHA_1 # Ensure top-level permissions are not set to write-all +- CKV_GHA_7 # The build output cannot be affected by user parameters other than the build entry point and the top-level source location. GitHub Actions workflow_dispatch inputs MUST be empty. diff --git a/.github/linters/.eslintrc.yml b/.github/linters/.eslintrc.yml new file mode 100644 index 0000000..6f2987b --- /dev/null +++ b/.github/linters/.eslintrc.yml @@ -0,0 +1,17 @@ +--- +env: + es6: true + +extends: +- "eslint:recommended" + +parser: "@typescript-eslint/parser" + +plugins: +- "@typescript-eslint" + +rules: + no-undef: 'warn' + +globals: + module: "writable" diff --git a/.github/linters/.flake8 b/.github/linters/.flake8 new file mode 100644 index 0000000..6deafc2 --- /dev/null +++ b/.github/linters/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 120 diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml new file mode 100644 index 0000000..32c844b --- /dev/null +++ b/.github/linters/.golangci.yml @@ -0,0 +1,2 @@ +run: + timeout: 10m diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json new file mode 100644 index 0000000..8361df5 --- /dev/null +++ b/.github/linters/.jscpd.json @@ -0,0 +1,9 @@ +{ + "threshold": 2, + "ignore": [ + "**/.git/**", + "**/charts/*/templates/*/*.yaml", + "**/charts/*/templates/*/*/*.yaml", + "**/docs/examples/**" + ] +} \ No newline at end of file diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 0000000..61b2738 --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,65 @@ +--- +#### Config file for yamllint +# Rules: https://yamllint.readthedocs.io/en/stable/rules.html + +# Exclude not required files +# ignore-from-file: +# - .gitignore +# - .yamlignore + +rules: + braces: + min-spaces-inside: 1 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + max-spaces-inside-empty: 0 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + max-spaces-before: 0 + max-spaces-after: -1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + level: warning + require-starting-space: true + min-spaces-from-content: 1 + comments-indentation: + level: warning + document-end: disable + document-start: disable + # level: warning + # present: false + empty-lines: + level: warning + max: 2 + max-start: 0 + max-end: 2 + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + hyphens: + max-spaces-after: 1 + indentation: + spaces: 2 + indent-sequences: false + check-multi-line-strings: false + key-duplicates: enable + key-ordering: disable + line-length: disable + # max: 100 + # allow-non-breakable-words: true + # allow-non-breakable-inline-mappings: true + new-line-at-end-of-file: disable + new-lines: + type: unix + octal-values: + forbid-implicit-octal: false + forbid-explicit-octal: false + trailing-spaces: enable + truthy: disable diff --git a/.github/linters/actionlint.yml b/.github/linters/actionlint.yml new file mode 100644 index 0000000..5e04acc --- /dev/null +++ b/.github/linters/actionlint.yml @@ -0,0 +1,5 @@ +paths: + .github/workflows/**/*.{yml,yaml}: + ignore: + - 'shellcheck reported issue in this script: SC2086:info.+' + - 'shellcheck reported issue in this script: SC2002:style.+' diff --git a/.github/super-linter.env b/.github/super-linter.env new file mode 100644 index 0000000..61d2866 --- /dev/null +++ b/.github/super-linter.env @@ -0,0 +1,19 @@ +# File will be loaded as environment variables +# It must contain strings like: +# name=value + +GITLEAKS_LOG_LEVEL=warn +VALIDATE_JAVASCRIPT_PRETTIER=false +VALIDATE_JAVASCRIPT_STANDARD=false +VALIDATE_JSCPD=false +VALIDATE_JSON_PRETTIER=false +VALIDATE_KUBERNETES_KUBECONFORM=false +VALIDATE_MARKDOWN_PRETTIER=false +VALIDATE_YAML_PRETTIER=false + +# TODO: fix python files and enable the check again +VALIDATE_PYTHON_BLACK=false +VALIDATE_PYTHON_FLAKE8=false +VALIDATE_PYTHON_MYPY=false +VALIDATE_PYTHON_PYINK=false +VALIDATE_PYTHON_PYLINT=false From d0acdd698782585153cb8e279639498d7e8fc4eb Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Fri, 28 Mar 2025 07:54:50 +0000 Subject: [PATCH 6/7] ci: update of superlinter config files --- .github/linters/checkstyle.xml | 311 +++++++++++++++++++++++++++++++++ 1 file changed, 311 insertions(+) create mode 100644 .github/linters/checkstyle.xml diff --git a/.github/linters/checkstyle.xml b/.github/linters/checkstyle.xml new file mode 100644 index 0000000..a6f3b19 --- /dev/null +++ b/.github/linters/checkstyle.xml @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b4150557f15733f1412c9dc11283accb07688313 Mon Sep 17 00:00:00 2001 From: NetcrackerCLPLCI Date: Tue, 1 Apr 2025 13:25:00 +0000 Subject: [PATCH 7/7] ci: update of common workflows --- .github/workflows/super-linter.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/super-linter.yaml b/.github/workflows/super-linter.yaml index 8023649..da308b2 100644 --- a/.github/workflows/super-linter.yaml +++ b/.github/workflows/super-linter.yaml @@ -13,9 +13,11 @@ name: Lint Code Base on: push: - branches: ["main"] + branches: + - '**' pull_request: - branches: ["main"] + branches: + - '**' workflow_dispatch: inputs: full_scan: @@ -48,5 +50,4 @@ jobs: uses: super-linter/super-linter@v7 env: VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }} - DEFAULT_BRANCH: "main" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}