Skip to content

Conversation

@VGoncharova
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Oct 29, 2025

Walkthrough

This PR refactors a TeamCity Gradle init script to consolidate repository configuration into a global all-projects block, add mavenContent filtering for io.ktor in the EAP repository, and switch the resolution strategy from per-project to a global configurations.all approach with updated variable naming and logging statements.

Changes

Cohort / File(s) Summary
Gradle init script repository and resolution refactoring
.teamcity/src/subprojects/train/TriggerProjectSamplesOnEAP.kt
Restructured repository configuration from per-project to flat all-projects block; added mavenContent includeGroup filtering for io.ktor; migrated Gradle resolution strategy from per-project configurations to global configurations.all; updated variable references (details.requested → requested); switched to useVersion(ktorVersion) for forcing KTOR_VERSION; migrated project.afterEvaluate to global afterEvaluate; updated root-project check logic and associated logging to use project name variable instead of project.name

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify that the migration from per-project to global configurations.all scope maintains correct resolution behavior and doesn't introduce unintended side effects across projects
  • Confirm that the mavenContent includeGroup filter correctly isolates io.ktor artifacts to the EAP repository
  • Validate that logging statements now reference the correct renamed variables (requested.name, name) and execute in the intended scope

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided by the author. According to the evaluation criteria, a passing description should be related in some way to the changeset, but an empty description fails to describe any part of the changes or provide context for the refactoring work being performed. While this check is lenient, the complete absence of a description means it does not meet the minimum requirement of being related to the changeset in some way.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "refactor Ktor EAP trigger settings: simplify project and configuration handling, streamline logging messages" accurately reflects the primary changes in the changeset. The title identifies the specific area being refactored (Ktor EAP trigger settings) and highlights the main improvements (simplifying project and configuration handling, streamlining logging). This aligns well with the summarized changes which include replacing per-project repositories with a flat all-projects approach, switching to global configurations, and updating logging messages. The title is concise, clear, and meaningful for someone reviewing the commit history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vgoncharova/ktor-train

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
.teamcity/src/subprojects/train/TriggerProjectSamplesOnEAP.kt (3)

96-106: Minor: trim and read KTOR_VERSION once per project for clarity

Functionally OK. Small cleanups reduce per-dependency env reads and avoid whitespace pitfalls.

-                configurations.all {
-                    resolutionStrategy {
-                        eachDependency {
-                            if (requested.group == "io.ktor") {
-                                val ktorVersion = System.getenv("KTOR_VERSION")
+                val ktorVersion = System.getenv("KTOR_VERSION")?.trim()
+                configurations.all {
+                    resolutionStrategy {
+                        eachDependency {
+                            if (requested.group == "io.ktor") {
                                 if (ktorVersion.isNullOrBlank()) {
                                     throw GradleException("KTOR_VERSION environment variable is not set or is blank. Cannot resolve Ktor EAP dependencies.")
                                 }
-                                useVersion(ktorVersion)
+                                useVersion(ktorVersion)
                                 logger.lifecycle("Forcing Ktor dependency " + requested.name + " to use EAP version: " + ktorVersion)
                             }
                         }

108-110: Avoid global 0s caches; they degrade performance and aren’t needed when versions are fixed

You already force concrete io.ktor versions via useVersion(ktorVersion). Disabling caches globally slows every resolve.

-                        cacheDynamicVersionsFor(0, "seconds")
-                        cacheChangingModulesFor(0, "seconds")

113-121: Prefer a single root-level projectsEvaluated hook over per-project afterEvaluate

This avoids per-project callbacks and is order-safe for logging.

-                afterEvaluate {
-                    if (this == rootProject) {
-                        logger.lifecycle("Project " + name + ": Using Ktor EAP version " + System.getenv("KTOR_VERSION"))
-                        logger.lifecycle("Project " + name + ": EAP repository: https://maven.pkg.jetbrains.space/public/p/ktor/eap")
-                        val pluginVersion = System.getenv("KTOR_GRADLE_PLUGIN_VERSION")
-                        if (pluginVersion != null && pluginVersion.isNotEmpty()) {
-                            logger.lifecycle("Project " + name + ": Using latest Ktor Gradle plugin version " + pluginVersion)
-                        }
-                    }
-                }
+                // Log once after all projects are evaluated
+                gradle.projectsEvaluated {
+                    val root = rootProject
+                    root.logger.lifecycle("Project " + root.name + ": Using Ktor EAP version " + System.getenv("KTOR_VERSION"))
+                    root.logger.lifecycle("Project " + root.name + ": EAP repository: https://maven.pkg.jetbrains.space/public/p/ktor/eap")
+                    System.getenv("KTOR_GRADLE_PLUGIN_VERSION")?.takeIf { it.isNotEmpty() }?.let {
+                        root.logger.lifecycle("Project " + root.name + ": Using latest Ktor Gradle plugin version " + it)
+                    }
+                }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f4ccba and e4e1b3c.

📒 Files selected for processing (1)
  • .teamcity/src/subprojects/train/TriggerProjectSamplesOnEAP.kt (2 hunks)
🔇 Additional comments (2)
.teamcity/src/subprojects/train/TriggerProjectSamplesOnEAP.kt (2)

85-95: Verify target projects support Gradle ≥6.8 before adopting exclusiveContent

The suggested refactor to use exclusiveContent instead of mavenContent is stricter and better practice, but it requires Gradle ≥6.8. Since this TeamCity script generates configuration for downstream projects, you must confirm those projects' Gradle versions support this feature before applying the change.

The proposed refactor remains:

-                repositories {
-                    maven { 
-                        name = "KtorEAP"
-                        url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap")
-                        mavenContent {
-                            includeGroup("io.ktor")
-                        }
-                    }
-                }
+                repositories {
+                    exclusiveContent {
+                        forRepository {
+                            maven {
+                                name = "KtorEAP"
+                                url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap")
+                            }
+                        }
+                        filter {
+                            includeGroup("io.ktor")
+                        }
+                    }
+                }

Verify the Gradle wrapper versions in projects consuming this configuration before merging.


31-49: Verify Plugin Portal API ordering to confirm if .versions[0] is reliably the latest

No official /versions/latest endpoint exists on Gradle Plugin Portal, so querying the full API is the correct approach. However, the current implementation assumes .versions[0] is the latest version without confirming the Plugin Portal API guarantees this ordering.

The reviewer's suggestion to implement semver sorting is defensible—if the Plugin Portal returns versions in an unspecified order, fetching the first element could yield incorrect results and cause regressions. Before applying the suggested fixes, confirm with the Plugin Portal documentation or test the actual API response to verify that versions are consistently sorted by release date (newest first).

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.

2 participants