cathive / concourse-sonarqube-resource

performs SonarQube analyses and checks quality gates https://concourse-ci.org/ https://sonarqube.org/
Apache License 2.0
46 stars 49 forks source link

resource fails without proper error message #15

Closed engrun closed 6 years ago

engrun commented 6 years ago

Hi

I having trouble getting this resource to work. When running, I get the following error

Preparing SonarQube scanner... ERROR in /opt/resource/out : line 136 with exit code 1

I have looked at the source code for assets/out, but cannot find any reason for this error.

My config is

.
.
resource_types:
- name: sonar-runner
  type: docker-image
  source:
    repository: cathive/concourse-sonarqube-resource
    tag: latest
.
.
resources:
- name: code-analysis
  type: sonar-runner
  source:
    host_url: ((sonarqube_host_url))
    login: ((sonarqube_token))
    scanner_type: cli    
.
.

and then the job


- name: build-analyze
  serial_groups:
  - version
  plan:    
  - get: repo
    trigger: true
  - get: tools
  - task: build
    file: tools/pipelines/jar/build.yml
    params:
      PATH_PREFIX: ((git_path_prefix))
      ARTIFACT: ((artifact_prefix))
  - put: code-analysis
    params:
      project_path: build-output

the build.yml looks like

---
platform: linux

image_resource:
  type: docker-image
  source:
    repository: openjdk
    tag: '9-jdk-slim'

params:
  ARTIFACT: 

inputs:
- name: repo
- name: tools

outputs:
- name: build-output

run:
  path: tools/pipelines/jar/build.sh
  args:
  - repo/.git/HEAD
  - repo
  - build-output

I have hijacked the container, and the build-output is present, with all sources and the Maven target folder after being built with the "build" task. All required parameters are set, and there is a sonar-project.properties located in the build-output folder.

The sonar-project.properties looks like

sonar.projectKey=<key>
sonar.projectName=<name>
sonar.links.ci=<url>
sonar.links.scm=<url>
headcr4sh commented 6 years ago

Mh. At first sight I don't see, why line 136 of the "out" script should be causing any issues. Seems as if the parsing of params.scanner_type is causing issues... strange...

engrun commented 6 years ago

I found the "bug". The config scanner_type: cli was misplaced (under resource/source config)

It should be placed under plan/put: code-analysis/params

headcr4sh commented 6 years ago

Right. Didn't see that mix-up in the first place... ... so no issue at all, I assume.

Closing...