Skip to content

Commit

Permalink
Bump releng-lib from 2.0.4 to 2.0.5 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonophore committed Aug 1, 2023
1 parent ffd078d commit eccf717
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ public JiraComponentVersionRange create(
VCSSettings vcsSettings
) {
JiraComponentVersionFormatter jiraComponentVersionFormatter = new JiraComponentVersionFormatter(versionNames);
JiraComponentVersion jiraComponentVersion = JiraComponentVersion.builder(jiraComponentVersionFormatter)
.componentVersion(ComponentVersion.create(componentName, versionRange))
.component(jiraComponent)
.build();
JiraComponentVersion jiraComponentVersion = new JiraComponentVersion(
ComponentVersion.create(componentName, versionRange),
jiraComponent,
jiraComponentVersionFormatter
);

return new JiraComponentVersionRange(
componentName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public interface IJiraParametersResolver {

ComponentVersion getComponentByJiraProject(JiraProjectVersion jiraProjectVersion) throws NoConfigurationFoundException;

/**
* Not nullable
*/
VCSSettings getVersionControlSystemRootsByJiraProject(JiraProjectVersion jiraProjectVersion);

ComponentConfig getComponentConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ class JiraComponentVersionRangeTest extends GroovyTestCase {
distribution,
VCSSettings.createEmpty()
)
def expectedComponent = JiraComponentVersion.builder(new JiraComponentVersionFormatter(VERSION_NAMES))
.componentVersion(ComponentVersion.create(TEST_COMPONENT, TEST_VERSION))
.component(jiraComponent)
.build()
def expectedComponent = new JiraComponentVersion(
ComponentVersion.create(TEST_COMPONENT, TEST_VERSION),
jiraComponent,
new JiraComponentVersionFormatter(VERSION_NAMES)
)

assert expectedComponent == range.jiraComponentVersion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.api.parallel.ResourceLock
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.web.server.LocalServerPort
import org.springframework.boot.test.web.server.LocalServerPort
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.context.junit.jupiter.SpringExtension
import java.util.Date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.MethodSource
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.web.server.LocalServerPort
import org.springframework.boot.test.web.server.LocalServerPort
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.context.junit.jupiter.SpringExtension
import java.util.stream.Stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class JiraComponentVersionToDetailedComponentVersionMapper(
target.rcVersion = ComponentRegistryVersion(
ComponentVersionType.RC,
componentVersionFormat.releaseVersionFormat.formatVersion(versionNumericVersionFactory, src.version) + JiraComponentVersion.RC_SUFFIX,
src.rCversion
src.rcVersion
)
target.releaseVersion = ComponentRegistryVersion(
ComponentVersionType.RELEASE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.octopusden.octopus.components.registry.server.service.impl

import org.apache.maven.artifact.DefaultArtifact
import org.octopusden.octopus.components.registry.core.dto.ArtifactDependency
import org.octopusden.octopus.components.registry.core.dto.VersionedComponent
import org.octopusden.octopus.components.registry.core.exceptions.NotFoundException
Expand All @@ -20,7 +21,6 @@ import org.octopusden.octopus.escrow.resolvers.ModuleByArtifactResolver
import org.octopusden.octopus.releng.JiraComponentVersionFormatter
import org.octopusden.octopus.releng.dto.ComponentVersion
import org.octopusden.octopus.releng.dto.JiraComponentVersion
import org.apache.maven.artifact.DefaultArtifact
import org.octopusden.releng.versions.NumericVersionFactory
import org.octopusden.releng.versions.VersionNames
import org.octopusden.releng.versions.VersionRangeFactory
Expand Down Expand Up @@ -48,9 +48,11 @@ class ComponentRegistryResolverImpl(
) : ComponentRegistryResolver {

private lateinit var configuration: EscrowConfiguration
private val versionNames = VersionNames(componentsRegistryProperties.versionName.serviceBranch,
private val versionNames = VersionNames(
componentsRegistryProperties.versionName.serviceBranch,
componentsRegistryProperties.versionName.service,
componentsRegistryProperties.versionName.minor)
componentsRegistryProperties.versionName.minor
)

override fun updateCache() {
configuration = configurationLoader.loadFullConfigurationWithoutValidationForUnknownAttributes(emptyMap())
Expand All @@ -70,10 +72,11 @@ class ComponentRegistryResolverImpl(
override fun getJiraComponentVersion(component: String, version: String): JiraComponentVersion {
val keyToVersionRanges = jiraParametersResolver.componentConfig.componentNameToJiraComponentVersionRangeMap
val range = getJiraComponentVersionRange(component, version, keyToVersionRanges, false)
val builder = JiraComponentVersion.builder(jiraComponentVersionFormatter)
.component(range.component)
.componentVersionByNameAndVersion(range.componentName, version)
return builder.build()!!
return JiraComponentVersion(
ComponentVersion.create(range.componentName, version),
range.component,
jiraComponentVersionFormatter
)
}

override fun getJiraComponentVersions(
Expand All @@ -87,7 +90,6 @@ class ComponentRegistryResolverImpl(
val result = mutableMapOf<String, JiraComponentVersion>()

val mutableVersionSet = versions.toMutableSet()
val builder = JiraComponentVersion.builder(jiraComponentVersionFormatter)
val factory = VersionRangeFactory(versionNames)
for (jiraComponentVersionRange in jiraComponentVersionRanges) {

Expand All @@ -100,9 +102,11 @@ class ComponentRegistryResolverImpl(

val numericArtifactVersion = numericVersionFactory.create(version)
if (versionRange.containsVersion(numericArtifactVersion)) {
builder.component(jiraComponentVersionRange.component)
.componentVersionByNameAndVersion(jiraComponentVersionRange.componentName, version)
val jiraComponentVersion = builder.build()
val jiraComponentVersion = JiraComponentVersion(
ComponentVersion.create(jiraComponentVersionRange.componentName, version),
jiraComponentVersionRange.component,
jiraComponentVersionFormatter
)
if (jiraComponentVersionFormatter.matchesAny(jiraComponentVersion, version, false)) {
jiraComponentVersionRange?.let {
result[version] = jiraComponentVersion
Expand All @@ -120,7 +124,10 @@ class ComponentRegistryResolverImpl(

override fun getVCSSettings(component: String, version: String): VCSSettings {
return with(getJiraComponentVersion(component, version)) {
val buildVersion = this.component.componentVersionFormat.buildVersionFormat.formatVersion(numericVersionFactory, this.version)
val buildVersion = this.component.componentVersionFormat.buildVersionFormat.formatVersion(
numericVersionFactory,
this.version
)
getJiraComponentVersionRange(component, buildVersion)
.let {
ModelConfigPostProcessor(
Expand Down Expand Up @@ -237,14 +244,15 @@ class ComponentRegistryResolverImpl(
): JiraComponentVersionRange {
val jiraComponentVersionRanges =
keyToVersionRanges[key] ?: throw NotFoundException("Component id $key is not found")
val builder = JiraComponentVersion.builder(jiraComponentVersionFormatter)
val foundRanges = jiraComponentVersionRanges.map { item ->
val versionRange = versionRangeFactory.create(item.versionRange)
val numericArtifactVersion = numericVersionFactory.create(version)
if (versionRange.containsVersion(numericArtifactVersion)) {
builder.component(item.component)
.componentVersion(ComponentVersion.create(item.componentName, version))
val jiraComponentVersion = builder.build()
val jiraComponentVersion = JiraComponentVersion(
ComponentVersion.create(item.componentName, version),
item.component,
jiraComponentVersionFormatter
)
if (jiraComponentVersionFormatter.matchesAny(jiraComponentVersion, version, strict)) {
if (LOG.isTraceEnabled) {
LOG.trace("Found {} component by {}:{}", jiraComponentVersion, key, version)
Expand All @@ -270,10 +278,11 @@ class ComponentRegistryResolverImpl(
strict: Boolean = true
): JiraComponentVersion? {
val range = getJiraComponentVersionRange(key, version, keyToVersionRangeMap, strict)
return JiraComponentVersion.builder(jiraComponentVersionFormatter)
.component(range.component)
.componentVersion(ComponentVersion.create(range.componentName, version))
.build()
return JiraComponentVersion(
ComponentVersion.create(range.componentName, version),
range.component,
jiraComponentVersionFormatter
)
}

private fun getDistribution(
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ow deps
octopus-release-management.version=2.0.4
releng-lib.version=2.0.4
releng-lib.version=2.0.5
buildsystem-model.version=1.2.401
rest-service-library.version=1.4

Expand Down

0 comments on commit eccf717

Please sign in to comment.