Skip to content

Conversation

@scylladbbot
Copy link

Description

Commit 5063a93 introduced billing_project extraction from JOB_NAME but has bugs in both Python and Jenkins Groovy code:

  1. Sets billing_project="staging" when JOB_NAME is scylla-staging/* or scylladb-staging/*
  2. Creates sct-runner instances with empty billing_project="" tag
  3. Jenkins tagBuilder.groovy has regex bug and missing staging check
  4. TestConfig.common_tags() reads billing_project directly from environment instead of using proper configuration logic

Changes:

sdcm/sct_config.py:

  • Skip setting billing_project when extracted value equals "staging"
  • Fix log message to show actual billing_project value instead of prefixed release_folder

sdcm/test_config.py:

  • Use SCTConfiguration to get billing_project when cls._tester_obj doesn't exist
  • This ensures proper logic including JOB_NAME parsing, staging exclusion, and git branch fallback
  • Falls back to environment variable only if configuration creation fails (instead of always reading directly from os.environ)

vars/tagBuilder.groovy:

  • Fix regex matching operator from == to =~ for proper pattern matching
  • Add check to prevent setting billing_project to "staging" (same logic as Python)
  • Fix echo statement to use correct variable name (billingProjectValue instead of undefined part)

Example:

# Before: JOB_NAME="scylla-staging/longevity/test" → billing_project="staging"
# After:  JOB_NAME="scylla-staging/longevity/test" → billing_project not set

# Before: SCT_BILLING_PROJECT="" → tags["billing_project"]=""  
# After:  SCT_BILLING_PROJECT="" → "billing_project" key not in tags

# Before: common_tags() reads SCT_BILLING_PROJECT directly from os.environ
# After:  common_tags() uses SCTConfiguration for proper JOB_NAME/git branch logic

Testing

  • Unit tests added: test_39_billing_project_from_job_name, test_39_billing_project_staging_not_set

PR pre-checks (self review)

  • I added the relevant backport labels
  • I didn't leave commented-out/debugging code

Reminders

  • Add New configuration option and document them (in sdcm/sct_config.py)
  • Add unit tests to cover my changes (under unit-test/ folder)
  • Update the Readme/doc folder relevant to this change (if needed)
Original prompt

5063a93 has a small bug, it can set billing_project to staging base on jenkins folder, it shouldn't set it if it's staging, also seem like sct-runner are created with empty billing_project, try finding where and address it


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

  • (cherry picked from commit 0fa7de0)

Parent PR: #13268

… billing_project for sct-runner

- Don't set billing_project to "staging" when derived from JOB_NAME folder
- Fix log message to show actual billing_project value instead of release_folder
- Prevent sct-runner instances from being created with empty billing_project tag
- Only set billing_project tag when SCT_BILLING_PROJECT env var is non-empty

Co-authored-by: fruch <[email protected]>
(cherry picked from commit 0fa7de0)
@scylladbbot
Copy link
Author

@copilot - This PR has conflicts, therefore it was moved to draft
Please resolve them and mark this PR as ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant