Comments (14)
You can check out my CONTRIBUTING.md for POSHOrigin here as an example.
from psdeploy.
I spent some time looking through the code. Wanted to get your thoughts on how you want to see things implemented.
It looks like, in general, the code for the individual deployment types will throw an exception in the event of a failure. In my CI test where I integrated PSDeploy, I was copying a folder, so it used robocopy, which does not throw an exception on failure. I think making sure the deployments all behave consistently and throw on any failure is step 1.
After that, it's a question of what the overall behavior should be. When invoking multiple deployments through Invoke-PSDeploy
, each call to Invoke-PSDeployment
could be wrapped in a try/catch to prevent one deployment failing from bringing the entire process down (using Write-Error
in the catch block so it is still visible, just non-terminating). If the -EnableExit
parameter was specified, we keep track of how many failures we catch and at the end of Invoke-PSDeploy
call an exit function with that number. An exit code of 0 indicates success, and aside from that the exit code would report how many deployments failed.
I'm going to start working along those lines, but I think this will change some of the existing behavior, which is why I want to hear what you think.
from psdeploy.
Makes sense to me! Not something we'd need for our use, but, if folks start contributing, I can certainly see a number of scenarios this could benefit.
I could see an EnableExit parameter on Invoke-PSDeploy as a whole, and perhaps on individual deployments (either Deploy or By functions) in cases where only certain deployments would need the functionality.
Thanks for the reminder... Should probably draft up (/borrow) a contributing.md, if folks end up using and contributing to this!
from psdeploy.
Be careful with RoboCopy exitcodes. This is something I'm currently working with in one of my own projects.
To test this out, start RoboCopy and then kill the process before out finishes. It will still exit with a return code of 1, which is a success exit code for RoboCopy.
I am currently working on a solution that checks the size of the folders to ensure they are the same size. I have this working, but am wanting to add support for excluded folders and files.
I also created a helper function that just outputs what the codes enumerate to. I'm still tinkering with my project, and it had a different use case than this, but there is some overlap.
I'm on my phone at the moment, but I'll try to share a few of my ideas tomorrow and get some feedback.
from psdeploy.
With Robocopy, an interesting thing you can do, is rerun the exact same command, but add the /L switch. This will run the same exact command, but won't actually copy the files. If the first command ran the way expected, the /L switch should return Exit Code 0.
from psdeploy.
Could we add something like this for now: https://github.com/FooBartn/PSDeploy/blob/master/PSDeploy/Private/Invoke-Robocopy.ps1 ?
I was using this in a psake build script and Jenkins would fail the build every time since, like @gerane said, a successful exit code in robocopy is 1. Technicaly 1, 2, and 4 are "successful". 8 and 10 are actually full out error codes. This doesn't actually check each individual file, but perhaps it's a start?
from psdeploy.
I'd say that's better than a start! This is a great wrapper to help us use robocopy like any of the other tools in our PowerShell toolbox.
from psdeploy.
Hi!
Very cool, thanks for writing that @FooBartn! It might be worth a slight modification to support @platta's idea of an EnableExit parameter - this would keep things behaving as-is unless someone threw that switch.
For example, rather than exit, you might throw or write-error, which we could catch in PSDeploy and either write the error and continue, or exit if the switch is specified.
Cheers!
from psdeploy.
I'll see what I can do :)
from psdeploy.
Check now and see if that's closer to what you were looking for. Thanks!
from psdeploy.
Awesome, looks good to me! Feel free to submit a PR to master and I can integrate it in, or if you're feeling generous, feel free to add it to Invoke-PSDeploy
.
Cheers!
from psdeploy.
I think I already integrated it correctly. I modified your Filesystem and FilesystemRemote scripts to call Invoke-Robocopy instead of directly calling it. I've been using the version I made for test builds and it seems to be functioning. PR submitted for review
Thanks!
from psdeploy.
Since you accepted the pull request, I think you should be able to close this and the backslash issue. Don't know what process you typically follow to validate the issue has been fixed before doing so, though. Let me know if there's anything I can do to help
Thanks!
from psdeploy.
Makes sense, closing now : ) Thanks!
from psdeploy.
Related Issues (20)
- DependingOn not working as expected (ordering wrong) HOT 5
- AppVeyor deployment not supporting subfolder for nupkg HOT 1
- Deployment fails on Linux HOT 3
- Move FileSystem tests out of the main function tests.
- Appveyor module fails when running in Powershell 6.0 HOT 1
- AppVeyor deployment: NuGet: An error occurred while parsing EntityName errors
- Shadow-Copy Function Throws Exception when run on PS Core on Linux or OSX HOT 7
- [Suggestion] Using name instead of path parameter in PSGalleryModule deployment type
- Invoke-Robocopy FatalError with /xf parameter
- Search for *psdeploy.ps1 is case sensitive on Unix systems
- GitHub Release DeploymentType HOT 2
- Please upgrade to latest YamlDotNet
- New Deployment Type: Azure Automation runbook HOT 2
- My psd1 version and psgallery version don't update.
- RequiredModules breaks PSGallery deploy type to private nuget repo HOT 1
- By Filesystem on PS Core fails with error HOT 1
- Upcoming major releases of Chocolatey products that may impact functionality on the integration HOT 1
- New Deployment Type: SCP HOT 2
- Filter deploy based on Tag/TagName and pre-release status HOT 7
- PSGalleryModule - Make ApiKey optional HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psdeploy.