Created
May 7, 2019 15:12
-
-
Save maurobaraldi/cc1e68b8d1db4796ee6fb78e7ce03732 to your computer and use it in GitHub Desktop.
pre-commit git hook to check if chart version is updated.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ORIGIN=$(git log -n 1 --oneline --format=format:%H origin/master helm/pfapi/Chart.yaml) | |
LOCAL=$(git log -n 1 --oneline --format=format:%H HEAD helm/pfapi/Chart.yaml) | |
CHART=$(git status --porcelain | grep Chart.yaml) | |
if [ "$ORIGIN" = "$LOCAL" ]; then | |
if [[ -z "$CHART" ]]; then | |
echo -e "#######################################\n# Don't forget to update Charts.yaml. #\n#######################################" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The hook compare the
Chart.yaml
file from current branch to themaster
(in my case) and if the commits hash are equal, and theChart.yaml
isn't in changed files, alerts about change chart version.Install
<project_pat>/.git/hooks/pre-commit
and paste this content in.Chart.yaml
file to the file of your project.chmod +x <project_pat>/.git/hooks/pre-commit