Skip to content

Commit

Permalink
build: add lint-commits command to dev wrapper
Browse files Browse the repository at this point in the history
Also add node 21 to Docker image
  • Loading branch information
turboBasic committed Apr 18, 2024
1 parent 57519a4 commit 6fdd46c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# syntax=docker/dockerfile:1

# hadolint global ignore=DL3006
ARG BASE_IMAGE=python:3.12.1-alpine3.19
ARG ALPINE_VERSION=3.19
ARG NODE_VERSION=21
ARG PYTHON_VERSION=3.12.1
ARG BASE_IMAGE=python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}

FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} as node
FROM ${BASE_IMAGE}

COPY --from=node /usr/lib /usr/lib
COPY --from=node /usr/local/lib /usr/local/lib
COPY --from=node /usr/local/include /usr/local/include
COPY --from=node /usr/local/bin /usr/local/bin

ARG GRADLE_VERSION=8.5
RUN apk add --no-cache \
git \
gradle=~$GRADLE_VERSION \
openjdk11-jdk \
shadow
Expand All @@ -19,6 +30,7 @@ RUN groupadd --non-unique --gid $GID $USER_NAME && \

USER $USER_NAME
WORKDIR /app
RUN git config --global --add safe.directory /app
ENV GRADLE_USER_HOME=/app/.gradle

CMD ["./gradlew", "--info", "--no-daemon", "clean", "test"]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ framework which allows to use more precise and self-explanatory syntax of descri
- `./dev docker [--push]`: only build Docker image. If `--push` switch is provided, Docker image is pushed to Docker Hub
- `./dev help`: display this help about commands
- `./dev lint`: lint project with MegaLinter
- `./dev lint-commits`: lint feature branch commits using [Conventional commit linter](https://commitlint.js.org/#/)
- `./dev sh`: create development environment and enter shell session inside it. Inside development environment you can
use Gradle to execute any advanced commands

Expand Down
13 changes: 13 additions & 0 deletions dev
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ main() {
shift
lint "$@"
;;
lint-commits)
shift
buildDocker
DOCKER_COMMAND="sh -c"
if [ -n "$1" ]; then
START_COMMIT=$1
shift
else
START_COMMIT="$(git merge-base main "$(git branch --show-current)")"
fi
warnIfIgnoredArguments "$@"
runDocker "npm ci && npx commitlint --from $START_COMMIT --to HEAD --verbose"
;;
sh)
shift
runShell "$@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Jenkinsfile.parallel({failFast=false, lint=groovy.lang.Closure, unitTest=groovy.lang.Closure})
Jenkinsfile.stage(lint, groovy.lang.Closure)
Jenkinsfile.sh(./dev lint)
Jenkinsfile.sh(./dev lint-commits)
Jenkinsfile.sh(sudo find -mindepth 1 -maxdepth 1 -exec chown --preserve-root --recursive jenkins: {} + || true)
Jenkinsfile.sh(sudo find -mindepth 1 -maxdepth 1 -exec chmod --preserve-root --recursive u+rw {} + || true)
Jenkinsfile.archiveArtifacts({artifacts=megalinter-reports/megalinter.log, linters_logs/ERROR-*, allowEmptyArchive=true})
Expand Down

0 comments on commit 6fdd46c

Please sign in to comment.