-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
141 changed files
with
2,491 additions
and
804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...jenkins/src/main/kotlin/com/gatehill/corebot/driver/jenkins/action/JenkinsActionDriver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
...yment/jobs/src/main/kotlin/com/gatehill/corebot/chat/model/template/DisableJobTemplate.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...oyment/jobs/src/main/kotlin/com/gatehill/corebot/chat/model/template/EnableJobTemplate.kt
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
...yment/jobs/src/main/kotlin/com/gatehill/corebot/chat/model/template/TriggerJobTemplate.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...oyment/jobs/src/main/kotlin/com/gatehill/corebot/deploy/TriggerActionTemplateConverter.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../src/main/kotlin/com/gatehill/corebot/driver/jobs/action/TriggerActionFactoryConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.gatehill.corebot.driver.jobs.action | ||
|
||
import com.gatehill.corebot.action.ActionFactoryConverter | ||
import com.gatehill.corebot.action.factory.ActionFactory | ||
import com.gatehill.corebot.chat.ChatGenerator | ||
import com.gatehill.corebot.config.model.ActionConfig | ||
import com.gatehill.corebot.driver.jobs.action.factory.TriggerJobFactory | ||
import javax.inject.Inject | ||
|
||
/** | ||
* @author Pete Cornish {@literal <[email protected]>} | ||
*/ | ||
class TriggerActionFactoryConverter @Inject constructor(private val chatGenerator: ChatGenerator) : ActionFactoryConverter { | ||
override fun convertConfigToFactory(configs: Iterable<ActionConfig>): Collection<ActionFactory> = | ||
configs.map { TriggerJobFactory(it, chatGenerator) }.toList() | ||
} |
16 changes: 16 additions & 0 deletions
16
...jobs/src/main/kotlin/com/gatehill/corebot/driver/jobs/action/factory/DisableJobFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.gatehill.corebot.driver.jobs.action.factory | ||
|
||
import com.gatehill.corebot.action.factory.ActionMessageMode | ||
import com.gatehill.corebot.action.factory.NamedActionFactory | ||
import com.gatehill.corebot.action.factory.Template | ||
import com.gatehill.corebot.action.model.ActionType | ||
import com.gatehill.corebot.config.ConfigService | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Disables a job. | ||
*/ | ||
@Template("disableJob", builtIn = true, showInUsage = true, actionMessageMode = ActionMessageMode.INDIVIDUAL) | ||
class DisableJobFactory @Inject constructor(configService: ConfigService) : NamedActionFactory(configService) { | ||
override val actionType: ActionType = JobActionType.DISABLE | ||
} |
16 changes: 16 additions & 0 deletions
16
.../jobs/src/main/kotlin/com/gatehill/corebot/driver/jobs/action/factory/EnableJobFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.gatehill.corebot.driver.jobs.action.factory | ||
|
||
import com.gatehill.corebot.action.factory.ActionMessageMode | ||
import com.gatehill.corebot.action.factory.NamedActionFactory | ||
import com.gatehill.corebot.action.factory.Template | ||
import com.gatehill.corebot.action.model.ActionType | ||
import com.gatehill.corebot.config.ConfigService | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Enables a job. | ||
*/ | ||
@Template("enableJob", builtIn = true, showInUsage = true, actionMessageMode = ActionMessageMode.INDIVIDUAL) | ||
class EnableJobFactory @Inject constructor(configService: ConfigService) : NamedActionFactory(configService) { | ||
override val actionType: ActionType = JobActionType.ENABLE | ||
} |
6 changes: 3 additions & 3 deletions
6
...ebot/chat/model/template/JobActionType.kt → ...iver/jobs/action/factory/JobActionType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...jobs/src/main/kotlin/com/gatehill/corebot/driver/jobs/action/factory/TriggerJobFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.gatehill.corebot.driver.jobs.action.factory | ||
|
||
import com.gatehill.corebot.action.factory.ActionMessageMode | ||
import com.gatehill.corebot.action.factory.CustomActionFactory | ||
import com.gatehill.corebot.action.factory.Template | ||
import com.gatehill.corebot.action.model.ActionType | ||
import com.gatehill.corebot.action.model.TriggerContext | ||
import com.gatehill.corebot.chat.ChatGenerator | ||
import com.gatehill.corebot.chat.filter.StringFilter | ||
import com.gatehill.corebot.config.model.ActionConfig | ||
|
||
/** | ||
* Triggers job execution. | ||
*/ | ||
@Template("triggerJob", builtIn = false, showInUsage = true, actionMessageMode = ActionMessageMode.INDIVIDUAL) | ||
class TriggerJobFactory(action: ActionConfig, | ||
private val chatGenerator: ChatGenerator) : CustomActionFactory() { | ||
|
||
override val actionType: ActionType = JobActionType.TRIGGER | ||
override val actionConfigs: List<ActionConfig> | ||
|
||
init { | ||
this.actionConfigs = mutableListOf(action) | ||
parsers += StringFilter.StringFilterConfig(action.template, action.template) | ||
} | ||
|
||
override fun buildStartMessage(trigger: TriggerContext, options: Map<String, String>, actionConfig: ActionConfig?): String { | ||
actionConfig ?: throw IllegalArgumentException("Empty actionConfig") | ||
|
||
val msg = StringBuilder() | ||
msg.append("${chatGenerator.pleaseWait()}, I'm running *${actionConfig.name}*") | ||
|
||
if (options.isNotEmpty()) { | ||
msg.append(" with these options:") | ||
options.forEach { arg -> msg.append("\r\n- ${arg.key}: _${arg.value}_") } | ||
} else { | ||
msg.append(".") | ||
} | ||
|
||
return msg.toString() | ||
} | ||
} |
11 changes: 7 additions & 4 deletions
11
...l/corebot/action/BaseJobTriggerService.kt → ...ver/jobs/service/BaseJobTriggerService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ehill/corebot/action/JobTriggerService.kt → .../driver/jobs/service/JobTriggerService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
backends/deployment/jobs/src/main/resources/jobs-templates.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Templates for jobs backend. | ||
--- | ||
disableJob: | ||
- template: disable {action or tag name} | ||
|
||
enableJob: | ||
- template: enable {action or tag name} |
Oops, something went wrong.