Automic Continuous Delivery Automation

 View Only
  • 1.  Trigger workflow with Git push

    Posted May 08, 2018 03:43 AM

    Is there anyway, wherein we can trigger an Automic workflow with a git push/commit?



  • 2.  Re: Trigger workflow with Git push
    Best Answer

    Posted May 09, 2018 03:25 PM

    Hi,

     

    yes, it is easily possible. The solution depends on what repository manager you use (if any), but the magic word is "post-receive hook" in your central/remote repository.

    Using only standard git, have a look at 

    https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks 

    Git post-receive hook example. Blog post: http://www.miguelmota.com/blog/deployment-with-git/ · GitHub 

     

    In GitLab, you can use standard git-hooks, but you'd have to enable them first:

    Custom Git Hooks | GitLab 

     

    After that, inside the hook, it is just a matter of calling ARA's REST API (see the corresponding documentation), but a basic curl-call would be to call a general WF:

    curl -D- -u 100/USER/DEPARTMENT:pAsSwrD -X POST -H "Content-Type: application/json" http://araserver/ara/api/data/v1/executions -d '{"workflow": "generalWF"}'

     

    To call an Application WF:

    curl -k -D- -u 100/USER/DEPARTMENT:pAsSwrD -X POST -H "Content-Type: application/json" http://araserver/api/data/v1/executions -d "{\"application\": \"MyAPp\", \"workflow\": \"deploy\", \"package\": \"1.0.1\", \"deployment_profile\": \"TestEnv\" }"

     

    If you require further assistence or consultancy regarding this, feel free to ask here or reach out to CA Automic's Professional Services.

     

    Regards,

    Martin