Skip to content

Commit

Permalink
Run lint for PRs and on commit
Browse files Browse the repository at this point in the history
  • Loading branch information
maxzheng committed Jan 4, 2019
1 parent 368bee5 commit 0a71f37
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
11 changes: 11 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def config = jobConfig {
slackChannel = 'tools-eng' // TODO: Change this when Viktor provides one
}

def job = {
stage('Lint') {
sh 'scripts/lint.sh'
}
}

runJob config, job
11 changes: 11 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if [ -t 1 ] ; then
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RS='\033[0m' # reset to no color
else
RED=''
GREEN=''
BLUE=''
RS=''
fi
8 changes: 2 additions & 6 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash
error=0
RED='\033[0;31m'
RS='\033[0m' # No Color
GREEN='\033[0;32m'

. scripts/common.sh

echo -e "==> ${GREEN}Linting cp-helm-charts..${RS}."

Expand All @@ -18,5 +16,3 @@ for chart in `ls -1 charts`; do
echo -e "$output" | grep "\\["
done
echo -e "==> ${GREEN} No linting errors${RS}"

exit $error
8 changes: 3 additions & 5 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RS='\033[0m' # reset

. scripts/common.sh

echo -e "${RS}${BLUE} Cleaning and preparing..."
find . -iname "*.tgz" -type f | grep -v 'docs/' | xargs rm
Expand All @@ -27,4 +25,4 @@ if [[ "${RET}" == 0 ]]; then
echo -e "${BLUE} Now commit and push charts and docs! ${RS}"
else
echo -e "${RED}Tests failed, charts not packaged! ${RS}"
fi
fi

0 comments on commit 0a71f37

Please sign in to comment.