For the task (details below). I made a copy of the post-update.sample file and name as post-update.
The post-update file content (details below). I executed manually to see if it will create a tag and it did. Then checkout master branch (git checkout master) and merge the feature branch (git merge feature) at the end I push all my changes (git push --all).
I get the below error and I have no idea why.
seems like ‘post-update’ hook is not working
FAILED git_hooks.py::test_git_hooks - AssertionError: - seems like 'post-upda…
Task details
The Nautilus application development team was working on a git repository /opt/blog.git which is cloned under /usr/src/kodekloudrepos directory present on Storage server in Stratos DC. The team want to setup a hook on this repository, please find below more details:
Merge the feature branch into the master branch`, but before pushing your changes complete below point.
Create a post-update hook in this git repository so that whenever any changes are pushed to the master branch, it creates a release tag with name release-2023-06-15, where 2023-06-15 is supposed to be the current date. For example if today is 20th June, 2023 then the release tag must be release-2023-06-20. Make sure you test the hook at least once and create a release tag for today’s release.
Hi @tsanghan
Thank you for your respond. I set up my git hooks on the cloned repo /usr/src/kodekloudrepos and I should set it up in the bare repo /opt/blog.git.
I have this hook set up in remote repo location. /opt/ecommerce.git/
cat post-update
#!/bin/bash
Get the current date
DATE=$(date +“%Y-%m-%d”)
Create the release tag
exec git tag “release-$DATE”
exec git push origin “release-$DATE”
but still i dont see push triggering commit and creating tag.
I am seeing this error message.
seems like release tag was not created from the ‘master’ branch
what did you do it differently ?