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

[wip]feat: add config linter #512

Open
wants to merge 4 commits into
base: master
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
56 changes: 56 additions & 0 deletions config/.image/confcheck.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# go lint tool dependencies `go list` `gofmt`
FROM golang:1.23.2-alpine3.20
#FROM aslan-spock-register.qiniu.io/golang:1.23.2-alpine3.20
ENV GOPROXY=https://goproxy.cn,direct
ENV TimeZone=Asia/Shanghai
# if you want to install other tools, please add them here.
# Do not install unnecessary tools to reduce image size.
RUN set -eux \
apk update && \
apk --no-cache add ca-certificates git openssh yarn libpcap-dev curl openjdk11 bash build-base maven python3 yamllint ansible-lint actionlint npm libxml2-utils
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
ENV PATH=$PATH:$JAVA_HOME/bin

#RUN update-alternatives --list java

RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.61.0

RUN mkdir /github
RUN mkdir /github/workspace

WORKDIR /

RUN curl -LO https://github.com/stackrox/kube-linter/releases/download/v0.7.1/kube-linter-linux.tar.gz


RUN tar -zvxf kube-linter-linux.tar.gz

RUN mv kube-linter /usr/local/bin

RUN kube-linter version



RUN wget -O hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64

RUN mv hadolint /usr/local/bin
RUN chmod 777 /usr/local/bin/hadolint
RUN hadolint -v
RUN npm i -g @prantlf/jsonlint

RUN jsonlint -v



# SSH config
RUN mkdir -p /root/.ssh && chown -R root /root/.ssh/ && chgrp -R root /root/.ssh/ \
&& git config --global url."[email protected]:".insteadOf https://github.com/ \
&& git config --global url."git://".insteadOf https://
COPY deploy/config /root/.ssh/config
COPY deploy/github-known-hosts /github_known_hosts

# set go proxy and private repo
RUN go env -w GOPROXY=https://goproxy.cn,direct \
&& go env -w GOPRIVATE=github.com/qbox,qiniu.com

EXPOSE 8888
14 changes: 13 additions & 1 deletion config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,19 @@ customLinters:
- "--"
args:
- |
java -cp /source/p3c/p3c-pmd/target/p3c-pmd-2.1.1-jar-with-dependencies.jar net.sourceforge.pmd.PMD -f emacs -R rulesets/java/ali-comment.xml,rulesets/java/ali-concurrent.xml,rulesets/java/ali-constant.xml,rulesets/java/ali-exception.xml,rulesets/java/ali-flowcontrol.xml,rulesets/java/ali-naming.xml,rulesets/java/ali-oop.xml,rulesets/java/ali-orm.xml,rulesets/java/ali-other.xml,rulesets/java/ali-set.xml -d ./
docker run -v ./:/workspace/app/test harrell16805/ali-p3c-pmd:2.0.1 java -cp /opt/p3c-pmd-2.0.1.jar net.sourceforge.pmd.PMD -no-cache -R rulesets/java/ali-comment.xml,rulesets/java/ali-concurrent.xml,rulesets/java/ali-constant.xml,rulesets/java/ali-exception.xml,rulesets/java/ali-flowcontrol.xml,rulesets/java/ali-naming.xml,rulesets/java/ali-oop.xml,rulesets/java/ali-orm.xml,rulesets/java/ali-other.xml,rulesets/java/ali-set.xml -f emacs -d /workspace/app/test
kubernetesAsRunner:
namespace: "reviewbot"
image: "aslan-spock-register.qiniu.io/reviewbot/base:go1.22.3-java11-p3cpmd2.1.1"
yamllint:
languages: [ ".yaml" ]
command:
- "/bin/sh"
- "-c"
- "--"
args:
- |
docker run -v ./:/data -it pexio/yamllint:latest /data/src/testfile/actions.yaml -f parsable -d "{extends: relaxed, rules: {line-length: {max: 120}, new-line-at-end-of-file: false, new-lines: false, trailing-spaces: false}}"
kubernetesAsRunner:
namespace: "reviewbot"
image: "oolulegan/yamllinter"
Loading