Skip to content

Commit

Permalink
Merge pull request #31 from linuxbandit/feature/hadolint-reviewdog
Browse files Browse the repository at this point in the history
Feature/hadolint reviewdog
  • Loading branch information
gadiener authored Apr 30, 2020
2 parents c3491c6 + 7e42a33 commit f27e508
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 33 deletions.
2 changes: 1 addition & 1 deletion bucket-production.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/bucket-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/bucket-quality.yml'

deploy:production:
extends: .deploy
Expand Down
2 changes: 1 addition & 1 deletion bucket-quality.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/bucket.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/bucket.yml'

deploy:quality:
extends: .deploy
Expand Down
2 changes: 1 addition & 1 deletion cloudrun-production.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/cloudrun-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/cloudrun-quality.yml'

deploy:production:
extends: deploy:quality
Expand Down
4 changes: 2 additions & 2 deletions cloudrun-quality.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/cloudrun.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/cloudrun.yml'

deploy:quality:
extends: .cloudrun:deploy
Expand Down
2 changes: 1 addition & 1 deletion docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/docker.yml'

build:
stage: build
Expand Down
2 changes: 1 addition & 1 deletion helm-multiregion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/helm-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/helm-quality.yml'

# EUROPE
deploy:production:europe:helm:
Expand Down
4 changes: 2 additions & 2 deletions helm-quality.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/helm.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/helm.yml'

deploy:quality:helm:
variables:
Expand Down
2 changes: 1 addition & 1 deletion helm-regional.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/helm-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/helm-quality.yml'

deploy:production:helm:
extends: .deploy:production:helm
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-multiregion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/kubernetes-quality.yml'

# EUROPE
deploy:production:europe:image:
Expand Down
4 changes: 2 additions & 2 deletions kubernetes-quality.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/kubernetes.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/kubernetes.yml'

deploy:quality:image:
variables:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-regional.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/kubernetes-quality.yml'

deploy:production:image:
extends: .deploy:production:image
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-task-production.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/kubernetes-task-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/kubernetes-task-quality.yml'

task:production:
extends: .task
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-task-quality.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/kubernetes-task.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/kubernetes-task.yml'

task:quality:
extends: .task
Expand Down
43 changes: 32 additions & 11 deletions lint-docker.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
lint:docker:
stage: lint
image: hadolint/hadolint:v1.17.5-debian
image: linuxbandit/hadolint-reviewdog:v1.0.0
script:
- |
COMMAND_TO_RUN="hadolint"
COMMAND_TO_RUN+=( --trusted-registry registry.my-company.io )
COMMAND_TO_RUN+=( --trusted-registry "docker.io" --trusted-registry "${CI_REGISTRY}" )
if [[ -n "${IGNORE_DOCKER_LINT}" ]]; then
IGNORE_DOCKER_LINT=( DL3012 )
Expand All @@ -14,26 +14,47 @@ lint:docker:
COMMAND_TO_RUN+=( --ignore "${ign}" )
done
FINAL_COMMAND=${COMMAND_TO_RUN}
# Find docker files in a way similar to docker.yml
if [[ -f "Dockerfile" ]]; then
FINAL_COMMAND+=( ./Dockerfile )
if [ -z "${IMAGES}" ]; then
COMMAND_TO_RUN+=( ./Dockerfile )
else
FINAL_COMMAND+=( ./docker/app/Dockerfile )
EXTRA_COMMAND+=( ${COMMAND_TO_RUN} ./docker/nginx/Dockerfile )
if [ -z "${DOCKERFILES_DIR}" ]; then
DOCKERFILES_DIR=docker
fi
for image in ${IMAGES[@]}; do
COMMAND_TO_RUN+=( ./"${DOCKERFILES_DIR}/${image}"/Dockerfile )
done
fi
echo
echo "-> Linting Dockerfile:"
echo
"${FINAL_COMMAND[@]}"
if [[ ! -z "${EXTRA_COMMAND}" ]]; then
if [ "${ENABLE_REVIEWDOG}" = "1" ]; then
echo
echo "-> Linting support Dockerfile:"
echo "-> Enabled Review Dog!"
echo
"${EXTRA_COMMAND[@]}"
if [ -z "${REVIEWDOG_GITLAB_API_TOKEN}" ]; then
echo
echo "-> [WARNING] Missing 'REVIEWDOG_GITLAB_API_TOKEN' variable!"
echo
exit 1
fi
if [ -z "${REVIEWDOG_LEVEL}" ]; then
REVIEWDOG_LEVEL="warning"
fi
"${COMMAND_TO_RUN[@]}" | reviewdog -name="Hadolint linter" \
-efm="%f:%l: %m" -diff="git diff master" -reporter=gitlab-mr-discussion -level="${INPUT_LEVEL}"
else
"${COMMAND_TO_RUN[@]}"
fi
echo
echo "-> Dockerfile(s) checked!"
Expand Down
2 changes: 1 addition & 1 deletion serverless-multiregion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/serverless.yml'

# EUROPE
deploy:production:europe:
Expand Down
2 changes: 1 addition & 1 deletion serverless-quality.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/serverless.yml'

deploy:quality:
extends: .serverless:deploy
Expand Down
2 changes: 1 addition & 1 deletion serverless-regional.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/serverless.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/serverless.yml'

deploy:production:
extends: .serverless:deploy
Expand Down
2 changes: 1 addition & 1 deletion ssh-production.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/ssh-quality.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/ssh-quality.yml'

ssh:production:
extends: .ssh:exec
Expand Down
2 changes: 1 addition & 1 deletion ssh-quality.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/ssh.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/ssh.yml'

ssh:quality:
extends: .ssh:exec
Expand Down
2 changes: 1 addition & 1 deletion test-unit.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include:
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.11.0/templates/docker.yml'
- remote: 'https://raw.githubusercontent.com/jobtome-labs/ci-templates/v2.12.0/templates/docker.yml'

test:unit:
extends: .docker
Expand Down

0 comments on commit f27e508

Please sign in to comment.