-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1287 Templating renderables documentation
- Loading branch information
1 parent
bff8928
commit f5ecc1b
Showing
9 changed files
with
207 additions
and
0 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
8 changes: 8 additions & 0 deletions
8
ontrack-docs/src/docs/asciidoc/templating/renderables/index.adoc
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,8 @@ | ||
[[appendix-templating-renderable-index]] | ||
==== List of special templating objects | ||
|
||
* <<templating-renderable-av,Auto-versioning context (av)>> | ||
* <<templating-renderable-workflow,Information about the workflow (workflow)>> | ||
|
||
include::templating-renderable-av.adoc[] | ||
include::templating-renderable-workflow.adoc[] |
23 changes: 23 additions & 0 deletions
23
...ack-docs/src/docs/asciidoc/templating/renderables/templating-renderable-av.adoc
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,23 @@ | ||
[[templating-renderable-av]] | ||
==== Auto-versioning context (av) | ||
|
||
The `av` context can be used in templates in the PR title & body templates, in order to access information about the auto-versioning request. | ||
|
||
Context: Auto-versioning | ||
|
||
Available fields: | ||
|
||
* `changelog`: Changelog for the project & version being updated | ||
|
||
** **allQualifiers** - Boolean - required - Loop over all qualifiers for the last level of `dependencies`, including the default one. Qualifiers at `dependencies` take precedence. | ||
|
||
** **commitsOption** - NONE, OPTIONAL, ALWAYS - required - Defines how to render commits for a change log | ||
|
||
** **defaultQualifierFallback** - Boolean - required - If a qualifier has no previous link, uses the default qualifier (empty) qualifier. | ||
|
||
** **dependencies** - List - required - Comma-separated list of project links to follow one by one for a get deep change log. Each item in the list is either a project name, or a project name and qualifier separated by a colon (:). | ||
|
||
** **empty** - String - required - String to use to render an empty or non existent change log | ||
|
||
** **title** - Boolean - required - Include a title for the change log | ||
|
13 changes: 13 additions & 0 deletions
13
...cs/src/docs/asciidoc/templating/renderables/templating-renderable-workflow.adoc
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,13 @@ | ||
[[templating-renderable-workflow]] | ||
==== Information about the workflow (workflow) | ||
|
||
The `workflow` context is used to access information about the nodes of the workflow, in notifications or other templates rendered in the context of the workflow execution. | ||
|
||
Context: Workflow | ||
|
||
Available fields: | ||
|
||
* `<node id>`: Getting information about a node in the current workflow | ||
|
||
** **path** - String - required - JSON path to the data to render | ||
|
29 changes: 29 additions & 0 deletions
29
...et/nemerosa/ontrack/extension/av/processing/AutoVersioningOrderTemplatingRenderableDoc.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,29 @@ | ||
package net.nemerosa.ontrack.extension.av.processing | ||
|
||
import net.nemerosa.ontrack.extension.scm.changelog.ChangeLogTemplatingServiceConfig | ||
import net.nemerosa.ontrack.model.annotations.APIDescription | ||
import net.nemerosa.ontrack.model.templating.TemplatingRenderableDoc | ||
import net.nemerosa.ontrack.model.templating.TemplatingRenderableDocField | ||
import org.springframework.stereotype.Component | ||
|
||
/** | ||
* Documentation for AutoVersioningOrderTemplatingRenderable. | ||
*/ | ||
@Component | ||
@APIDescription("The `av` context can be used in templates in the PR title & body templates, in order to access information about the auto-versioning request.") | ||
class AutoVersioningOrderTemplatingRenderableDoc : TemplatingRenderableDoc { | ||
|
||
override val id: String = "av" | ||
|
||
override val displayName: String = "Auto-versioning context" | ||
|
||
override val contextName: String = "Auto-versioning" | ||
|
||
override val fields: List<TemplatingRenderableDocField> = listOf( | ||
TemplatingRenderableDocField( | ||
name = "changelog", | ||
description = "Changelog for the project & version being updated", | ||
config = ChangeLogTemplatingServiceConfig::class, | ||
) | ||
) | ||
} |
25 changes: 25 additions & 0 deletions
25
...va/net/nemerosa/ontrack/extension/workflows/templating/WorkflowTemplatingRenderableDoc.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,25 @@ | ||
package net.nemerosa.ontrack.extension.workflows.templating | ||
|
||
import net.nemerosa.ontrack.model.annotations.APIDescription | ||
import net.nemerosa.ontrack.model.templating.TemplatingRenderableDoc | ||
import net.nemerosa.ontrack.model.templating.TemplatingRenderableDocField | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
@APIDescription("The `workflow` context is used to access information about the nodes of the workflow, in notifications or other templates rendered in the context of the workflow execution.") | ||
class WorkflowTemplatingRenderableDoc : TemplatingRenderableDoc { | ||
|
||
override val id: String = "workflow" | ||
|
||
override val displayName: String = "Information about the workflow" | ||
|
||
override val contextName: String = "Workflow" | ||
|
||
override val fields: List<TemplatingRenderableDocField> = listOf( | ||
TemplatingRenderableDocField( | ||
name = "<node id>", | ||
description = "Getting information about a node in the current workflow", | ||
config = WorkflowTemplatingRenderableParameters::class, | ||
) | ||
) | ||
} |
29 changes: 29 additions & 0 deletions
29
ontrack-model/src/main/java/net/nemerosa/ontrack/model/templating/TemplatingRenderableDoc.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,29 @@ | ||
package net.nemerosa.ontrack.model.templating | ||
|
||
/** | ||
* This interface is used to create beans which act as documentation | ||
* for instances of [TemplatingRenderable] object. | ||
*/ | ||
interface TemplatingRenderableDoc { | ||
|
||
/** | ||
* This ID is used to identify the renderable into a context | ||
*/ | ||
val id: String | ||
|
||
/** | ||
* Display name of the renderable (used for documentation only) | ||
*/ | ||
val displayName: String | ||
|
||
/** | ||
* Where this renderable can be used | ||
*/ | ||
val contextName: String | ||
|
||
/** | ||
* Supported fields | ||
*/ | ||
val fields: List<TemplatingRenderableDocField> | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...model/src/main/java/net/nemerosa/ontrack/model/templating/TemplatingRenderableDocField.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 net.nemerosa.ontrack.model.templating | ||
|
||
import kotlin.reflect.KClass | ||
|
||
/** | ||
* Representation of a field in a [TemplatingRenderable]. | ||
* | ||
* @property name Name of the field | ||
* @property description Description of the field | ||
* @property config Class of the field (for the documentation) | ||
*/ | ||
data class TemplatingRenderableDocField( | ||
val name: String, | ||
val description: String, | ||
val config: KClass<*>, | ||
) |
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