1
0
mirror of https://github.com/hegerdes/gitlab-actions.git synced 2025-10-06 05:36:52 +02:00

feat: less duplicate pipelines

Signed-off-by: Henrik Gerdes <hegerdes@outlook.de>
This commit is contained in:
Henrik Gerdes
2024-08-16 10:04:03 +02:00
parent 2617b5f910
commit 61c85e9882
4 changed files with 9 additions and 7 deletions

View File

@@ -57,8 +57,9 @@ spec:
# Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
- if: $CI_OPEN_MERGE_REQUESTS
when: never
# Add the job to branch pipelines.
- if: $CI_COMMIT_BRANCH
# Add the job to main branch pipelines.
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
---
$[[ inputs.as_job ]]:
stage: $[[ inputs.stage ]]

View File

@@ -26,12 +26,11 @@ spec:
default:
# Add the job to merge request pipelines if there's an open merge request.
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
# Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
- if: $CI_OPEN_MERGE_REQUESTS
when: never
# Add the job to main branch pipelines.
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
---
include:
- local: .gitlab/ci/snippets.yml

View File

@@ -49,6 +49,7 @@ spec:
when: never
# Add the job to main branch pipelines.
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# Add the job to tag pipelines.
- if: $CI_COMMIT_TAG
variables:
HELM_CHART_VERSION: $CI_COMMIT_TAG
@@ -82,7 +83,7 @@ $[[ inputs.job_name_prefix ]]:package:
echo "Running helm lint..."
helm lint $HELM_CHART_PATH
if command -v kubeconform > /dev/null; then
echo "Running kubeconform with args \$[[ inputs.kubeconform_args ]]\"..."
echo "Running kubeconform with args: \"$[[ inputs.kubeconform_args ]]\"..."
helm template demo $HELM_CHART_PATH | kubeconform $[[ inputs.kubeconform_args ]]
fi
fi

View File

@@ -57,8 +57,9 @@ spec:
# Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
- if: $CI_OPEN_MERGE_REQUESTS
when: never
# Add the job to branch pipelines.
- if: $CI_COMMIT_BRANCH
# Add the job to main branch pipelines.
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
---
$[[ inputs.as_job ]]:
stage: $[[ inputs.stage ]]