-
Notifications
You must be signed in to change notification settings - Fork 32
/
InstanceProvision.kt
33 lines (26 loc) · 1.19 KB
/
InstanceProvision.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.cognifide.gradle.aem.instance.tasks
import com.cognifide.gradle.aem.common.instance.provision.Status
import com.cognifide.gradle.aem.common.tasks.InstanceTask
import org.gradle.api.tasks.TaskAction
open class InstanceProvision : InstanceTask() {
@TaskAction
fun provision() {
instanceManager.examine(instances.get())
val allActions = instanceManager.provisioner.provision(instances.get())
val performedActions = allActions.filter { it.status != Status.SKIPPED }
val instances = performedActions.map { it.step.instance }.toSet()
val performed = performedActions.count()
val ended = performedActions.count { it.status == Status.ENDED }
val failed = performedActions.count { it.status == Status.FAILED }
if (performed > 0) {
common.notifier.notify("Instances provisioned", "Performed $performed steps(s)" +
" ($ended ended, $failed failed) on ${instances.size} instance(s).")
}
}
init {
description = "Configures instances only in concrete circumstances (only once, after some time etc)"
}
companion object {
const val NAME = "instanceProvision"
}
}