feat(yaml_anchors): initial conditional checks

currently this wont be implemented due to issues with gitlab
ci not importing the anchor file

!41 #32
This commit is contained in:
2023-06-02 10:29:15 +09:30
parent 6a2266177b
commit 862176f9dc

70
anchors/conditions.yaml Normal file
View File

@ -0,0 +1,70 @@
---
.condition_dev_branch_push: &condition_dev_branch_push # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
.condition_master_branch_push: &condition_master_branch_push # condition_master_branch_push
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
.condition_not_master_or_dev_push: &condition_not_master_and_dev_push # condition_not_master_or_dev_push
$CI_COMMIT_BRANCH != "master" &&
$CI_COMMIT_BRANCH != "development" &&
$CI_PIPELINE_SOURCE == "push"
.condition_master_or_dev_push: &condition_master_or_dev_push # condition_master_or_dev_push
(
$CI_COMMIT_BRANCH == "master" ||
$CI_COMMIT_BRANCH == "development"
)&&
$CI_PIPELINE_SOURCE == "push"
.condition_git_tag: &condition_git_tag # condition_git_tag
$CI_COMMIT_TAG != null &&
$CI_COMMIT_BRANCH == null
.condition_any_branch_push: &condition_any_branch_push # condition_any_branch_push
$CI_COMMIT_BRANCH != null &&
$CI_COMMIT_TAG == null &&
$CI_PIPELINE_SOURCE == "push"
.rules_commit_develop_branch: &when_commit_develop_branch
- if: # on dev branch
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
changes:
paths:
<<: *repository_change_files
compare_to: 'master'
exists:
<<: *repository_exists_files
when: always
- if: # not on master or dev
$CI_COMMIT_BRANCH != "master" &&
$CI_COMMIT_BRANCH != "development" &&
$CI_PIPELINE_SOURCE == "push"
changes:
paths:
<<: *repository_change_files
compare_to: 'development'
exists:
- dockerfile
- dockerfile.j2
when: always
- if: # tagged pipeline
$CI_COMMIT_TAG != null &&
$CI_COMMIT_BRANCH == null
exists:
- dockerfile
- dockerfile.j2
when: on_success