Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
* Support StatefulSet in Helm charts ([#1108](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1108))
* The Document History indicates clearly when an SLC document has not changed ([#1099](https://github.com/opendevstack/ods-jenkins-shared-library/pull/1099))

### Fixed
Expand Down
11 changes: 10 additions & 1 deletion src/org/ods/component/HelmDeploymentStrategy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ 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, DEPLOYMENT_KINDS, options.selector
context.targetProject, deploymentKinds, options.selector
)
logger.info("${this.class.name} -- DEPLOYMENT RESOURCES")
logger.info(
Expand Down Expand Up @@ -173,6 +175,13 @@ class HelmDeploymentStrategy extends AbstractDeploymentStrategy {
def rolloutData = [:]
deploymentResources.each { resourceKind, resourceNames ->
resourceNames.each { resourceName ->

logger.info(
"Fetching resource for resourcekind: "
+ "${resourceKind}/${resourceName}"
+ "(selector: ${options.selector})"
)

def podData = []
for (def i = 0; i < options.deployTimeoutRetries; i++) {
podData = openShift.checkForPodData(context.targetProject, options.selector, resourceName)
Expand Down
11 changes: 10 additions & 1 deletion src/org/ods/orchestration/phases/DeployOdsComponent.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,24 @@ class DeployOdsComponent {
applyTemplates(openShiftDir, deploymentMean)

def retries = project.environmentConfig?.openshiftRolloutTimeoutRetries ?: 10
def podData = null
for (def i = 0; i < retries; i++) {
def podData = os.checkForPodData(project.targetProject, deploymentMean.selector)
podData = os.checkForPodData(project.targetProject, deploymentMean.selector)
if (podData) {
return podData
}
steps.echo("Could not find 'running' pod(s) with label '${deploymentMean.selector}' - waiting")
steps.sleep(12)
}

if (podData == null) {
throw new RuntimeException(
"Error: Could not find 'running' pod(s) with label"
+ "'${deploymentMean.selector}'"
)
}

// TODO: What if podData is empty?
// TODO: Once the orchestration pipeline can deal with multiple replicas,
// update this to deal with multiple pods.
def pod = podData[0].toMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class OdsComponentStageRolloutOpenShiftDeploymentSpec extends PipelineSpockTestB
def c = config + [environment: 'dev',targetProject: 'foo-dev',openshiftRolloutTimeoutRetries: 5,chartDir: 'chart']
IContext context = new Context(null, c, logger)
OpenShiftService openShiftService = Mock(OpenShiftService.class)
openShiftService.getResourcesForComponent('foo-dev', ['Deployment', 'DeploymentConfig'], 'app=foo-bar') >> [Deployment: ['bar']]
openShiftService.getResourcesForComponent('foo-dev', ['Deployment', 'DeploymentConfig', 'StatefulSet'], 'app=foo-bar') >> [Deployment: ['bar']]
openShiftService.getRevision(*_) >> 123
openShiftService.rollout(*_) >> "${config.componentId}-124"
openShiftService.getPodDataForDeployment(*_) >> [new PodData([ deploymentId: "${config.componentId}-124" ])]
Expand Down