Git Product home page Git Product logo

Comments (2)

abMatGit avatar abMatGit commented on May 29, 2024

It seems like the goto solution has been to append || true to commands so that it always returns an exit code of 0.
#36

Personally I agree though -- this solution isn't good enough if you need to fork your runbook behaviour depending on certain steps.

Check if file is present -->
exit 1 --> create the file
exit 0 --> use said file

This is the code I use for that:

capture "file detect #{filename} && echo 'SUCCESS' || echo 'FAILURE'", into: :existing_file
      ruby_command do
        next if @existing_file == 'SUCCESS'

        command 'create file'
      end

I don't think we can do better than a true or false. If you want to get fancier you might need to do more bash which undermines the point of having a ruby runbook handler.

from runbook.

endorama avatar endorama commented on May 29, 2024

Thanks for the suggestion. I'll leave this open to see if there is other feedback but the workaround makes sense.

from runbook.

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.