How to wire up a webhook using powershell after a successful web deployment?
Hi AV :)
So I'm trying to figure out how to use powershell to call a webhook when the webdeploy step was successful.
Checking the docs, it looks like I can use the deployment_success
or on_success
steps.
Now, these are the questions I'm not sure about:
- Can this only occur on a specific branch? E.g. when we do a
master
build/deploy?
I was thinking something like this..
for:
-
branches:
only:
- dev
<snipped>
-
branches:
only:
- master
configuration: Release
deploy:
- provider: WebDeploy
<snipped>
deployment_success:
- ps: <something here>
- We're playing around with using RETRACE by STACKIFY for our code insights/metrics. They have the ability for us to 'tag' when we deploy, so we can see which code metrics are for build #1 vs build #2, etc. To do this, they have a provided API and provided a full powershell script file. Now, I'm not sure where we should put this file and how to call this file from
appveyor.yml
.
Lets assume it's in a folder called scripts
in our ROOT github repo folder. the file is called stackify-deploy.ps1
... how do we call it?
here's the example they give us ...
ps > .\stackify-deploy.ps1 complete -apiKey "SUN98aIxmzZUkUX8BYNsybDcxJctxEuYjHCKX9M0jo" -app \"FooApp\" -env \"Prod\" -version "v1.0" -name \"BourneAgain\" -branch "master" -commit "ca35857d2cc6050a2525491840922a6d5d359006" -uri "localhost"
of course:
-apikey
is asecure environment variable
i'll setup-version
is the appveyor version variable-branch
is the appveyor branch variable-commit
is the appveyor commit variable-uri
... no idea what this optional setting is. will get more info on this.
So .. if I place the .ps1
file is found at \scripts\stackfiy-deploy.ps1
... how can I use it please?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ilya Finkelshte... on 10 Oct, 2017 10:37 PM
Hi,
Best place for you to put that script is
after_deploy
scriptYou do not need that complexity in yaml. just use
APPVEYOR_REPO_BRANCH
environment variable to condition it.It can look like this:
this assumes that you do not do
CD
command and change current directory. Otherwise you can use more reliable path like$env:APPVEYOR_BUILD_FOLDER\scripts\stackfiy-deploy.ps1
2 Posted by Pure Krome on 10 Oct, 2017 10:43 PM
Thanks @Ilya! That's great stuff :)
also, is it
IF
orif
(all upper or all lower case) ?3 Posted by Ilya Finkelshte... on 10 Oct, 2017 11:16 PM
It is not case sensitive, use what you prefer :)
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:20 AM.