Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbucket Pipeline fails saying that step is empty, null or missing

I'm trying to configure a Bitbucket pipeline to execute the SonarQube pipe, but Bitbucket complains that the pipeline step is empty, null or missing.

I've got SONAR_TOKEN defined as a project variable with the correct token.

Here's my current bitbucket-pipeline.yml file:

image: atlassian/default-image:2

clone:
  depth: full

definitions:
  caches:
    sonar: ~/.sonar/cache
  steps:
    - step: &sonarcloud
      name: Analyze on SonarCloud
      caches:
        - sonar
      script:
        - pipe: sonarsource/sonarcloud-scan:0.1.5
          variables:
            SONAR_TOKEN: ${SONAR_TOKEN}

pipelines:
  branches:
    '*':
      - step: *sonarcloud

Any ideas?

like image 711
Juan Pablo Avatar asked Apr 13 '19 21:04

Juan Pablo


1 Answers

Found the issue.

The problem is that the step details in the definition area is incorrectly indented and is missing one extra indentation level.

Instead of:

...
- steps: &sonarcloud
  name: ...
  ...

It's

...
- steps: &sonarcloud
    name: ... // Notice the extra level of indentation
    ...

The correct YAML is:

image: atlassian/default-image:2

clone:
  depth: full

definitions:
  caches:
    sonar: ~/.sonar/cache
  steps:
    - step: &sonarcloud
        name: Analyze on SonarCloud
        caches:
          - sonar
        script:
          - pipe: sonarsource/sonarcloud-scan:0.1.5
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}

pipelines:
  branches:
    '*':
      - step: *sonarcloud
like image 195
Juan Pablo Avatar answered Oct 12 '22 13:10

Juan Pablo