diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d7e759..e2603a4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ jobs: - run: shell: /bin/bash command: | - docker build -f Dockerfile-community-edition -t ictu/sonar:${CIRCLE_TAG} . + docker build -t ictu/sonar:${CIRCLE_TAG} . docker login -u $DOCKER_USER -p $DOCKER_PASS docker push ictu/sonar:${CIRCLE_TAG} build_and_push_de_tag: @@ -18,7 +18,7 @@ jobs: - run: shell: /bin/bash command: | - docker build -f Dockerfile-developer-edition -t ictu/sonar:${CIRCLE_TAG} . + docker build --build-arg="IMAGE_EDITION=developer" -t ictu/sonar:${CIRCLE_TAG} . docker login -u $DOCKER_USER -p $DOCKER_PASS docker push ictu/sonar:${CIRCLE_TAG} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..a7ce91e --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,35 @@ +name: Docker Image CI + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - env: + IMAGE_EDITION: community + - env: + IMAGE_EDITION: developer + steps: + - uses: actions/checkout@v3 + + - name: Build the Docker image + run: docker build --build-arg="IMAGE_EDITION=${{ matrix.env.IMAGE_EDITION }}" -t ci . + + - name: Run the Docker image + run: docker run -d --name ci ci + + - name: Verify the Docker image + # profile for language 'web' is the last; assume everything is working if we got this far + run: docker logs -f ci |& sed '/Current profile for language web is Sonar way/ q' + timeout-minutes: 3 + + - name: Stop the Docker image + run: docker stop ci diff --git a/Dockerfile-community-edition b/Dockerfile similarity index 82% rename from Dockerfile-community-edition rename to Dockerfile index 7385fc6..df2b8d8 100644 --- a/Dockerfile-community-edition +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM sonarqube:9.9.1-community +ARG IMAGE_NAME=sonarqube +ARG IMAGE_VERSION=10.1.0 +ARG IMAGE_EDITION=community +FROM $IMAGE_NAME:$IMAGE_VERSION-$IMAGE_EDITION USER root RUN apt-get update && apt-get install -y wget curl ca-certificates-java jq postgresql-client \ && rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile-developer-edition b/Dockerfile-developer-edition deleted file mode 100644 index ac85630..0000000 --- a/Dockerfile-developer-edition +++ /dev/null @@ -1,17 +0,0 @@ -FROM sonarqube:9.9.1-developer -USER root -RUN apt-get update && apt-get install -y wget curl ca-certificates-java jq postgresql-client \ - && rm -rf /var/lib/apt/lists/* -ADD ./plugins /tmp/plugins -RUN rm -rf ./extensions/plugins/* && \ - cat /tmp/plugins/plugin-list && \ - chmod +x /tmp/plugins/install-plugins.sh && \ - ls /tmp/plugins -l && \ - /tmp/plugins/install-plugins.sh -WORKDIR /opt/sonarqube -COPY ./start-with-profile.sh . -ADD ./rules /tmp/rules -ADD sonar.properties /opt/sonarqube/conf/sonar.properties -RUN chown -R sonarqube:sonarqube . && chmod +x start-with-profile.sh -USER sonarqube -CMD ["./start-with-profile.sh"] diff --git a/README.md b/README.md index d493f5c..665dd8e 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Example docker-compose file: version: '3.7' services: www: - image: ictu/sonar:9.9.1 + image: ictu/sonar:10.1.0 environment: - SONAR_JDBC_URL=jdbc:postgresql://db:5432/sonar - SONAR_JDBC_USERNAME=sonar diff --git a/plugins/plugin-list b/plugins/plugin-list index a4df937..557d6a6 100644 --- a/plugins/plugin-list +++ b/plugins/plugin-list @@ -1,7 +1,7 @@ -https://github.com/checkstyle/sonar-checkstyle/releases/download/10.9.3/checkstyle-sonar-plugin-10.9.3.jar -https://github.com/sbaudoin/sonar-ansible/releases/download/v2.5.1/sonar-ansible-plugin-2.5.1.jar -https://github.com/dependency-check/dependency-check-sonar-plugin/releases/download/3.1.0/sonar-dependency-check-plugin-3.1.0.jar +https://github.com/checkstyle/sonar-checkstyle/releases/download/10.12.3/checkstyle-sonar-plugin-10.12.3.jar +https://github.com/dependency-check/dependency-check-sonar-plugin/releases/download/4.0.0/sonar-dependency-check-plugin-4.0.0.jar https://github.com/jborgers/sonar-pmd/releases/download/3.4.0/sonar-pmd-plugin-3.4.0.jar https://github.com/sbaudoin/sonar-yaml/releases/download/v1.7.0/sonar-yaml-plugin-1.7.0.jar https://github.com/spotbugs/sonar-findbugs/releases/download/4.2.3/sonar-findbugs-plugin-4.2.3.jar https://github.com/vaulttec/sonar-auth-oidc/releases/download/v2.1.1/sonar-auth-oidc-plugin-2.1.1.jar +https://github.com/sbaudoin/sonar-ansible/releases/download/v2.5.1/sonar-ansible-plugin-2.5.1.jar diff --git a/start-with-profile.sh b/start-with-profile.sh index 8884e74..5376262 100644 --- a/start-with-profile.sh +++ b/start-with-profile.sh @@ -268,14 +268,14 @@ testAdminCredentials # (Re-)create the ICTU profiles RULES_VERSION=20230619 -createProfile "ictu-ansible-profile-v2.5.1-${RULES_VERSION}" "Sonar%20way" "yaml" -createProfile "ictu-cs-profile-v8.51.0-${RULES_VERSION}" "Sonar%20way" "cs" -createProfile "ictu-java-profile-v7.16.0-${RULES_VERSION}" "Sonar%20way" "java" -createProfile "ictu-js-profile-v9.13.0-${RULES_VERSION}" "Sonar%20way" "js" -createProfile "ictu-kotlin-profile-v2.12.0-${RULES_VERSION}" "Sonar%20way" "kotlin" -createProfile "ictu-py-profile-v3.24.0-${RULES_VERSION}" "Sonar%20way" "py" -createProfile "ictu-ts-profile-v9.13.0-${RULES_VERSION}" "Sonar%20way" "ts" -createProfile "ictu-vbnet-profile-v8.51.0-${RULES_VERSION}" "Sonar%20way" "vbnet" -createProfile "ictu-web-profile-v3.7.1-${RULES_VERSION}" "Sonar%20way" "web" +createProfile "ictu-ansible-profile-v2.5.1-${RULES_VERSION}" "Sonar%20way" "yaml" # custom sonar-ansible-plugin +createProfile "ictu-cs-profile-v9.3.0-${RULES_VERSION}" "Sonar%20way" "cs" # image csharp-plugin +createProfile "ictu-java-profile-v7.20.0-${RULES_VERSION}" "Sonar%20way" "java" # image java-plugin +createProfile "ictu-js-profile-v10.3.1-${RULES_VERSION}" "Sonar%20way" "js" # image javascript-plugin +createProfile "ictu-kotlin-profile-v2.15.0-${RULES_VERSION}" "Sonar%20way" "kotlin" # image kotlin-plugin +createProfile "ictu-py-profile-v4.3.0-${RULES_VERSION}" "Sonar%20way" "py" # image python-plugin +createProfile "ictu-ts-profile-v10.3.1-${RULES_VERSION}" "Sonar%20way" "ts" # image javascript-plugin +createProfile "ictu-vbnet-profile-v9.3.0-${RULES_VERSION}" "Sonar%20way" "vbnet" # image vbnet-plugin +createProfile "ictu-web-profile-v3.8.0-${RULES_VERSION}" "Sonar%20way" "web" # image html-plugin wait $PID