Skip to content

Commit fd88882

Browse files
authored
Fix setting env vars for plugin repository (#669)
- Removed double underscore from DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_* env vars - Set GRADLE_PLUGIN_REPOSITORY_* env vars
1 parent 3af3dd3 commit fd88882

3 files changed

Lines changed: 29 additions & 15 deletions

File tree

sources/src/configuration.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export class DependencyGraphConfig {
7171
return getOptionalInput('dependency-graph-include-configurations')
7272
}
7373

74+
getPluginRepository(): PluginRepositoryConfig {
75+
return new PluginRepositoryConfig()
76+
}
77+
7478
static constructJobCorrelator(workflow: string, jobId: string, matrixJson: string): string {
7579
const matrixString = this.describeMatrix(matrixJson)
7680
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`
@@ -301,16 +305,8 @@ export class BuildScanConfig {
301305
return core.getInput('develocity-ccud-plugin-version')
302306
}
303307

304-
getGradlePluginRepositoryUrl(): string {
305-
return core.getInput('gradle-plugin-repository-url')
306-
}
307-
308-
getGradlePluginRepositoryUsername(): string {
309-
return core.getInput('gradle-plugin-repository-username')
310-
}
311-
312-
getGradlePluginRepositoryPassword(): string {
313-
return core.getInput('gradle-plugin-repository-password')
308+
getPluginRepository(): PluginRepositoryConfig {
309+
return new PluginRepositoryConfig()
314310
}
315311

316312
private verifyTermsOfUseAgreement(): boolean {
@@ -328,6 +324,20 @@ export class BuildScanConfig {
328324
}
329325
}
330326

327+
export class PluginRepositoryConfig {
328+
getUrl(): string | undefined {
329+
return getOptionalInput('gradle-plugin-repository-url')
330+
}
331+
332+
getUsername(): string | undefined {
333+
return getOptionalInput('gradle-plugin-repository-username')
334+
}
335+
336+
getPassword(): string | undefined {
337+
return getOptionalInput('gradle-plugin-repository-password')
338+
}
339+
}
340+
331341
export class GradleExecutionConfig {
332342
getGradleVersion(): string {
333343
return core.getInput('gradle-version')

sources/src/dependency-graph.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export async function setup(config: DependencyGraphConfig): Promise<void> {
4040
maybeExportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', config.getIncludeProjects())
4141
maybeExportVariable('DEPENDENCY_GRAPH_EXCLUDE_CONFIGURATIONS', config.getExcludeConfigurations())
4242
maybeExportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', config.getIncludeConfigurations())
43+
44+
maybeExportVariable('GRADLE_PLUGIN_REPOSITORY_URL', config.getPluginRepository().getUrl())
45+
maybeExportVariable('GRADLE_PLUGIN_REPOSITORY_USERNAME', config.getPluginRepository().getUsername())
46+
maybeExportVariable('GRADLE_PLUGIN_REPOSITORY_PASSWORD', config.getPluginRepository().getPassword())
4347
}
4448

4549
function maybeExportVariable(variableName: string, value: string | boolean | undefined): void {

sources/src/develocity/build-scan.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ export async function setup(config: BuildScanConfig): Promise<void> {
1919
maybeExportVariableNotEmpty('DEVELOCITY_INJECTION_ENFORCE_URL', config.getDevelocityEnforceUrl())
2020
maybeExportVariableNotEmpty('DEVELOCITY_INJECTION_DEVELOCITY_PLUGIN_VERSION', config.getDevelocityPluginVersion())
2121
maybeExportVariableNotEmpty('DEVELOCITY_INJECTION_CCUD_PLUGIN_VERSION', config.getDevelocityCcudPluginVersion())
22-
maybeExportVariableNotEmpty('DEVELOCITY_INJECTION__PLUGIN_REPOSITORY_URL', config.getGradlePluginRepositoryUrl())
22+
maybeExportVariableNotEmpty('DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_URL', config.getPluginRepository().getUrl())
2323
maybeExportVariableNotEmpty(
24-
'DEVELOCITY_INJECTION__PLUGIN_REPOSITORY_USERNAME',
25-
config.getGradlePluginRepositoryUsername()
24+
'DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_USERNAME',
25+
config.getPluginRepository().getUsername()
2626
)
2727
maybeExportVariableNotEmpty(
28-
'DEVELOCITY_INJECTION__PLUGIN_REPOSITORY_PASSWORD',
29-
config.getGradlePluginRepositoryPassword()
28+
'DEVELOCITY_INJECTION_PLUGIN_REPOSITORY_PASSWORD',
29+
config.getPluginRepository().getPassword()
3030
)
3131

3232
// If build-scan-publish is enabled, ensure the environment variables are set

0 commit comments

Comments
 (0)