gitlab: install: workflow rules installed after existing "when: never" rule

Open Beginner friendly
#9,404 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
73/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
gitlab
Domain
ci-cd

Research direction

Find the code that generates the GitLab workflow rules during fullsend install and read the relevant tests for existing .gitlab-ci.yml workflows. Check how generated rules are ordered relative to an existing when: never rule; done means the installed workflow preserves the existing rules and allows the intended generated pipelines to run.

Written by the indexing model from the issue text.

Description

I am installing fullsend in a repository that has an existing workflow setup of

workflow:
  rules:
    # Run on merge request pipelines
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    # Run automatically on statistic pipelines
    - if: '$STATISTIC_PIPELINE == "true"'
    # Don't run in other cases
    - when: never

fullsend install proposed a MR with

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0d4336590210cbc12ecdaad9a1494e457f14eab1..c6a36b4383401abe0e60ec1508dff2164ea8e7bf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,12 +92,20 @@ default:
 
 workflow:
   rules:
+    - if: $CI_DEBUG_TRACE =~ /^(1|t|true)$/i
+      when: never
     # Run on merge request pipelines
     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
     # Run automatically on statistic pipelines
     - if: '$STATISTIC_PIPELINE == "true"'
     # Don't run in other cases
     - when: never
+    - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_REF_PROTECTED == "true"
+    - if: $CI_PIPELINE_SOURCE == "api" && $CI_COMMIT_REF_PROTECTED == "true" && $STAGE
+    - if: $CI_PIPELINE_SOURCE == "pipeline" && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $STAGE
+    - if: $CI_PIPELINE_SOURCE == "trigger" && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
+  auto_cancel:
+    on_new_commit: none
 
 setup:
   extends: .kqe_setup

I don't think this is going to work; gitlab takes these in order so it will stop at the when: never. Probably the solution is to delete this line, although I suppose it could live at the end as well.

Dominant language
Go
Stars
146
Forks
112
Avg merge
1d 16h
Merged PRs (30d)
358

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fullsend-ai/fullsend

All issues in fullsend-ai/fullsend

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.