Skip to content

chore: automatic repository groups parsing for openstack (CM-1100)#4002

Merged
joanagmaia merged 7 commits intomainfrom
chore/openstack-automatic-repository-groups-parsing
Apr 8, 2026
Merged

chore: automatic repository groups parsing for openstack (CM-1100)#4002
joanagmaia merged 7 commits intomainfrom
chore/openstack-automatic-repository-groups-parsing

Conversation

@joanagmaia
Copy link
Copy Markdown
Contributor

@joanagmaia joanagmaia commented Apr 6, 2026

This pull request introduces a new scheduled job to the cron_service that syncs OpenStack repository groups from an upstream YAML source. It also adds the necessary dependencies for YAML parsing. The main changes are:

New OpenStack repository groups sync job:

  • Added openstackRepositoryGroups.job.ts which fetches OpenStack governance YAML, parses project/repo info, and upserts repository groups in the database. The job is scheduled to run weekly and only includes repositories present in the database.

Dependency updates:

  • Added js-yaml and its type definitions (@types/js-yaml) to package.json and pnpm-lock.yaml for YAML parsing support. [1] [2] [3] [4] [5] [6]

These changes enable automatic, reliable syncing of OpenStack repository groups from their official governance source, ensuring the database remains up-to-date with the latest project structure.


Note

Medium Risk
Adds a new scheduled job that fetches and parses a remote YAML file and then upserts repository-group records in the write DB; failures or YAML format changes could lead to missed/incorrect grouping updates. Dependency changes are low risk, but the automated DB-writing sync increases operational risk.

Overview
Adds a new weekly cron_service job (openstackRepositoryGroups.job.ts) that fetches OpenStack’s upstream governance projects.yaml, parses project→repo mappings, and creates/updates repository groups for the OpenStack insights project based on repos that already exist in the DB.

Updates cron_service dependencies to include js-yaml (and @types/js-yaml) to support YAML parsing, with corresponding pnpm-lock.yaml changes.

Reviewed by Cursor Bugbot for commit ca8c62d. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
@joanagmaia joanagmaia requested review from Copilot and ulemons April 6, 2026 17:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new weekly cron job in cron_service to sync OpenStack repository groups from the OpenDev governance YAML into the database, and introduces YAML parsing dependencies to support it.

Changes:

  • Added openstackRepositoryGroups.job.ts to fetch/parse OpenStack governance YAML and upsert repository groups for an insights project.
  • Added js-yaml (+ @types/js-yaml) to enable YAML parsing in the cron service.
  • Updated pnpm-lock.yaml accordingly.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
services/apps/cron_service/src/jobs/openstackRepositoryGroups.job.ts New scheduled job that fetches OpenStack governance YAML, maps projects to repo URLs present in DB, and upserts repository groups.
services/apps/cron_service/package.json Adds js-yaml runtime dependency and @types/js-yaml for TypeScript.
pnpm-lock.yaml Locks new YAML parsing dependencies and updates dependency graph.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@joanagmaia joanagmaia changed the title chore: automatic repository groups parsing for openstack chore: automatic repository groups parsing for openstack (CM-1100) Apr 7, 2026
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
…atic-repository-groups-parsing

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-|-$/g, '')
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent slug generation risks duplicate repository groups

Low Severity

The new toSlug function generates slugs differently than the existing getCleanString(name).replace(/\s+/g, '-') used in collectionService.ts for repository group slugs. For names with special characters like periods, toSlug converts them to hyphens while getCleanString strips them entirely (e.g., "oslo.messaging""oslo-messaging" vs "oslomessaging"). Since both the API and cron job create and match repository groups by slug, this inconsistency could produce duplicates. @crowd/common (which exports getCleanString) is already a dependency of the cron service.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4e024be. Configure here.

@ulemons
Copy link
Copy Markdown
Contributor

ulemons commented Apr 8, 2026

Looks good to me overall ✅
Maybe we could move some of these logs to info? With everything at debug the job runs completely silently in production

@joanagmaia
Copy link
Copy Markdown
Contributor Author

Looks good to me overall ✅ Maybe we could move some of these logs to info? With everything at debug the job runs completely silently in production

Very good point. Will update, thank you for the review!

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
// We convert them to full URLs using this prefix.
repoUrlBase: 'https://review.opendev.org/',
// ID of the insightsProject that owns these repository groups.
insightsProjectSlug: 'OpenStack',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slug lookup may silently fail due to casing

Medium Severity

insightsProjectSlug is set to 'OpenStack' (mixed case), but every slug generation path in the codebase produces lowercase output — generate_slug in migrations applies lower(), getCleanString calls .toLowerCase(), and even this file's own toSlug lowercases. PostgreSQL TEXT comparison is case-sensitive by default, so WHERE slug = 'OpenStack' won't match a stored slug of 'openstack'. This would cause the job to silently skip the entire sync, logging only a warning.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f272d0b. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ca8c62d. Configure here.

yamlUrl: 'https://opendev.org/openstack/governance/raw/branch/master/reference/projects.yaml',
// Repos in the YAML are listed as "<owner>/<repo>".
// We convert them to full URLs using this prefix.
repoUrlBase: 'https://review.opendev.org/',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong URL base causes zero repository matches

High Severity

The repoUrlBase is set to https://review.opendev.org/, but the git integration service (services/apps/git_integration/src/crowdgit/services/utils.py) explicitly converts review.opendev.org URLs to opendev.org URLs before storing them. This means the database stores repo URLs with https://opendev.org/ as the base. Since getRepositoriesByUrl does an exact URL match, every candidate URL generated by this job will fail to match, causing the job to silently skip all projects every week while reporting success.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ca8c62d. Configure here.

@joanagmaia joanagmaia merged commit 495ce1f into main Apr 8, 2026
15 checks passed
@joanagmaia joanagmaia deleted the chore/openstack-automatic-repository-groups-parsing branch April 8, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants