diff --git a/pipelines/compliance.yml b/pipelines/compliance.yml index 98edad1..a648db7 100644 --- a/pipelines/compliance.yml +++ b/pipelines/compliance.yml @@ -14,7 +14,7 @@ version: extends: .version stage: .pre rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' + - !reference [.default_rules, rules] secret_detection: stage: validate @@ -27,6 +27,4 @@ sonarqube: stage: validate allow_failure: true rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' || $CI_MERGE_REQUEST_IID - exists: - - "sonar-project.properties" + - !reference [.sonarqube_rules, rules] diff --git a/pipelines/docker-build.yml b/pipelines/docker-build.yml index 58fe7f6..883324f 100644 --- a/pipelines/docker-build.yml +++ b/pipelines/docker-build.yml @@ -31,6 +31,6 @@ docker-push: - job: version artifacts: true rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' + - if: $CI_PIPELINE_SOURCE == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' exists: - "Dockerfile" diff --git a/pipelines/security.yml b/pipelines/security.yml index 1ef2e06..8b7983a 100644 --- a/pipelines/security.yml +++ b/pipelines/security.yml @@ -15,7 +15,7 @@ generate_sbom: optional: true artifacts: true rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' || $CI_MERGE_REQUEST_IID + - !reference [.default_rules, mr-rules] generate_cve: extends: .generate_cve @@ -24,4 +24,4 @@ generate_cve: - job: generate_sbom artifacts: true rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' || $CI_MERGE_REQUEST_IID + - !reference [.default_rules, mr-rules] diff --git a/rules/mr-rules.yml b/rules/mr-rules.yml new file mode 100644 index 0000000..e888118 --- /dev/null +++ b/rules/mr-rules.yml @@ -0,0 +1,3 @@ +.default_rules: + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' || $CI_MERGE_REQUEST_IID diff --git a/rules/rules.yml b/rules/rules.yml new file mode 100644 index 0000000..73c7fde --- /dev/null +++ b/rules/rules.yml @@ -0,0 +1,9 @@ +.default_rules: + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' + +.sonarqube_rules: + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/' + exists: + - "sonar-project.properties"