Skip to content

4 Decorators

Anthony HAMON edited this page Dec 27, 2017 · 6 revisions

Decorators enrich your changelog with datas.

Custom api decorator

You can fetch a custom api to fetch any data. First you need to define an id that will be added when calling your api.

Name Value
CHYLE_EXTRACTORS_CUSTOMAPIID_ORIGKEY Commit field where your custom api id is located
CHYLE_EXTRACTORS_CUSTOMAPIID_DESTKEY customApiId
CHYLE_EXTRACTORS_CUSTOMAPIID_REG A regexp to extract the id

You need to define a token header that will be given when calling your api and an url endpoint.

Name Value
CHYLE_DECORATORS_CUSTOMAPI_ENDPOINT_URL It's the endpoint of you remote api, use {{ID}} as a placeholder to interpolate the id you extracted before in URL
CHYLE_DECORATORS_CUSTOMAPI_CREDENTIALS_TOKEN Token submitted as authorization header when calling your api

To extract data, you need to define everytime both a "DESTKEY" key and a "FIELD" key, replace * with a name convenient to you, you can get as many value as you want.

Name Value
CHYLE_DECORATORS_CUSTOMAPI_KEYS_*_DESTKEY A name for the key which will receive the extracted value
CHYLE_DECORATORS_CUSTOMAPI_KEYS_*_FIELD The field to extract from your custom api response payload, use dot notation to extract a nested value (eg: "fields.summary")

Jira issue api

Have a look to the api documentation to know what you can fetch from this api. First, you need to use an extractor to define a "jiraIssueId" key to extract jira issue id, let's consider our id is in commit message we would add as environment variable.

Name Value
CHYLE_EXTRACTORS_JIRAISSUEID_ORIGKEY Commit field where your jira issue id is located
CHYLE_EXTRACTORS_JIRAISSUEID_DESTKEY jiraIssueId
CHYLE_EXTRACTORS_JIRAISSUEID_REG A regexp to extract the jira issue id

You need to define jira credentials and endpoint.

Name Value
CHYLE_DECORATORS_JIRAISSUE_ENDPOINT_URL It's the endpoint of you remote jira access point
CHYLE_DECORATORS_JIRAISSUE_CREDENTIALS_USERNAME Jira username
CHYLE_DECORATORS_JIRAISSUE_CREDENTIALS_PASSWORD Jira password

To extract data, you need to define everytime both a "DESTKEY" key and a "FIELD" key, replace * with a name convenient to you, you can get as many value as you want.

Name Value
CHYLE_DECORATORS_JIRAISSUE_KEYS_*_DESTKEY A name for the key which will receive the extracted value
CHYLE_DECORATORS_JIRAISSUE_KEYS_*_FIELD The field to extract from jira api response payload, use dot notation to extract a nested value (eg: "fields.summary" will retrieve the summary of a jira issue)

Github issue api

You can get pull request datas or issue datas from this decorator as described in api documentation. First, you need to use an extractor to define a "githubIssueId" key to extract github issue id, let's consider our id is in commit message we would add as environment variable.

Name Value
CHYLE_EXTRACTORS_GITHUBISSUEID_ORIGKEY Commit field where your github issue id is located
CHYLE_EXTRACTORS_GITHUBISSUEID_DESTKEY githubIssueId
CHYLE_EXTRACTORS_GITHUBISSUEID_REG A regexp to extract the github issue id

You need to define github credentials.

Name Value
CHYLE_DECORATORS_GITHUBISSUE_CREDENTIALS_OAUTHTOKEN Github oauth token used to fetch issue datas
CHYLE_DECORATORS_GITHUBISSUE_CREDENTIALS_OWNER Github owner

To extract data, you need to define everytime both a "DESTKEY" key and a "FIELD" key, replace * with a name convenient to you, you can get as many value as you want.

Name Value
CHYLE_DECORATORS_GITHUBISSUE_KEYS_*_DESTKEY A name for the key which will receive the extracted value
CHYLE_DECORATORS_GITHUBISSUE_KEYS_*_FIELD The field to extract from github issue api response payload, use dot notation to extract a nested value (eg: "user.id" will retrieve the user who created the issue)

Shell

You can pipe any shell commands on every commit datas through this decorator.

To extract data, you need to define a threesome, a "COMMAND" key, an "ORIGKEY" key and a "DESTKEY" key, replace * with a name convenient to you, you can get as many value as you want.

Name Value
CHYLE_DECORATORS_SHELL_*_COMMAND Command to execute
CHYLE_DECORATORS_SHELL_*_ORIGKEY A field from which you want to use the content to pipe a command on
CHYLE_DECORATORS_SHELL_*_DESTKEY A name for the key which will receive the extracted value

Environment variable

This decorator dump an environment variable in metadatas changelog section.

You need to define everytime both an "VALUE" key and a "DESTKEY" key, replace * with a name convenient to you, you can get as many value as you want.

Name Value
CHYLE_DECORATORS_ENV_*_VARNAME Environment variable name to dump in metadatas
CHYLE_DECORATORS_ENV_*_DESTKEY The name of the key where to store the dumped value in metadatas
Clone this wiki locally