Skip to content

Commit c3c31f7

Browse files
bot-gradlealllex
authored andcommitted
Avoid duplicate exposing of Gradle in settings-scope
2 parents efffb90 + dc2369d commit c3c31f7

File tree

4 files changed

+64
-7
lines changed

4 files changed

+64
-7
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Cleanup stale performance test data
2+
3+
on:
4+
schedule:
5+
- cron: '0 4 * * 1' # Run every Monday at 4:00 AM UTC
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
cleanup-stale-performance-data:
14+
runs-on: ubuntu-latest
15+
16+
if: github.repository == 'gradle/gradle'
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v5
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@v5
24+
with:
25+
role-to-assume: arn:aws:iam::992382829881:role/GHASecrets_gradle_all
26+
aws-region: "eu-central-1"
27+
28+
- name: Get secrets
29+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
30+
with:
31+
secret-ids: |
32+
PERFORMANCE_DB_URL, gha/gradle/_all/PERFORMANCE_DB_URL
33+
PERFORMANCE_DB_USERNAME, gha/gradle/_all/PERFORMANCE_DB_USERNAME
34+
PERFORMANCE_DB_PASSWORD_TCAGENT, gha/gradle/_all/PERFORMANCE_DB_PASSWORD
35+
36+
- name: Extract database host from URL
37+
run: |
38+
# jdbc:mysql://gradle-bt-performance.xyz.eu-central-1.rds.amazonaws.com:3306 -> gradle-bt-performance.xyz.eu-central-1.rds.amazonaws.com
39+
echo "DB_HOST=$(echo ${PERFORMANCE_DB_URL} | cut -d/ -f3 | cut -d: -f1)" >> $GITHUB_ENV
40+
41+
- name: Clean up stale data and verify results
42+
run: |
43+
echo "Cleaning up stale data from both databases..."
44+
docker run --rm mysql:latest mysql \
45+
-u${{ env.PERFORMANCE_DB_USERNAME }} \
46+
-p${{ env.PERFORMANCE_DB_PASSWORD_TCAGENT }} \
47+
-h${{ env.DB_HOST }} \
48+
-e '
49+
USE results;
50+
DELETE FROM testOperation WHERE testExecution IN (SELECT id FROM testExecution WHERE startTime < NOW() - INTERVAL 365 DAY);
51+
DELETE FROM testExecution WHERE startTime < NOW() - INTERVAL 365 DAY;
52+
SELECT "results.testExecution count:" as database_table, COUNT(*) as stale_records FROM testExecution WHERE startTime < NOW() - INTERVAL 365 DAY;
53+
USE cross_build_results;
54+
DELETE FROM testOperation WHERE testExecution IN (SELECT id FROM testExecution WHERE startTime < NOW() - INTERVAL 365 DAY);
55+
DELETE FROM testExecution WHERE startTime < NOW() - INTERVAL 365 DAY;
56+
SELECT "cross_build_results.testExecution count:" as database_table, COUNT(*) as stale_records FROM testExecution WHERE startTime < NOW() - INTERVAL 365 DAY;
57+
'
58+
59+
- name: Summary
60+
run: |
61+
echo "✅ Cleanup completed successfully"
62+
echo "🗑️ Removed test data older than 365 days from both databases"

subprojects/core-api/src/main/java/org/gradle/api/invocation/Gradle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* <p>You can obtain a {@code Gradle} instance by calling {@link Project#getGradle()}.</p>
4747
*/
4848
@HasInternalProtocol
49-
@ServiceScope(Scope.Gradle.class)
49+
@ServiceScope(Scope.Build.class)
5050
public interface Gradle extends PluginAware, ExtensionAware {
5151

5252
/**

subprojects/core/src/main/java/org/gradle/api/internal/GradleInternal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* consumption.
4444
*/
4545
@UsedByScanPlugin
46-
@ServiceScope({Scope.Build.class, Scope.Settings.class})
46+
@ServiceScope(Scope.Build.class)
4747
public interface GradleInternal extends Gradle, PluginAwareInternal {
4848
/**
4949
* {@inheritDoc}

subprojects/core/src/main/java/org/gradle/internal/service/scopes/SettingsScopeServices.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ protected ConfigurationTargetIdentifier createConfigurationTargetIdentifier() {
121121
return ConfigurationTargetIdentifier.of(settings);
122122
}
123123

124-
@Provides
125-
protected GradleInternal createGradleInternal() {
126-
return settings.getGradle();
127-
}
128-
129124
@Provides
130125
protected CacheConfigurationsInternal createCacheConfigurations(ObjectFactory objectFactory, CacheConfigurationsInternal persistentCacheConfigurations, GradleInternal gradleInternal) {
131126
CacheConfigurationsInternal cacheConfigurations = objectFactory.newInstance(DefaultCacheConfigurations.class);

0 commit comments

Comments
 (0)