Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing changes publicly #90

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions .github/workflows/jira_linker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Jira Issue Linker

on:
pull_request:
types: [opened, edited, synchronize]

jobs:
jira-issue-link:
runs-on: ubuntu-latest
if: github.repository == 'launchdarkly/integration-framework-private'
steps:
- uses: launchdarkly-labs/ld-gh-actions-jira@7d61c90e8fc29c3ce8e3f0fb55d963afd084a359
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
jira-base-url: https://launchdarkly.atlassian.net
jira-username: ${{ secrets.JIRA_USERNAME }}
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
62 changes: 62 additions & 0 deletions __tests__/validateIntegrationManifests.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,68 @@ describe('All integrations', () => {
}
);

test.each(manifests)(
'defaultValue types match the type of the approvalFormVariable for %s',
(key, manifest) => {
const formVariables = _.get(
manifest,
'capabilities.approval.approvalFormVariables',
null
);
if (formVariables) {
formVariables.forEach(formVariable => {
if (!_.isUndefined(formVariable.defaultValue)) {
expect(
formVariable.isOptional,
'"defaultValue" is only valid if "isOptional" is true. Use "placeholder" if you do not want the variable to be optional.'
).toBe(true);
if (
formVariable.type === 'string' ||
formVariable.type === 'uri' ||
formVariable.type === 'enum' ||
formVariable.type === 'dynamicEnum'
) {
expect(_.isString(formVariable.defaultValue)).toBe(true);
} else if (formVariable.type === 'boolean') {
expect(_.isBoolean(formVariable.defaultValue)).toBe(true);
}
}
});
}
}
);

test.each(manifests)(
'defaultValue types match the type of the environmentFormVariable for %s',
(key, manifest) => {
const formVariables = _.get(
manifest,
'capabilities.approval.environmentFormVariables',
null
);
if (formVariables) {
formVariables.forEach(formVariable => {
if (!_.isUndefined(formVariable.defaultValue)) {
expect(
formVariable.isOptional,
'"defaultValue" is only valid if "isOptional" is true. Use "placeholder" if you do not want the variable to be optional.'
).toBe(true);
if (
formVariable.type === 'string' ||
formVariable.type === 'uri' ||
formVariable.type === 'enum' ||
formVariable.type === 'dynamicEnum'
) {
expect(_.isString(formVariable.defaultValue)).toBe(true);
} else if (formVariable.type === 'boolean') {
expect(_.isBoolean(formVariable.defaultValue)).toBe(true);
}
}
});
}
}
);

test.each(manifests)(
'defaultValue is always provided when isOptional true for %s',
(key, manifest) => {
Expand Down
3 changes: 3 additions & 0 deletions integrations/custom-approvals/assets/images/horizontal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions integrations/custom-approvals/assets/images/square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions integrations/custom-approvals/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"name": "Custom Approvals",
"version": "1.0.0",
"overview": "Integrate LaunchDarkly approvals with an application of your own design.",
"description": "Integrate LaunchDarkly approvals with an application of your own design.",
"author": "LaunchDarkly",
"supportEmail": "support@launchdarkly.com",
"links": {
"site": "https://launchdarkly.com/",
"launchdarklyDocs": "https://docs.launchdarkly.com/integrations/custom-approvals",
"privacyPolicy": "https://launchdarkly.com/policies/privacy/"
},
"icons": {
"square": "assets/images/square.svg",
"horizontal": "assets/images/horizontal.svg"
},
"categories": ["approval"],
"requiresOAuth": false,
"formVariables": [
{
"key": "apiKey",
"name": "API Token",
"description": "Enter the API your custom service will use to authenticate.",
"placeholder": "e.g. 8M7wS6hCpXVc-DoRnPPY_UCWPgy8aea4Wy6kCe5T",
"type": "string",
"isSecret": true
},
{
"key": "baseURL",
"name": "Custom approval service base URL",
"description": "The base URL of your custom approval service. This is where all of the API handlers should be set up.",
"type": "string",
"placeholder": "e.g. https://mycustomapprovalservice.com"
}
],
"allowIntegrationConfigurations": true,
"capabilities": {
"approval": {
"name": "Custom Approvals",
"approvalFormVariables": [],
"allowApprovalIntegrationConfigurations": true,
"allowAdditionalApprovalFormVariables": true,
"creationRequest": {
"endpoint": {
"url": "{{ baseURL }}/api/approvals",
"method": "POST",
"headers": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer {{ apiKey }}"
}
]
},
"jsonBody": "{\"_site\": {\"href\": \"{{_links.approval.href}}\"}, \"_id\": \"{{approvalId}}\", {{#if details.plainText}}\"details\": \"{{details.plainText}}\",{{/if}} \"project\": {\"name\":\"{{project.name}}\", \"key\": \"{{project.key}}\", \"tags\":[{{#each project.tags}}\"{{this}}\"{{#if @last}}{{else}},{{/if}}{{/each}}]}, \"environment\": {\"name\":\"{{project.environment.name}}\", \"key\": \"{{project.environment.key}}\", \"tags\":[{{#each project.environment.tags}}\"{{this}}\"{{#if @last}}{{else}},{{/if}}{{/each}}]}, \"flag\": {\"name\":\"{{flag.name}}\", \"key\": \"{{flag.key}}\", \"tags\":[{{#each flag.tags}}\"{{this}}\"{{#if @last}}{{else}},{{/if}}{{/each}}]},{{#if title.member}}\"requestedBy\": {\"id\": \"{{member._id}}\", \"email\": \"{{member.email}}\"},{{/if}}\"shortDescription\": \"{{{title.plainText}}}\", \"timestamp\": \"{{timestamp.milliseconds}}\", \"approvalFormVariables\": { {{#each approvalFormVariables}} \"{{@key}}\": \"{{this}}\"{{#if @last}}{{else}},{{/if}}{{/each}} },\"comment\": \"{{approvalDescription}}\" }",
"parser": {
"approvalId": "/_id",
"statusValue": "/status/value",
"statusDisplay": "/status/display",
"approvalMatcher": "approved",
"rejectionMatcher": "declined",
"urlTemplate": "{{ baseURL }}/approvals?approvalID={{ context.approvalId }}"
}
},
"statusRequest": {
"endpoint": {
"url": "{{ baseURL }}/api/approvals/{{ context.approvalId }}/status",
"method": "GET",
"headers": [
{
"name": "Authorization",
"value": "Bearer {{ apiKey }}"
}
]
},
"parser": {
"statusValue": "/status/value",
"statusDisplay": "/status/display",
"approvalMatcher": "approved",
"rejectionMatcher": "declined"
}
},
"postApplyRequest": {
"endpoint": {
"url": "{{ baseURL }}/api/approvals/{{ context.approvalId }}/apply",
"method": "POST",
"headers": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer {{ apiKey }}"
}
]
},
"parser": {
"statusValue": "/status/value",
"statusDisplay": "/status/display",
"approvalMatcher": "approved",
"rejectionMatcher": "declined"
}
},
"deletionRequest": {
"endpoint": {
"url": "{{ baseURL }}/api/approvals/{{ context.approvalId }}/cancel",
"method": "POST",
"headers": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer {{ apiKey }}"
}
]
},
"parser": {
"statusValue": "/status/value",
"statusDisplay": "/status/display",
"approvalMatcher": "approved",
"rejectionMatcher": "declined"
}
},
"memberListRequest": {
"endpoint": {
"url": "{{baseURI}}/api/members",
"method": "GET",
"headers": [
{
"name": "Authorization",
"value": "Bearer {{apiToken}}"
}
]
},
"parser": {
"memberArrayPath": "/members",
"memberItems": {
"memberId": "/name",
"email": "/email"
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion integrations/msteams/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"capabilities": {
"auditLogEventsHook": {
"endpoint": {
"url": "{{url}}",
"url": "{{{url}}}",
"method": "POST",
"headers": [
{
Expand Down
37 changes: 28 additions & 9 deletions integrations/msteams/templates/default.json.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "{{{title.plainText}}}",
"sections": [
"type":"message",
"attachments":[
{
"activityTitle": "{{{title.html}}}{{#equal project.environment.key '~'}} in all environments{{/equal}}",
"activitySubtitle": "{{#if project.name}}{{project.name}}{{#if project.environment.name}} / {{project.environment.name}}{{/if}} / {{name}}{{/if}}",
"text": "{{#if details}}{{{details.html}}}{{/if}}{{#if comment}}\n<strong>Comment:</strong> {{{comment}}}\n{{/if}}",
"xml": true
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "TextBlock",
"text": "{{{title.markdown}}}{{#equal project.environment.key '~'}} in all environments{{/equal}}",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"text": "{{#if project.name}}{{project.name}}{{#if project.environment.name}} / {{project.environment.name}}{{/if}} / {{name}}{{/if}}",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"text": "{{#if details}}{{{details.markdown}}}{{/if}}{{#if comment}}\n**Comment:** {{{comment}}}\n{{/if}}",
"wrap": true
}
]
}
}
]
}
37 changes: 28 additions & 9 deletions integrations/msteams/templates/environment.json.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "{{{title.plainText}}}",
"sections": [
"type":"message",
"attachments":[
{
"activityTitle": "{{{title.html}}}",
"activitySubtitle": "{{project.name}} / {{name}}",
"text": "{{#if details}}{{{details.html}}}{{/if}}{{#if comment}}\n<strong>Comment:</strong> {{{comment}}}\n{{/if}}",
"xml": true
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "TextBlock",
"text": "{{{title.markdown}}}",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"text": "{{project.name}} / {{name}}",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"text": "{{#if details}}{{{details.markdown}}}{{/if}}{{#if comment}}\n**Comment:** {{{comment}}}\n{{/if}}",
"wrap": true
}
]
}
}
]
}
30 changes: 22 additions & 8 deletions integrations/msteams/templates/project.json.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "{{{title.plainText}}}",
"sections": [
"type":"message",
"attachments":[
{
"activityTitle": "{{{title.html}}}",
"text": "{{#if details}}{{{details.html}}}{{/if}}{{#if comment}}\n<strong>Comment:</strong> {{{comment}}}\n{{/if}}",
"xml": true
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "TextBlock",
"text": "{{{title.markdown}}}",
"weight": "bolder",
"wrap": true
},
{
"type": "TextBlock",
"text": "{{#if details}}{{{details.markdown}}}{{/if}}{{#if comment}}\n**Comment:** {{{comment}}}\n{{/if}}",
"wrap": true
}
]
}
}
]
}
Loading