From 8c6d69c2e5f062f723736322b60965a784b4360f Mon Sep 17 00:00:00 2001 From: Steve Varnau Date: Fri, 8 May 2026 10:48:55 -0700 Subject: [PATCH] Squashed commit of the following: commit 19b0b6e8bb730c8b8bd0d25600a86e774e527264 Author: Steve Varnau Date: Fri May 8 10:24:43 2026 -0700 stray quotes commit aa8049414585bce024a67b2b4513811711940d68 Author: Steve Varnau Date: Fri May 8 10:20:16 2026 -0700 add backport title check commit 583238192ff2cef7e6294bf5e42cc40ac95755f0 Author: Steve Varnau Date: Fri May 1 14:19:46 2026 -0700 Revert "testing action" This reverts commit b6877984608175053fe4139cd715c776ea49ccc1. commit b6877984608175053fe4139cd715c776ea49ccc1 Author: Steve Varnau Date: Fri May 1 13:50:46 2026 -0700 testing action commit 48bab349e9022f04728ed9560aa4212229eeaec6 Author: Steve Varnau Date: Fri May 1 13:49:53 2026 -0700 add upgrade check, remove broken actions commit ee2a297ca98f80aab380eb30a96a5fbe40e4081a Author: Steve Varnau Date: Fri May 1 11:12:35 2026 -0700 fix up docker call commit 2b7765498c6f0faff7731c13c7b3ec57e4b7f11f Author: Steve Varnau Date: Fri May 1 11:05:21 2026 -0700 test avoiding chown commit 41682abe6c32786805c54ec064698293cfef8267 Author: Steve Varnau Date: Fri May 1 11:02:17 2026 -0700 Revert "check golint and pep8 linters" This reverts commit cd629a60e6853e07ad9ae0086a12e4dba9a0d884. commit c0a4dbee1071a0093be72aa4023707fe462d6e03 Author: Steve Varnau Date: Fri May 1 10:42:01 2026 -0700 try as 2 docker steps commit cd629a60e6853e07ad9ae0086a12e4dba9a0d884 Author: Steve Varnau Date: Fri May 1 09:54:38 2026 -0700 check golint and pep8 linters commit abc46bcb8cdc2597d369f0e3611d9c4c7ae30db7 Author: Steve Varnau Date: Fri May 1 09:23:09 2026 -0700 lint without custom container image commit 4c505f40029a7f7f280be76294b54c9d9d9ed003 Author: Steve Varnau Date: Fri May 1 09:11:40 2026 -0700 checkpoint commit e3a1198480807411d79d9fd2fef20696a850fa6e Author: Steve Varnau Date: Thu Apr 30 16:15:21 2026 -0700 safe dir git config commit 45c2701c4dbe7d201e283badbc957d31c71ab937 Author: Steve Varnau Date: Thu Apr 30 16:10:30 2026 -0700 fix quoting in docker script commit b802db4b034358217741143068aca15e0ce5b430 Author: Steve Varnau Date: Thu Apr 30 16:04:10 2026 -0700 debug path commit 632744a1e68f16ce31a8f164c33813d7c89bb801 Author: Steve Varnau Date: Thu Apr 30 15:49:21 2026 -0700 regex for bash ERE commit f5bd5bad3aa72355a9d43a094b32ad8715299be5 Author: Steve Varnau Date: Thu Apr 30 14:23:48 2026 -0700 ybci user and stray quote commit 05c64bf6bad0b27ba66cd41a82f531ec58a2a897 Author: Steve Varnau Date: Thu Apr 30 14:05:47 2026 -0700 fix docker options commit 37ce8d3812ee7af1de00e0a2c611d3e34a5aa36e Author: Steve Varnau Date: Thu Apr 30 13:52:38 2026 -0700 fix stray quote commit f8544df10989d03575fde6221c3c82f6cf319162 Author: Steve Varnau Date: Thu Apr 30 13:50:50 2026 -0700 Please enter the commit message for your changes. Lines starting moved to workflows commit d6da17bd431b9eb69d84649d09cc9aae2b860cf5 Author: Steve Varnau Date: Thu Apr 30 13:50:40 2026 -0700 move lint action file commit 4cfd1e4518bbec7474abba9c148c94000d329cf0 Author: Steve Varnau Date: Thu Apr 30 13:45:33 2026 -0700 lint file commit a7ed90c2218408ce85ef234d252902eda84b3d4a Author: Steve Varnau Date: Thu Apr 30 13:45:00 2026 -0700 lint file commit 4e29ce13bfea6b6a2e9a72666c404cce5036fa71 Author: Steve Varnau Date: Thu Apr 30 13:44:44 2026 -0700 move lint to separate file to change event triggers commit efc3b478969d92df5a6003ecd9fd5be231b06f68 Author: Steve Varnau Date: Thu Apr 30 13:20:26 2026 -0700 reduced lint rule commit 2e1179aac6ded1f400c70b6dd8d2d819c9113e64 Author: Steve Varnau Date: Wed Apr 29 16:49:05 2026 -0700 add PR checks, remove PR builds commit db30c62fee8aa631cca1a479f655179ec67862f8 Author: Steve Varnau Date: Tue Apr 28 09:49:50 2026 -0700 WIP - automation testing --- .github/workflows/build.yml | 13 ----- .github/workflows/managed-java-checks.yaml | 38 -------------- .github/workflows/pull_check_upgrade.yml | 25 +++++++++ .github/workflows/pull_checks.yml | 59 ++++++++++++++++++++++ .github/workflows/pull_lint.yml | 44 ++++++++++++++++ .github/workflows/yb-ctl-test.yml | 44 ---------------- build-support/jenkins/yb-jenkins-build.sh | 3 ++ 7 files changed, 131 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/managed-java-checks.yaml create mode 100644 .github/workflows/pull_check_upgrade.yml create mode 100644 .github/workflows/pull_checks.yml create mode 100644 .github/workflows/pull_lint.yml delete mode 100644 .github/workflows/yb-ctl-test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bb7c02dc05d..2d7c9919800a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,19 +14,6 @@ on: - '.gitignore' - '.github/vale-styles/**' - pull_request: - branches: - - master - # Duplicated list because github does not support YAML anchors. - # https://github.com/actions/runner/issues/1182 - paths-ignore: - - README.md - - 'docs/**' - - 'architecture/**' - - 'managed/**' - - '.gitignore' - - '.github/vale-styles/**' - # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" diff --git a/.github/workflows/managed-java-checks.yaml b/.github/workflows/managed-java-checks.yaml deleted file mode 100644 index bd9ffb6b39ac..000000000000 --- a/.github/workflows/managed-java-checks.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Lint java code under managed - -on: - push: - branches: - - master - - '2.6' - paths: - - .github/workflows/managed-java-checks.yaml - - managed/**/*.java - - pull_request: - branches: - - master - - '2.6' - paths: - - .github/workflows/managed-java-checks.yaml - - managed/**/*.java - - -jobs: - lint-checks: - name: Lint checks - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Java - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 17 - - - name: Check formatting - run: sbt javafmtCheckAll - working-directory: managed/ - diff --git a/.github/workflows/pull_check_upgrade.yml b/.github/workflows/pull_check_upgrade.yml new file mode 100644 index 000000000000..48ad183fb0d0 --- /dev/null +++ b/.github/workflows/pull_check_upgrade.yml @@ -0,0 +1,25 @@ +name: "yb-gh" + +on: + pull_request: + types: [opened, edited, reopened, synchronize] + paths: + - 'src/**/*.proto' + +jobs: + pr-upgrade: + runs-on: ubuntu-latest + steps: + - name: Check PR upgrade info + run: | + body="${{ github.event.pull_request.body }}" + UPG_RE='upgrade.*(downgrade|rollback)\ssafety' + # downcase the body for regex matching + if [[ ! "${body,,}" =~ $UPG_RE ]]; then + echo "::error ::PR description must include upgrade/rollback safety information" + echo "::error ::for any changes to .proto files." + echo "::error ::This should include whether the change is safe for rollback" + echo "::error ::and any special procedures needed." + echo "::error ::Example: Upgrade/Downgrade Safety: ..." + exit 1 + fi diff --git a/.github/workflows/pull_checks.yml b/.github/workflows/pull_checks.yml new file mode 100644 index 000000000000..f2909914164e --- /dev/null +++ b/.github/workflows/pull_checks.yml @@ -0,0 +1,59 @@ +name: "yb-gh" + +# The title/description checks are only really needed on open/edit events, +# But then it won't be available from head commit if the PR is synchronized. +on: + pull_request: + types: [opened, edited, synchronize, reopened] + paths-ignore: + - README.md + - 'docs/**' + +jobs: + pr-title: + runs-on: ubuntu-latest + steps: + - name: Check PR title + run: | + TITLE_RE='^(\[(BACKPORT )?([0-9]+(\.[0-9]+)+)\])?' + TITLE_RE+='\[((#[0-9]+(,#[0-9]+)*)|([A-Z]+-[0-9]+(,[A-Z]+-[0-9]+)*))\]' + TITLE_RE+=' [a-zA-Z0-9_-]+(,[[a-zA-Z0-9_]-]+)*:' + TITLE_RE+=' \S.{8,98}\S$' + + if [[ ! "${{ github.event.pull_request.title }}" =~ $TITLE_RE ]]; then + echo "::error ::PR title must include issue ID, code area (no extra whitespace)," + echo "::error :: and a short description." + echo "::error ::Issue referenced must be a github issue or YB-internal Jira ID" + echo "::error ::Short description must be less than 100 characters." + echo "::error ::Backport branch should be used only for non-master release branches." + echo "::error ::Examples:" + echo "::error :: [#12345,#12367] area: Cool feature xyz" + echo "::error :: [BACKPORT 2045.1][#12345] area1,area2: Must have fix" + exit 1 + fi + + - name: Check Backport title + run: | + BACKPORT_RE='^(\[(BACKPORT )?([0-9]+(\.[0-9]+)+)\])' + if [[ "${{ github.base_ref }}" == "master" ]]; then + if [[ "${{ github.event.pull_request.title }}" =~ $BACKPORT_RE ]]; then + echo "::error ::PR title should not specify target branch if targeting master." + exit 1 + fi + else + if [[ "${{ github.event.pull_request.title }}" =~ $BACKPORT_RE ]]; then + BACKPORT_BRANCH="${BASH_REMATCH[1]}" + if [[ "${BACKPORT_BRANCH}" != "${{ github.base_ref }}" ]]; then + echo "::error ::Backport branch in title (${BACKPORT_BRANCH}) does not match" + echo "::error :: PR base ref (${{ github.base_ref }})." + exit 1 + fi + else + echo "::error ::PR title must begin with target release branch in square brackets." + echo "::error ::Examples:" + echo "::error :: [BACKPORT 2045.1][#12345] area1,area2: Must have fix from master" + echo "::error :: [2045.2][#12345] area: release-specific change" + exit 1 + fi + fi + # Check if there is backport commit/PR info in desc. \ No newline at end of file diff --git a/.github/workflows/pull_lint.yml b/.github/workflows/pull_lint.yml new file mode 100644 index 000000000000..43deed9a5b50 --- /dev/null +++ b/.github/workflows/pull_lint.yml @@ -0,0 +1,44 @@ +name: "yb-gh" + +on: + pull_request: + types: [opened, synchronize, reopened, edited ] + paths-ignore: + - README.md + - 'docs/**' + +jobs: + pr-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + fetch-tags: 'false' + + # TODO: Create GH custom image with pycodestyle & golint installed + - name: Lint + run: | + docker run \ + --user root \ + -v "$(pwd):$(pwd)" \ + -w "$(pwd)" \ + yugabyteci/yb_build_infra_ubuntu2204_x86_64:latest \ + bash -c 'chown -R yugabyteci .' + docker run \ + --user yugabyteci \ + -v "$(pwd):$(pwd)" \ + -w "$(pwd)" \ + yugabyteci/yb_build_infra_ubuntu2204_x86_64:latest \ + bash -c ' + set -euo pipefail + # Base reference should be set for PR actions. + set -x + if [[ -n "${{ github.base_ref }}" ]]; then + git fetch origin ${{ github.base_ref }} + ./build-support/lint.py --rev origin/${{ github.base_ref }} + else + echo No base reference to compare + exit 1 + fi + ' diff --git a/.github/workflows/yb-ctl-test.yml b/.github/workflows/yb-ctl-test.yml deleted file mode 100644 index ed1ff59fc614..000000000000 --- a/.github/workflows/yb-ctl-test.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: yb-ctl-test - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: - - master - paths: - - '**/yb-ctl*' - - '!docs/**' - - pull_request: - branches: - - master - paths: - - '**/yb-ctl*' - - '!docs/**' - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - yb-ctl-test: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ macos-latest, ubuntu-18.04 ] - python-version: [ 2.7, 3.8 ] - - steps: - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - uses: actions/checkout@v2 - - - name: Run yb-ctl-test - run: | - set -x - tmpdir=$(mktemp -d) - cp -r scripts/installation "${tmpdir}/" - cd "${tmpdir}/installation" - test/yb-ctl-test.sh diff --git a/build-support/jenkins/yb-jenkins-build.sh b/build-support/jenkins/yb-jenkins-build.sh index d137d4a3f5af..ac2dc908ba40 100755 --- a/build-support/jenkins/yb-jenkins-build.sh +++ b/build-support/jenkins/yb-jenkins-build.sh @@ -39,6 +39,9 @@ EOT echo "Jenkins Build script ${BASH_SOURCE[0]} is running" +echo "Intentional build failure" +exit 1 + while [ $# -gt 0 ]; do case "$1" in -h|--help)