mc1arke / sonarqube-community-branch-plugin

A plugin that allows branch analysis and pull request decoration in the Community version of Sonarqube
GNU Lesser General Public License v3.0
2.26k stars 526 forks source link

[1.18.0] - Sonar in 10.3 - Branches and Pull Requests are not supported in Community Edition #891

Closed lpsm-nuageit closed 8 months ago

lpsm-nuageit commented 8 months ago

Describe the bug

I'm trying to consume the integration of branches and pull-request in sonar and I'm getting errors.

I've installed my sonarqube on Kubernetes and I'm using GitHub Actions to run the analysis.

Helm Chart.yml:

---
apiVersion: v2
name: sonarqube
description: A helm chart for an app
type: application
version: 0.1.0
dependencies:
- name: sonarqube
  version: 10.3.0
  repository: https://SonarSource.github.io/helm-chart-sonarqube

Helm values:

---
sonarqube:
  fullnameOverride: "sonarqube"
  ingress:
    enabled: true
    hosts:
    - name: sonarqube.xpto.com
    annotations:
      nginx.ingress.kubernetes.io/proxy-body-size: "128m"
    ingressClassName: nginx
  livenessProbe:
    initialDelaySeconds: 180
    timeoutSeconds: 10
  initContainers:
    resources:
      limits:
        cpu: 25m
        memory: 64Mi
      requests:
        cpu: 25m
        memory: 32Mi
  initSysctl:
    enabled: true
    resources:
      limits:
        cpu: 25m
        memory: 64Mi
      requests:
        cpu: 25m
        memory: 32Mi
  initFs:
    enabled: true
  plugins:
    install:
    - https://github.com/sbaudoin/sonar-yaml/releases/download/v1.9.1/sonar-yaml-plugin-1.9.1.jar
    - https://github.com/sonargraph/sonar-sonargraph-integration/releases/download/Release-7.0.0/sonar-sonargraph-integration-7.0.0.jar
    - https://github.com/dependency-check/dependency-check-sonar-plugin/releases/download/4.0.1/sonar-dependency-check-plugin-4.0.1.jar
    - https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/1.18.0/sonarqube-community-branch-plugin-1.18.0.jar
    image: curlimages/curl:7.76.1
    resources:
      limits:
        cpu: 25m
        memory: 64Mi
      requests:
        cpu: 25m
        memory: 32Mi
  env:
  - name: SONAR_WEB_JAVAOPTS
    value: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.18.0.jar=web"
  - name: SONAR_CE_JAVAOPTS
    value: "-javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.18.0.jar=ce"
  resources:
    limits:
      cpu: 800m
      memory: 6Gi
    requests:
      cpu: 400m
      memory: 2Gi
  persistence:
    enabled: true
    storageClass: ebs-gp3
    size: 32Gi
  postgresql:
    enabled: true
    persistence:
      enabled: true
      accessMode: ReadWriteOnce
      size: 32Gi
      storageClass: gp2
  account:
    adminPasswordSecretName: "sonarqube-admin"

Github Actions:

  sonarqube:
    name: Sonarqube
    runs-on: ubuntu-20.04
    steps:
    - name: Checkout Code
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: SonarQube Scan
      uses: sonarsource/sonarqube-scan-action@master
      env:
        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
      with:
        args: >
          -Dsonar.verbose=true
          -Dsonar.sourceEncoding=UTF-8
          -Dsonar.projectKey=${{ github.event.repository.name }}
          -Dsonar.projectName=${{ github.event.repository.name }}
      continue-on-error: ${{ inputs.continue-on-error }}

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'project view'
  2. Click on 'The last analysis has failed. See details'
  3. See error

Expected behavior

I was hoping that the plugin would be able to solve this scenario and that I could integrate branch scanning and pull-requests.

Screenshots

image

Software Versions

Additional context

I understand that for integrating pull-request I might be forgetting some things, but in the case of branch I still get the same error.

lpsm-nuageit commented 8 months ago

Any updates?

propyless commented 8 months ago

I had to configure using sonarProperties to get it to work.

    plugins:
      install:
        - https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/1.18.0/sonarqube-community-branch-plugin-1.18.0.jar

    sonarProperties:
      sonar.ce.javaOpts: -javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.18.0.jar=ce
      sonar.web.javaOpts: -javaagent:/opt/sonarqube/extensions/plugins/sonarqube-community-branch-plugin-1.18.0.jar=web
lpsm-nuageit commented 8 months ago

That worked, but I find it confusing that the other way doesn't work.