Giter Site home page Giter Site logo

Comments (14)

devblackops avatar devblackops commented on July 17, 2024 2

You can check out my CONTRIBUTING.md for POSHOrigin here as an example.

from psdeploy.

platta avatar platta commented on July 17, 2024 1

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.

RamblingCookieMonster avatar RamblingCookieMonster commented on July 17, 2024

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.

gerane avatar gerane commented on July 17, 2024

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.

gerane avatar gerane commented on July 17, 2024

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.

FooBartn avatar FooBartn commented on July 17, 2024

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.

platta avatar platta commented on July 17, 2024

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.

RamblingCookieMonster avatar RamblingCookieMonster commented on July 17, 2024

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.

FooBartn avatar FooBartn commented on July 17, 2024

I'll see what I can do :)

from psdeploy.

FooBartn avatar FooBartn commented on July 17, 2024

Check now and see if that's closer to what you were looking for. Thanks!

from psdeploy.

RamblingCookieMonster avatar RamblingCookieMonster commented on July 17, 2024

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.

FooBartn avatar FooBartn commented on July 17, 2024

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.

FooBartn avatar FooBartn commented on July 17, 2024

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.

RamblingCookieMonster avatar RamblingCookieMonster commented on July 17, 2024

Makes sense, closing now : ) Thanks!

from psdeploy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.