forked from jugatsu/onec-docker
-
Notifications
You must be signed in to change notification settings - Fork 89
Add sonar-scanner image layered on client + jdk #102
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
Merged
nixel2007
merged 14 commits into
feature/first-bit
from
claude/sonar-scanner-client-layer-FbFgl
May 29, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f101eb8
Add sonar-scanner image layered on top of client (without vnc)
claude ed7c95f
Build sonar-scanner on client+jdk and add build scripts + CI
claude 1e46cfd
Disable SonarScanner JRE auto-provisioning
claude 0aa1778
Bump SonarScanner CLI to latest 8.1.0.6389 and build jdk layer with J…
claude 344cd18
Build sonar-scanner jdk layer with JDK 25
claude 923501c
Update sonar-scanner maintainer label
claude 80c0ca4
Remove bogus sonar-scanner Makefile target referencing non-existent base
claude 46a4c82
Drop FirstBit from sonar-scanner maintainer label
claude 7a7fbda
Fix client->jdk layering and quote batch conditionals
claude 68a401b
Fix Mono APT key import in oscript image
claude f1c2eae
Force CRLF line endings for .bat files
claude 2359ba8
Use Mono Ubuntu stable-focal repo for oscript image
claude 738111f
Address review: multi-stage scanner image, distro-aware Mono repo, en…
claude 1b628c4
Pin oscript-agent base to eclipse-temurin:17-jdk-focal
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| *.sh eol=lf | ||
| *.bat eol=crlf | ||
| client/configs/** eol=lf | ||
| client-vnc/configs/** eol=lf | ||
| swarm-jenkins-agent/configs/** eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| @echo off | ||
|
|
||
| docker login -u %DOCKER_LOGIN% -p %DOCKER_PASSWORD% %DOCKER_REGISTRY_URL% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| if "%DOCKER_SYSTEM_PRUNE%"=="true" docker system prune -af | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| if "%NO_CACHE%"=="true" (SET last_arg="--no-cache .") else (SET last_arg=".") | ||
|
|
||
| rem SonarScanner CLI 8.x требует Java 21+, поэтому слой jdk собираем с JDK 25 | ||
| if "%SONAR_JDK_VERSION%"=="" set SONAR_JDK_VERSION=25 | ||
|
|
||
| docker build ^ | ||
| --pull ^ | ||
| --build-arg DOCKER_REGISTRY_URL=library ^ | ||
| --build-arg BASE_IMAGE=ubuntu ^ | ||
| --build-arg BASE_TAG=20.04 ^ | ||
| --build-arg ONESCRIPT_PACKAGES="yard" ^ | ||
| -t %DOCKER_REGISTRY_URL%/oscript-downloader:latest ^ | ||
| -f oscript/Dockerfile ^ | ||
| %last_arg% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| docker build ^ | ||
| --build-arg ONEC_USERNAME=%ONEC_USERNAME% ^ | ||
| --build-arg ONEC_PASSWORD=%ONEC_PASSWORD% ^ | ||
| --build-arg ONEC_VERSION=%ONEC_VERSION% ^ | ||
| --build-arg DOCKER_REGISTRY_URL=%DOCKER_REGISTRY_URL% ^ | ||
| --build-arg BASE_IMAGE=oscript-downloader ^ | ||
| --build-arg BASE_TAG=latest ^ | ||
| -t %DOCKER_REGISTRY_URL%/onec-client:%ONEC_VERSION% ^ | ||
| -f client/Dockerfile ^ | ||
| %last_arg% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| docker push %DOCKER_REGISTRY_URL%/onec-client:%ONEC_VERSION% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| docker build ^ | ||
| --build-arg DOCKER_REGISTRY_URL=%DOCKER_REGISTRY_URL% ^ | ||
| --build-arg BASE_IMAGE=onec-client ^ | ||
| --build-arg BASE_TAG=%ONEC_VERSION% ^ | ||
| --build-arg OPENJDK_VERSION=%SONAR_JDK_VERSION% ^ | ||
| -t %DOCKER_REGISTRY_URL%/onec-client-jdk:%ONEC_VERSION% ^ | ||
| -f jdk/Dockerfile ^ | ||
| %last_arg% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| docker push %DOCKER_REGISTRY_URL%/onec-client-jdk:%ONEC_VERSION% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| docker build ^ | ||
| --build-arg DOCKER_REGISTRY_URL=%DOCKER_REGISTRY_URL% ^ | ||
| --build-arg BASE_IMAGE=onec-client-jdk ^ | ||
| --build-arg BASE_TAG=%ONEC_VERSION% ^ | ||
| -t %DOCKER_REGISTRY_URL%/onec-sonar-scanner:%ONEC_VERSION% ^ | ||
| -f sonar-scanner/Dockerfile ^ | ||
| %last_arg% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| docker push %DOCKER_REGISTRY_URL%/onec-sonar-scanner:%ONEC_VERSION% | ||
|
|
||
| if %ERRORLEVEL% neq 0 goto end | ||
|
|
||
| :end | ||
| echo End of program. | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail | ||
|
|
||
| if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then | ||
| if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then | ||
| echo "Docker login failed" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Skipping Docker login due to missing credentials" | ||
| fi | ||
|
|
||
| if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then | ||
| docker system prune -af | ||
| fi | ||
|
|
||
| last_arg='.' | ||
| if [ "${NO_CACHE}" = 'true' ] ; then | ||
| last_arg='--no-cache .' | ||
| fi | ||
|
|
||
| for var in ONEC_USERNAME ONEC_PASSWORD ONEC_VERSION; do | ||
| if [ -z "${!var}" ]; then | ||
| echo "Required environment variable $var is not set" >&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| # SonarScanner CLI 8.x требует Java 21+, поэтому слой jdk собираем с JDK 25 | ||
| SONAR_JDK_VERSION="${SONAR_JDK_VERSION:-25}" | ||
|
|
||
| docker build \ | ||
| --pull \ | ||
| --build-arg DOCKER_REGISTRY_URL=library \ | ||
| --build-arg BASE_IMAGE=ubuntu \ | ||
| --build-arg BASE_TAG=20.04 \ | ||
| --build-arg ONESCRIPT_PACKAGES="yard" \ | ||
| -t ${DOCKER_REGISTRY_URL:+"$DOCKER_REGISTRY_URL/"}oscript-downloader:latest \ | ||
| -f oscript/Dockerfile \ | ||
| $last_arg | ||
|
|
||
| docker build \ | ||
| --build-arg ONEC_USERNAME=$ONEC_USERNAME \ | ||
| --build-arg ONEC_PASSWORD=$ONEC_PASSWORD \ | ||
| --build-arg ONEC_VERSION=$ONEC_VERSION \ | ||
| --build-arg DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL \ | ||
| --build-arg BASE_IMAGE=oscript-downloader \ | ||
| --build-arg BASE_TAG=latest \ | ||
| -t ${DOCKER_REGISTRY_URL:+"$DOCKER_REGISTRY_URL/"}onec-client:$ONEC_VERSION \ | ||
| -f client/Dockerfile \ | ||
| $last_arg | ||
|
|
||
| if [[ -n "$DOCKER_REGISTRY_URL" ]]; then | ||
| docker push $DOCKER_REGISTRY_URL/onec-client:$ONEC_VERSION | ||
| else | ||
| echo "DOCKER_REGISTRY_URL not set, skipping docker push." | ||
| fi | ||
|
|
||
|
nixel2007 marked this conversation as resolved.
|
||
| docker build \ | ||
| --build-arg DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL \ | ||
| --build-arg BASE_IMAGE=onec-client \ | ||
| --build-arg BASE_TAG=$ONEC_VERSION \ | ||
| --build-arg OPENJDK_VERSION=$SONAR_JDK_VERSION \ | ||
| -t ${DOCKER_REGISTRY_URL:+"$DOCKER_REGISTRY_URL/"}onec-client-jdk:$ONEC_VERSION \ | ||
| -f jdk/Dockerfile \ | ||
| $last_arg | ||
|
|
||
| if [[ -n "$DOCKER_REGISTRY_URL" ]]; then | ||
| docker push $DOCKER_REGISTRY_URL/onec-client-jdk:$ONEC_VERSION | ||
| else | ||
| echo "DOCKER_REGISTRY_URL not set, skipping docker push." | ||
| fi | ||
|
|
||
| docker build \ | ||
| --build-arg DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL \ | ||
| --build-arg BASE_IMAGE=onec-client-jdk \ | ||
| --build-arg BASE_TAG=$ONEC_VERSION \ | ||
| -t ${DOCKER_REGISTRY_URL:+"$DOCKER_REGISTRY_URL/"}onec-sonar-scanner:$ONEC_VERSION \ | ||
| -f sonar-scanner/Dockerfile \ | ||
| $last_arg | ||
|
|
||
| if [[ -n "$DOCKER_REGISTRY_URL" ]]; then | ||
| docker push $DOCKER_REGISTRY_URL/onec-sonar-scanner:$ONEC_VERSION | ||
| else | ||
| echo "DOCKER_REGISTRY_URL not set, skipping docker push." | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ARG DOCKER_REGISTRY_URL | ||
| ARG BASE_IMAGE | ||
| ARG BASE_TAG | ||
|
|
||
| # Версия SonarScanner CLI. Java предоставляется слоем jdk. | ||
| # SonarScanner CLI 8.x требует Java 21+, слой jdk собирается с JDK 25 (см. build-sonar-scanner.sh). | ||
| ARG SONAR_SCANNER_VERSION=8.1.0.6389 | ||
|
|
||
| # Стадия загрузки: скачиваем и распаковываем SonarScanner CLI | ||
| FROM ${DOCKER_REGISTRY_URL:+"$DOCKER_REGISTRY_URL/"}${BASE_IMAGE}:${BASE_TAG} AS downloader | ||
|
|
||
| ARG SONAR_SCANNER_VERSION | ||
| USER root | ||
|
|
||
| RUN apt-get update \ | ||
| && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
| unzip \ | ||
| && wget -q -O /tmp/sonar-scanner.zip \ | ||
| "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip" \ | ||
| && unzip -q /tmp/sonar-scanner.zip -d /opt \ | ||
| && mv "/opt/sonar-scanner-${SONAR_SCANNER_VERSION}" /opt/sonar-scanner | ||
|
|
||
| # Финальный образ: SonarScanner CLI поверх слоя client + jdk (Java из слоя jdk) | ||
| FROM ${DOCKER_REGISTRY_URL:+"$DOCKER_REGISTRY_URL/"}${BASE_IMAGE}:${BASE_TAG} | ||
|
|
||
| LABEL maintainer="Nikita Fedkin <nixel2007@gmail.com>" | ||
|
|
||
| ENV SONAR_SCANNER_HOME=/opt/sonar-scanner | ||
|
|
||
| COPY --from=downloader /opt/sonar-scanner ${SONAR_SCANNER_HOME} | ||
|
|
||
| ENV PATH="${SONAR_SCANNER_HOME}/bin:${PATH}" | ||
|
|
||
| # Java берётся из слоя jdk, поэтому отключаем автоскачивание JRE с сервера | ||
| ENV SONAR_SCANNER_SKIP_JRE_PROVISIONING=true | ||
|
|
||
| USER usr1cv8 | ||
|
|
||
| WORKDIR /usr/src | ||
|
|
||
| CMD ["sonar-scanner"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.