-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix non-empty check for invalid changes
- Loading branch information
Ryan Miller
committed
Aug 30, 2019
1 parent
66dbb0c
commit 2c08dcb
Showing
1 changed file
with
14 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,5 @@ | ||
#!/bin/sh | ||
|
||
if [ "$TRAVIS_PULL_REQUEST" == false ] && [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_EVENT_TYPE" == "push" ]; then | ||
changes=`git diff master...$TRAVIS_BRANCH --name-only | grep -i "fluentd-sumologic.yaml.tmpl\|fluent-bit-overrides.yaml\|prometheus-overrides.yaml\|falco-overrides.yaml"` | ||
if [ -n "$changes" ]; then | ||
if git --no-pager show -s --format="%an" . | grep -v -q -i "travis"; then | ||
echo "Aborting due to manual changes detected in the following generated files: $changes" | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
VERSION="${TRAVIS_TAG:-0.0.0}" | ||
VERSION="${VERSION#v}" | ||
: "${DOCKER_TAG:=sumologic/kubernetes-fluentd}" | ||
|
@@ -57,8 +47,22 @@ if [ -n "$GITHUB_TOKEN" ]; then | |
git config --global user.email "[email protected]" | ||
git config --global user.name "Travis CI" | ||
git remote add origin-repo https://${GITHUB_TOKEN}@github.com/SumoLogic/sumologic-kubernetes-collection.git > /dev/null 2>&1 | ||
git fetch origin-repo | ||
git checkout $TRAVIS_BRANCH | ||
fi | ||
|
||
# Check for invalid changes to overrides yaml files | ||
if [ -n "$GITHUB_TOKEN" ] && [ "$TRAVIS_PULL_REQUEST" == false ] && [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_EVENT_TYPE" == "push" ]; then | ||
changes=`git diff origin-repo/master..$TRAVIS_BRANCH --name-only | grep -i "fluentd-sumologic.yaml.tmpl\|fluent-bit-overrides.yaml\|prometheus-overrides.yaml\|falco-overrides.yaml"` | ||
if [ -n "$changes" ]; then | ||
if git --no-pager show -s --format="%an" . | grep -v -q -i "travis"; then | ||
echo "Aborting due to manual changes detected in the following generated files: $changes" | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
# Check for changes that require re-generating overrides yaml files | ||
if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ -n "$GITHUB_TOKEN" ]; then | ||
echo "Generating yaml from helm chart..." | ||
echo "# This file is auto-generated." > deploy/kubernetes/fluentd-sumologic.yaml.tmpl | ||
|
@@ -72,8 +76,6 @@ if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ - | |
|
||
if [[ $(git diff deploy/kubernetes/fluentd-sumologic.yaml.tmpl) ]]; then | ||
echo "Detected changes in 'fluentd-sumologic.yaml.tmpl', committing the updated version to $TRAVIS_BRANCH..." | ||
git fetch origin-repo | ||
git checkout $TRAVIS_BRANCH | ||
git add deploy/kubernetes/fluentd-sumologic.yaml.tmpl | ||
git commit -m "Generate new 'fluentd-sumologic.yaml.tmpl'" | ||
git push --quiet origin-repo "$TRAVIS_BRANCH" | ||
|
@@ -120,8 +122,6 @@ if [ "$TRAVIS_BRANCH" != "master" ] && [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ - | |
|
||
if [ "$(git diff deploy/helm/fluent-bit-overrides.yaml)" ] || [ "$(git diff deploy/helm/prometheus-overrides.yaml)" ] || [ "$(git diff deploy/helm/falco-overrides.yaml)" ]; then | ||
echo "Detected changes in 'fluent-bit-overrides.yaml', 'prometheus-overrides.yaml' or 'falco-overrides.yaml', committing the updated version to $TRAVIS_BRANCH..." | ||
git fetch origin-repo | ||
git checkout $TRAVIS_BRANCH | ||
git add deploy/helm/*-overrides.yaml | ||
git commit -m "Generate new overrides yaml file(s)." | ||
git push --quiet origin-repo "$TRAVIS_BRANCH" | ||
|