From 78d0c48bc895a6c6d5f0be8976e848e1e0f15aff Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Sun, 21 May 2023 11:23:03 -0500 Subject: [PATCH] update --- pipelines/golang.yml | 10 +++++++--- scripts/golang-lint.sh | 4 ++++ templates/golang.tpl.yml | 7 ++++++- templates/sonarqube.tpl.yml | 2 +- templates/version.tpl.yml | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 scripts/golang-lint.sh diff --git a/pipelines/golang.yml b/pipelines/golang.yml index c2f606d..7d80c7f 100644 --- a/pipelines/golang.yml +++ b/pipelines/golang.yml @@ -16,8 +16,8 @@ include: version: extends: .version stage: .pre - only: - - main + rules: + - if: $CI_COMMIT_REF_NAME == 'main' sonarqube: extends: .sonarcloud-check @@ -25,6 +25,10 @@ sonarqube: rules: - if: $CI_COMMIT_REF_NAME == 'main' || $CI_PIPELINE_SOURCE == 'merge_request_event' +golang-lint: + extends: .golang-lint + stage: .pre + gobuild: extends: .golang-build-api stage: build @@ -49,4 +53,4 @@ helm: - job: version artifacts: true rules: - - if: $CI_COMMIT_REF_NAME == 'main' \ No newline at end of file + - if: $CI_COMMIT_REF_NAME == 'main' diff --git a/scripts/golang-lint.sh b/scripts/golang-lint.sh new file mode 100644 index 0000000..1db458d --- /dev/null +++ b/scripts/golang-lint.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +#%%MULTILINE_YAML_START +#Build golang api +golangci-lint run ./... \ No newline at end of file diff --git a/templates/golang.tpl.yml b/templates/golang.tpl.yml index 4edcb04..0db36b1 100644 --- a/templates/golang.tpl.yml +++ b/templates/golang.tpl.yml @@ -5,4 +5,9 @@ artifacts: expire_in: 1 hour paths: - - $CI_PROJECT_DIR/output \ No newline at end of file + - $CI_PROJECT_DIR/output + +.golang-lint: + image: registry.durp.info/golangci/golangci-lint:latest + script: + - ./scripts/golang-lint.sh \ No newline at end of file diff --git a/templates/sonarqube.tpl.yml b/templates/sonarqube.tpl.yml index 18fc8ea..00d755b 100644 --- a/templates/sonarqube.tpl.yml +++ b/templates/sonarqube.tpl.yml @@ -3,7 +3,7 @@ SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task image: - name: sonarsource/sonar-scanner-cli:latest + name: registry.durp.info/sonarsource/sonar-scanner-cli:latest entrypoint: [""] cache: key: "${CI_JOB_NAME}" diff --git a/templates/version.tpl.yml b/templates/version.tpl.yml index e5d8aa0..87c69d3 100644 --- a/templates/version.tpl.yml +++ b/templates/version.tpl.yml @@ -1,5 +1,5 @@ .version: - image: gittools/gitversion:5.12.0 + image: registry.durp.info/gittools/gitversion:5.12.0 variables: GIT_DEPTH: "0" script: