Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shellcheck to pre-commit config #132

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ default_language_version:

ci:
autoupdate_schedule: monthly
autofix_prs: false

repos:
- repo: https://github.com/asottile/reorder-python-imports
Expand All @@ -25,10 +26,19 @@ repos:
require_serial: true

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- id: check-yaml

- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disable=SC1090 # https://www.shellcheck.net/wiki/SC1090
disable=SC1091 # https://www.shellcheck.net/wiki/SC1091
5 changes: 3 additions & 2 deletions build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then
fi

# Create tmp dir to store data in during job run (do NOT store in $WORKSPACE)
export TMP_JOB_DIR=$(mktemp -d -p "$HOME" -t "jenkins-${JOB_NAME}-${BUILD_NUMBER}-XXXXXX")
TMP_JOB_DIR=$(mktemp -d -p "$HOME" -t "jenkins-${JOB_NAME}-${BUILD_NUMBER}-XXXXXX")
export TMP_JOB_DIR
echo "job tmp dir location: $TMP_JOB_DIR"

function job_cleanup() {
echo "cleaning up job tmp dir: $TMP_JOB_DIR"
rm -fr $TMP_JOB_DIR
rm -fr "$TMP_JOB_DIR"
}

trap job_cleanup EXIT ERR SIGINT SIGTERM
Expand Down
18 changes: 11 additions & 7 deletions pr_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ export PATH=$PATH:$PWD
# --------------------------------------------
# Options that must be configured by app owner
# --------------------------------------------
# shellcheck disable=SC2034
APP_NAME="hccm" # name of app-sre "application" folder this component lives in
# shellcheck disable=SC2034
COMPONENT_NAME="nise-populator" # name of app-sre "resourceTemplate" in deploy.yaml for this component
# shellcheck disable=SC2034
IMAGE="quay.io/cloudservices/nise-populator"

echo "LABEL quay.expires-after=3d" >> ./Dockerfile # tag expire in 3 days

# Install bonfire repo/initialize
CICD_URL=https://raw.githubusercontent.com/RedHatInsights/bonfire/master/cicd
curl -s $CICD_URL/bootstrap.sh > .cicd_bootstrap.sh && source .cicd_bootstrap.sh
curl -s "$CICD_URL"/bootstrap.sh > .cicd_bootstrap.sh && source .cicd_bootstrap.sh

source $CICD_ROOT/build.sh
source "$CICD_ROOT"/build.sh

source $CICD_ROOT/_common_deploy_logic.sh
export NAMESPACE=$(bonfire namespace reserve)
oc process --local -f deploy/clowdapp.yaml -p IMAGE_TAG=${IMAGE_TAG} | oc apply -f - -n $NAMESPACE
source "$CICD_ROOT"/_common_deploy_logic.sh
NAMESPACE=$(bonfire namespace reserve)
export NAMESPACE
oc process --local -f deploy/clowdapp.yaml -p IMAGE_TAG="${IMAGE_TAG}" | oc apply -f - -n "$NAMESPACE"

mkdir -p $WORKSPACE/artifacts
cat << EOF > ${WORKSPACE}/artifacts/junit-dummy.xml
mkdir -p "$WORKSPACE"/artifacts
cat << EOF > "${WORKSPACE}"/artifacts/junit-dummy.xml
<testsuite tests="1">
<testcase classname="dummy" name="dummytest"/>
</testsuite>
Expand Down