Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Commit

Permalink
gitlab commit trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyutkarsh committed Mar 9, 2019
1 parent b04b9ed commit 9f17d42
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ node_modules
*.js.map
*.env
.cache
dist/
dist/
**/*.rest
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
"**/.DS_Store": true,
"**/*.js.map": true,
"**/*.taskkey": true,
"**/*.js": { "when": "$(basename).ts"}
}
"**/*.js": {
"when": "$(basename).ts"
}
},
"workbench.colorCustomizations": {
"tab.activeBorder": "#ff0000",
},
}
34 changes: 34 additions & 0 deletions vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,44 @@
"target": "artifactItems",
"dataSourceName": "Artifacts",
"resultTemplate": "{ Value : \"{{{path}}}\", DisplayValue : \"{{{path}}}\", data: { itemType: \"{{ #stringReplace ['tree','blob'] ['folder','file'] type }}\" } }"
},
{
"target": "listwebhook",

This comment has been minimized.

Copy link
@onlyutkarsh

onlyutkarsh Mar 9, 2019

Author Owner

Does this need to change the get webhook by id rest api instead of list webhooks?

This comment has been minimized.

Copy link
@kasubram

kasubram Mar 13, 2019

Collaborator

No, let it stay as is. We get the list and try to find the webhook which matches the payloadUrl which is unique per webhook on RM side.

This comment has been minimized.

Copy link
@onlyutkarsh

onlyutkarsh Mar 25, 2019

Author Owner

Sorry for being late here. Thanks for your response.

"endpointUrl": "{{{endpoint.url}}}projects/{{definition}}/hooks",
"requestVerb": "Post",
"requestContent": "{}",
"resultSelector": "jsonpath:$"
},
{
"target": "createwebhook",
"endpointUrl": "{{{endpoint.url}}}projects/{{definition}}/hooks?url={{payloadUrl}}",
"requestVerb": "Post",
"requestContent": "{}",
"resultSelector": "jsonpath:$"
},
{
"target": "deletewebhook",
"endpointUrl": "{{{endpoint.url}}}projects/{{definition}}/hooks/{{hookid}}",

This comment has been minimized.

Copy link
@onlyutkarsh

onlyutkarsh Mar 9, 2019

Author Owner

To delete a webhook I need to pass the created webhook id. Not sure how to reference the id of the webhook here.

This comment has been minimized.

Copy link
@kasubram

kasubram Mar 13, 2019

Collaborator

This is something we have to fix, we are thinking of using the listwebhook and get the exact webhook we are interested in and pass the id back here. We will try this and let you know if any change is required here.

"requestVerb": "Post",
"requestContent": "{}",
"resultSelector": "jsonpath:$"
}
],
"browsableArtifactTypeMapping": {
"folder": "artifactItems"
},
"ArtifactTriggerConfiguration": {
"isTriggerSupported": true,
"isTriggerSupportedOnlyInHosted": false,
"isWebhookSupportedAtServerLevel": false,
"resources": {
"TriggerDisabledMessage": "Enabling the trigger will create a new release every time a new commit is made in the selected repository and the branch"
},
"payloadHashHeaderName": "X-GitLab-Token",
"webhookPayloadMapping": {
"version": "{{id}}",
"definition": "{{name}}"

This comment has been minimized.

Copy link
@onlyutkarsh

onlyutkarsh Mar 9, 2019

Author Owner

This seems like the trigger works only works for a selected repo. What about the branch trigger? Meaning, I would like the release to trigger only from the specific repo on the master branch. Do I need to modify any mapping?

This comment has been minimized.

Copy link
@kasubram

kasubram Mar 13, 2019

Collaborator

We don't have branch support yet through extension.

}
}
}
}
Expand Down

0 comments on commit 9f17d42

Please sign in to comment.