update sonar insert_file
This commit is contained in:
parent
dfe2f8a7a2
commit
a384e129c6
|
@ -15,9 +15,19 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_file
|
def insert_file
|
||||||
|
checkout_url = 'https://gitlink.org.cn/KingChan/checkout@v4'
|
||||||
|
scanner_url = 'https://gitlink.org.cn/KingChan/sonarqube-scan-action@master'
|
||||||
begin
|
begin
|
||||||
config = Rails.application.config_for(:configuration)
|
config = Rails.application.config_for(:configuration)
|
||||||
sonarqube_config = config.dig('sonarqube')
|
sonarqube_config = config.dig('sonarqube')
|
||||||
|
|
||||||
|
if sonarqube_config.present? && sonarqube_config['checkout'].present?
|
||||||
|
checkout_url = sonarqube_config['checkout']
|
||||||
|
end
|
||||||
|
if sonarqube_config.present? && sonarqube_config['scanner'].present?
|
||||||
|
scanner_url = sonarqube_config['scanner']
|
||||||
|
end
|
||||||
|
|
||||||
raise 'sonar config missing' if sonarqube_config.blank?
|
raise 'sonar config missing' if sonarqube_config.blank?
|
||||||
rescue => ex
|
rescue => ex
|
||||||
raise ex if Rails.env.production?
|
raise ex if Rails.env.production?
|
||||||
|
@ -47,12 +57,12 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
|
||||||
sonarqube:
|
sonarqube:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: #{sonarqube_config['checkout']}
|
- uses: #{checkout_url}
|
||||||
with:
|
with:
|
||||||
# Disabling shallow clones is recommended for improving the relevancy of reporting
|
# Disabling shallow clones is recommended for improving the relevancy of reporting
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: SonarQube Scan
|
- name: SonarQube Scan
|
||||||
uses: #{sonarqube_config['scanner']}
|
uses: #{scanner_url}
|
||||||
env:
|
env:
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
|
Loading…
Reference in New Issue