Skip to content

Commit

Permalink
Refactor to use constants like in other services
Browse files Browse the repository at this point in the history
  • Loading branch information
serverhorror committed May 8, 2024
1 parent 262d210 commit 9a16363
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/org/ods/component/AbstractDeploymentStrategy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.ods.util.PodData

abstract class AbstractDeploymentStrategy implements IDeploymentStrategy {

protected final List<String> DEPLOYMENT_KINDS = [
protected List<String> DEPLOYMENT_KINDS = [
OpenShiftService.DEPLOYMENT_KIND, OpenShiftService.DEPLOYMENTCONFIG_KIND,
]

Expand Down
12 changes: 9 additions & 3 deletions src/org/ods/component/HelmDeploymentStrategy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ class HelmDeploymentStrategy extends AbstractDeploymentStrategy {
this.options = new RolloutOpenShiftDeploymentOptions(config)
this.openShift = openShift
this.jenkins = jenkins

// Why? In Groovy protected fields are implicitly final.
// As per Google: This seems to be the idiomatic way to override protected fields
DEPLOYMENT_KINDS.clear()
DEPLOYMENT_KINDS.addAll(
OpenShiftService.DEPLOYMENT_KIND, OpenShiftService.DEPLOYMENTCONFIG_KIND,
OpenShiftService.STATEFULSET_KIND,
)
}

@Override
Expand All @@ -95,10 +103,8 @@ class HelmDeploymentStrategy extends AbstractDeploymentStrategy {
logger.info "Rolling out ${context.componentId} with HELM, selector: ${options.selector}"
helmUpgrade(context.targetProject)

def deploymentKinds = DEPLOYMENT_KINDS << 'StatefulSet'

def deploymentResources = openShift.getResourcesForComponent(
context.targetProject, deploymentKinds, options.selector
context.targetProject, DEPLOYMENT_KINDS, options.selector
)
logger.info("${this.class.name} -- DEPLOYMENT RESOURCES")
logger.info(
Expand Down
1 change: 1 addition & 0 deletions src/org/ods/services/OpenShiftService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class OpenShiftService {
static final String ROLLOUT_WAITING = 'waiting'
static final String DEPLOYMENTCONFIG_KIND = 'DeploymentConfig'
static final String DEPLOYMENT_KIND = 'Deployment'
static final String STATEFULSET_KIND = 'StatefulSet'

private final IPipelineSteps steps
private final ILogger logger
Expand Down

0 comments on commit 9a16363

Please sign in to comment.