-
Notifications
You must be signed in to change notification settings - Fork 140
Cleanup jenkins scripts #7648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup jenkins scripts #7648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR cleans up and modernizes Jenkins shell scripts by improving their reliability, maintainability, and tooling. The changes focus on removing deprecated variables, improving shell script best practices, and adding linting support.
Key changes:
- Removed deprecated variables (
GO_MODULES,XATTRS,DOCKER_CBS_ROOT_DIR) and simplified configuration - Enhanced shell script quality with shellcheck compliance (proper quoting, array usage, conditional operators)
- Added GitHub Actions workflow for automated shellcheck linting
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| jenkins-integration-build.sh | Major cleanup removing deprecated vars, adding validation, improving shell compliance |
| integration-test/start_server.sh | Removed unused DOCKER_CBS_ROOT_DIR variable and improved error handling |
| integration-test/service-test.sh | Fixed shebang from #/bin/sh to #!/bin/bash |
| integration-test/docker-compose.yml | Removed unused volume mount for DOCKER_CBS_ROOT_DIR |
| .github/workflows/shell.yml | Added new shellcheck workflow for automated shell script linting |
jenkins-integration-build.sh
Outdated
|
|
||
| if [ "${DETECT_RACES:-}" == "true" ]; then | ||
| GO_TEST_FLAGS="${GO_TEST_FLAGS} -race" | ||
| GO_TEST_FLAGS=(-race) |
Copilot
AI
Jul 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting GO_TEST_FLAGS to only contain (-race) overwrites all previously set flags. This should use += to append the flag: GO_TEST_FLAGS+=(-race)
| GO_TEST_FLAGS=(-race) | |
| GO_TEST_FLAGS+=(-race) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment was an accurate one FWIW
495af3a to
9b1f844
Compare
2b7ae0b to
67a1331
Compare
bbrks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few comments and the EditorConfig conflict from #7787 (Sorry)
jenkins-integration-build.sh
Outdated
|
|
||
| if [ "${DETECT_RACES:-}" == "true" ]; then | ||
| GO_TEST_FLAGS="${GO_TEST_FLAGS} -race" | ||
| GO_TEST_FLAGS=(-race) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment was an accurate one FWIW
| # Test to see if Couchbase Server is up | ||
| # Each retry min wait 5s, max 10s. Retry 20 times with exponential backoff (delay 0), fail at 120s | ||
| curl --retry-all-errors --connect-timeout 5 --max-time 10 --retry 20 --retry-delay 0 --retry-max-time 120 'http://127.0.0.1:8091' | ||
| docker exec couchbase curl --fail --silent --retry-all-errors --connect-timeout 5 --max-time 10 --retry 20 --retry-delay 0 --retry-max-time 120 'http://127.0.0.1:8091' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why docker exec curl here and not on line 88?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably hit this with accidental debugging, I'd rather have it call curl from inside the container than outside given we don't know the network constraints.
The motivation to do this was that
SG_TEST_BUCKET_POOLis explicitly set by this script and I think we should move to having these default values determined by the code and jenkins could optionally overwrite them.This is a low priority change to review.
This change is no-op, there are no functional changes to the script except not requiring setting
SG_TEST_BUCKET_POOL_SIZEandSG_TEST_BUCKET_POOL_DEBUGbefore you call this script. Note, these are always currently set by the jenkins pipelines anyway, so the values would pass through. So this is also not a functional change with the way the jenkins jobs are set up.if [ "${SG_TEST_X509:-}" == "true" -a "${COUCHBASE_SERVER_PROTOCOL}" != "couchbases" ]; thento use&&instead of-aGO_TEST_FLAGSto use a bash array so that it could be correctly quoted to appease shellcheck[]and is easy to read. I used the output to debug things but I think there's enough information to debug. This might just add noise.GO_MODULESandXATTRSsinceGO_MODULESisn't relevant since 3.1 andXATTRSis no longer relevant as of 4.0. This script now is always sourced from the repo, so I'm not worried about changes.DOCKER_CBS_ROOT_DIRsince/workspaceis the only volume used for cbcollects.\tfromstdbuf -oL grep -a -E '(--- (FAIL|PASS|SKIP):|github.com/couchbase/sync_gateway(/.+)?\t|TEST: |panic: )'since grep always complainted about it, and it didn't do what it said. The scripts still find the values we need for theokorfailedfor finishing package.Testing
./jenkins-integration-build.sh -mlocally to simulateMasterIntegrationjob../start_server.shlocally (I already use this to create testing)Integration Tests
GSI=true,xattrs=truehttps://jenkins.sgwdev.com/job/SyncGateway-Integration/3228/