1.

How can you ensure a script runs every time repository gets new commits through git push?

Answer»

There are three means of setting up a script on the destination repository to get executed depending on when the script has to be triggered exactly. These means are called HOOKS and they are of three types:

  • Pre-receive hook: This hook is invoked before the references are updated when commits are being pushed. This hook is useful in ensuring the scripts related to ENFORCING development policies are run.
  • Update hook: This hook triggers the script to run before any updates are actually MADE. This hook is called once for every commit which has been pushed to the repository.
  • Post-receive hook: This hook helps trigger the script after the updates or changes have been accepted by the destination repository. This hook is ideal for configuring deployment scripts, any continuous integration-based scripts or email notifications process to the team, etc.
Conclusion

DevOps is a culture-shifting practice that has and is continuing to help lots of businesses and organizations in a tremendous manner. It helps in BRIDGING the gap between the conflict of goals and PRIORITIES of the developers (constant need for change) and the operations (constant resistance to change) team by creating a smooth path for Continuous Development and Continuous Integration. Being a DevOps engineer has huge benefits due to the ever-increasing demand for DevOps practice.

Additional Resources

  • Practice Coding
  • DevOps Tools
  • DevOps Engineer Salary


Discussion

No Comment Found