Skip to content

Manually configure some cache-redirected repositories - #4686

Open
Badya wants to merge 3 commits into
developfrom
badya/cache-redirector
Open

Manually configure some cache-redirected repositories#4686
Badya wants to merge 3 commits into
developfrom
badya/cache-redirector

Conversation

@Badya

@Badya Badya commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@Badya
Badya force-pushed the badya/cache-redirector branch 2 times, most recently from 92abe7d to 2f32f80 Compare June 2, 2026 15:52
@fzhinkin
fzhinkin changed the base branch from develop to kotlin-community/dev June 2, 2026 16:57
@fzhinkin

fzhinkin commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@Badya, I don't know if you love rebasing branches as much as I do, but please, rebase it back to dev (after running tests on the CI side), we'll merge the change there and then I'll merge the dev to kotlin-community/dev

@Badya
Badya force-pushed the badya/cache-redirector branch 4 times, most recently from f1f465b to cf026ad Compare June 3, 2026 10:03
- make kotlin dev repo exclusive content
so we don't request dev versions from other repos
@Badya
Badya force-pushed the badya/cache-redirector branch from cf026ad to 0e3cc70 Compare June 3, 2026 10:15
@Badya
Badya changed the base branch from kotlin-community/dev to develop June 3, 2026 10:15
rh.maven(devRepoUrl)
}
filter {
includeVersionByRegex("org.jetbrains.kotlin", ".*", version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Badya, Why it has to be done this way?

@Badya Badya Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the best way to use in such a case, and Gradle best practice.
https://docs.gradle.org/current/userguide/filtering_repository_content.html#sec:declaring-content-repositories

Looking up dev deps in central or in cache redirector (which is gonna poll central under the hood) will result in guaranteed 404, but also will count towards central's request limit bringing up potential throttling and 429 Too Many Requests.
By using this Gradle is guaranteed not to look up deps matching regexp elsewhere.

Additionally I suspect Gradle to continue trying other repositories on 404 but in the case of 429 Too Many Requests from central, it just fails the build right away. Provided solution also prevents this behavior regardless of repos declaring order.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be enough to simply move the dev repo declaration before central repo and gradle plugins portal?

@Badya Badya Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

move the dev repo declaration before

If something is wrong with dev repo and gradle fails to find artifacts there, it still gonna try other repos in that case, which we want to avoid, since we know for 100% artifacts are not there.

This is the best way to configure gradle for this case

@fzhinkin fzhinkin Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But the dev repo is specified in cases when we know for sure that the artifact should be there, isn't it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In my view, this configuration makes perfect sense. The kotlin_dev_repo Gradle property specifies: "You must use the Kotlin development repository for Kotlin!" That means we aren't supposed to use the non-development repository for Kotlin. The proposed config catches the error where 1) kotlinx.coroutines accidentally depends on a hardcoded version of Kotlin, or 2) where the TeamCity config got broken and passed a stable instead of the development version of Kotlin, or 3) where the Kotlin Gradle Plugin got broken and accidentally stripped out the dev version suffix during resolution... It's a reasonable way of ensuring we get exactly what we requested, instead of pulling in something undesired from Maven without noticing.

@dkhalanskyjb dkhalanskyjb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The entire integration-testing/ project needs to be updated, too, I suppose?

@fzhinkin

fzhinkin commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Still trying to figure out how to avoid copy-pasting the same repository configuration from one build script into another.
Meanwhile, I cherry picked both commits from this PR into kotlin-community/dev to unblock our CI.

- CacheRedirector seems not applied to allprojects block
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