Skip to content

Commit

Permalink
Add 'solution' boolean field (#43)
Browse files Browse the repository at this point in the history
* Add 'solution' boolean field

* Add 'solution' filter to controller

* Add 'solution' filter to client

* Fix client
  • Loading branch information
aryabokon committed Jun 27, 2024
1 parent 1137234 commit f8f20ed
Show file tree
Hide file tree
Showing 82 changed files with 151 additions and 25 deletions.
11 changes: 3 additions & 8 deletions .run/ComponentRegistryService (dev-fs).run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
<configuration default="false" name="ComponentRegistryService (dev-fs)" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev,dev-fs" />
<additionalParameters>
<param>
<option name="enabled" value="true" />
<option name="name" value="components-registry.work-dir" />
<option name="value" value="${COMPONENTS_REGISTRY_PROJECT_DIR}" />
</param>
<param>
<option name="enabled" value="true" />
<option name="name" value="spring.config.additional-location" />
Expand All @@ -23,12 +18,12 @@
<option name="IS_IGNORE_MISSING_FILES" value="true" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="true" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" />
<ENTRY IS_ENABLED="true" PARSER="env" PATH="$USER_HOME$/dev.env" />
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
<ENTRY IS_ENABLED="true" PARSER="env" IS_EXECUTABLE="false" PATH="$USER_HOME$/dev.env" />
</ENTRIES>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class EscrowConfigurationLoader {
final String clientCode = loadComponentClientCode(moduleConfigSection, componentDefaultConfiguration.clientCode)
final String parentComponent = loadComponentParentComponent(moduleConfigSection, componentDefaultConfiguration.parentComponent)
final Boolean releasesInDefaultBranch = loadReleasesInDefaultBranch(moduleConfigSection, componentDefaultConfiguration.releasesInDefaultBranch)
final Boolean solution = loadSolution(moduleConfigSection, componentDefaultConfiguration.solution)
final String componentDisplayName = loadComponentDisplayName(moduleConfigSection, componentDefaultConfiguration.componentDisplayName)
final String octopusVersion = loadVersion(moduleConfigSection, componentDefaultConfiguration.octopusVersion, LoaderInheritanceType.VERSION_RANGE.octopusVersionInherit)

Expand All @@ -292,6 +293,7 @@ class EscrowConfigurationLoader {
system: system,
clientCode: clientCode,
releasesInDefaultBranch: releasesInDefaultBranch,
solution: solution,
parentComponent: parentComponent,
jiraConfiguration: jiraConfiguration,
buildConfiguration: buildConfiguration?.clone(),
Expand All @@ -315,6 +317,7 @@ class EscrowConfigurationLoader {
system: componentDefaultConfiguration.system,
clientCode: componentDefaultConfiguration.clientCode,
releasesInDefaultBranch: componentDefaultConfiguration.releasesInDefaultBranch,
solution: componentDefaultConfiguration.solution,
parentComponent: componentDefaultConfiguration.parentComponent,
buildFilePath: componentDefaultConfiguration.getBuildFilePath(),
jiraConfiguration: componentDefaultConfiguration.jiraComponent,
Expand Down Expand Up @@ -657,6 +660,11 @@ class EscrowConfigurationLoader {
}
}

@TypeChecked(TypeCheckingMode.SKIP)
private static boolean loadSolution(ConfigObject parentConfigObject, Boolean defaultSolution) {
return parentConfigObject.getOrDefault("solution", defaultSolution)
}

@TypeChecked(TypeCheckingMode.SKIP)
private static loadComponentParentComponent(ConfigObject parentConfigObject, String defaultParentComponent){
if (parentConfigObject.containsKey("parentComponent")) {
Expand Down Expand Up @@ -896,6 +904,7 @@ class EscrowConfigurationLoader {
final String system = loadComponentSystem(componentConfigObject, defaultConfiguration.system)
final String clientCode = loadComponentClientCode(componentConfigObject, defaultConfiguration.clientCode)
final Boolean releasesInDefaultBranch = loadReleasesInDefaultBranch(componentConfigObject, defaultConfiguration.releasesInDefaultBranch)
final Boolean solution = loadSolution(componentConfigObject, defaultConfiguration.solution)
final String parentComponent = loadComponentParentComponent(componentConfigObject, defaultConfiguration.parentComponent)
final String octopusVersion = loadVersion(componentConfigObject, defaultConfiguration.octopusVersion, inheritanceType.octopusVersionInherit)

Expand All @@ -909,6 +918,7 @@ class EscrowConfigurationLoader {
system: system,
clientCode: clientCode,
releasesInDefaultBranch: releasesInDefaultBranch,
solution: solution,
parentComponent: parentComponent,
jiraComponent: jiraComponent,
buildParameters: buildParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,7 @@ class DefaultConfigParameters {
String octopusVersion

Boolean releasesInDefaultBranch

Boolean solution
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.octopusden.octopus.releng.dto.JiraComponent
@EqualsAndHashCode(includeFields = true, includes = ["buildSystem", "artifactIdPattern", "groupIdPattern",// "versionRange",
"buildFilePath", "jiraConfiguration", "buildConfiguration", "deprecated", "vcsSettings",
"distribution", "componentDisplayName", "componentOwner", "releaseManager", "securityChampion", "system",
"clientCode", "releasesInDefaultBranch", "parentComponent", "octopusVersion", "escrow", "productType"])
"clientCode", "releasesInDefaultBranch", "solution", "parentComponent", "octopusVersion", "escrow", "productType"])
@ToString(includeFields = true)
class EscrowModuleConfig {
private BuildSystem buildSystem
Expand Down Expand Up @@ -59,6 +59,8 @@ class EscrowModuleConfig {

private Boolean releasesInDefaultBranch

private Boolean solution

private String parentComponent

private String octopusVersion
Expand Down Expand Up @@ -135,6 +137,14 @@ class EscrowModuleConfig {
this.releasesInDefaultBranch = releasesInDefaultBranch
}

Boolean getSolution() {
return solution
}

void setSolution(Boolean solution) {
this.solution = solution
}

String getParentComponent() {
return parentComponent
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class EscrowConfigValidator {
validateSystem(moduleConfig, componentName)
validateClientCode(moduleConfig, componentName)
validateReleasesInDefaultBranch(moduleConfig, componentName)
validateSolution(moduleConfig, componentName)
}
}
if (!hasErrors()) {
Expand Down Expand Up @@ -403,6 +404,14 @@ class EscrowConfigValidator {
}
}

def validateSolution(EscrowModuleConfig moduleConfig, String component) {
def solution = moduleConfig.getSolution()
if (solution == null) {
// ToDo uncomment after default value is set
// registerError("solution is not specified in component '$component'")
}
}

/**
* Validate component name.
* @param componentName component name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GroovySlurperConfigValidator {
'teamcityReleaseConfigId', 'jiraProjectKey', 'jiraMajorVersionFormat', 'jiraReleaseVersionFormat',
'buildFilePath', 'deprecated', BRANCH,
'componentDisplayName', 'componentOwner', 'releaseManager', 'securityChampion', 'system',
'clientCode', 'releasesInDefaultBranch', 'parentComponent', 'octopusVersion']
'clientCode', 'releasesInDefaultBranch', 'solution', 'parentComponent', 'octopusVersion']
static SUPPORTED_JIRA_ATTRIBUTES = ['projectKey', 'lineVersionFormat', 'majorVersionFormat', 'releaseVersionFormat', 'buildVersionFormat', "displayName", 'technical']

static SUPPORTED_BUILD_ATTRIBUTES = ['dependencies', 'javaVersion', 'mavenVersion', 'gradleVersion', 'requiredProject', 'systemProperties', 'projectVersion', 'requiredTools', 'buildTasks']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class JiraParametersResolver implements IJiraParametersResolver {
system: escrowModuleConfig.system,
clientCode: escrowModuleConfig.clientCode,
releasesInDefaultBranch: escrowModuleConfig.releasesInDefaultBranch,
solution: escrowModuleConfig.solution,
parentComponent: escrowModuleConfig.parentComponent
)
addJiraComponentVersionRange(projectKey, projectKeyToJiraComponentVersionRangeMap, enrichedModuleConfig, projectKey, componentName, versionNames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
securityChampion: "user",
system: "CLASSIC",
releasesInDefaultBranch: true,
solution: false,
buildSystem: BuildSystem.MAVEN,
artifactIdPattern: "builder",
groupIdPattern: "io.bcomponent",
Expand Down Expand Up @@ -161,6 +162,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
buildSystem: MAVEN,
system: "NONE",
releasesInDefaultBranch: true,
solution: false,
artifactIdPattern: /[\w-]+/,
groupIdPattern: "org.octopusden.octopus.bcomponent",
versionRange: "[1.12.1-150,)",
Expand All @@ -175,6 +177,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
buildSystem: BuildSystem.BS2_0,
system: "NONE",
releasesInDefaultBranch: true,
solution: false,
groupIdPattern: "org.octopusden.octopus.bcomponent",
artifactIdPattern: /[\w-]+/,
versionRange: "(,1.12.1-150)",
Expand Down Expand Up @@ -202,6 +205,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
buildSystem: MAVEN,
system: "NONE",
releasesInDefaultBranch: true,
solution: false,
artifactIdPattern: /[\w-]+/,
groupIdPattern: "org.octopusden.octopus.bcomponent",
versionRange: "[1.12.1-151,)",
Expand All @@ -227,6 +231,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
buildSystem: MAVEN,
system: "NONE",
releasesInDefaultBranch: true,
solution: false,
artifactIdPattern: "test-cvs-maven-parent,test-cvs-maven-module1",
groupIdPattern: "org.octopusden.octopus.bcomponent",
versionRange: "(,0),[0,)",
Expand Down Expand Up @@ -254,6 +259,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
buildSystem: BuildSystem.MAVEN,
system: "NONE",
releasesInDefaultBranch: true,
solution: false,
artifactIdPattern: "test-cvs-maven-parent,test-cvs-maven-module1",
groupIdPattern: "org.octopusden.octopus.bcomponent",
versionRange: "(,0),[0,)",
Expand Down Expand Up @@ -315,7 +321,8 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
releaseManager: "somereleasemanager",
securityChampion: "somesecuritychampion",
system: "CLASSIC",
releasesInDefaultBranch: false
releasesInDefaultBranch: false,
solution: true,
)
assert expectedModuleConfig == modelConfiguration

Expand All @@ -341,6 +348,7 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
securityChampion: "somesecuritychampion",
system: "CLASSIC",
releasesInDefaultBranch: false,
solution: true
)
assert expectedModuleConfig == modelConfiguration

Expand All @@ -361,7 +369,8 @@ class EscrowConfigurationLoaderTest extends GroovyTestCase {
releaseManager: "anotherreleasemanager",
securityChampion: "anothersecuritychampion",
system: "CLASSIC,ALFA",
releasesInDefaultBranch: true
releasesInDefaultBranch: true,
solution: false
)
assert expectedModuleConfig == modelConfiguration
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.*
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = '$module-$version';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.*
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = '$module-$version';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ final ANY_ARTIFACT = /[\w-\.]+/
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.CVS
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
}

bcomponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.CVS
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
}

bcomponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final ANY_ARTIFACT = /[\w-\.]+/
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final ANY_ARTIFACT = /[\w-\.]+/
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
1 change: 1 addition & 0 deletions component-resolver-core/src/test/resources/app.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Tools {
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = '$module-$version';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum VCS {
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum VCS {
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
versionRange = "(,)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ DEFAULT_TAG = '$module-$version'
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
// repositoryType = MERCURIAL
// buildSystem = MAVEN;
// versionRange = "(,)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Tools {
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final ALL_VERSIONS = "(,0),[0,)"
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.*
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
jira {
majorVersionFormat = '$major.$minor'
releaseVersionFormat = '$major.$minor.$service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final ANY_ARTIFACT = /[\w-\.]+/
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ final ANY_ARTIFACT = /[\w-\.]+/
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = DEFAULT_TAG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Defaults {
buildSystem = MAVEN;
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = GIT
tag = '$module-$version';
artifactId = ANY_ARTIFACT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final ANY_ARTIFACT = /[\w-\.]+/
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
tag = '$module-$version'
artifactId = ANY_ARTIFACT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.MERCURIAL
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN
tag = DEFAULT_TAG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import static org.octopusden.octopus.escrow.RepositoryType.*
Defaults {
system = "NONE"
releasesInDefaultBranch = true
solution = false
repositoryType = MERCURIAL
buildSystem = MAVEN;
tag = '$module-$version';
Expand Down
Loading

0 comments on commit f8f20ed

Please sign in to comment.