# Maintainer: Noggin Infrastructure Team <infra@noggin.io>
image:
  name: 733435922165.dkr.ecr.ap-southeast-2.amazonaws.com/encloud-base/oraclelinux-build:latest
  aws:
    oidc-role: $INFRA_ENCLOUD_BASE_OIDC_ROLE_ARN

definitions:
  steps:
    - step: &SonarQubeScan
        runs-on:
          - self.hosted
          - linux
        # SonarQube scanner needs the full history to assign issues properly
        oidc: true
        clone:
            depth: full
        name: SonarQube Scan
        image: sonarsource/sonar-scanner-cli:latest
        script:
            - sonar-scanner


pipelines:
  custom:
    sonarqube-scan:
      # We only support scanning the master branch
      - step:
          runs-on:
            - self.hosted
            - linux
          name: "Check branch"
          image: fedora:latest
          script:
            - EXPECTED_BRANCH=master eval ${INFRA_ASSERT_BRANCH}
      - step:
          <<: *SonarQubeScan
