I run into an action that I don’t understand within Gitlab. I have a repository with multiple branches. And each branch has the exact same .gitlab-ci.yml file. But when I go to CI/CD > Pipelines > Run pipeline… I don’t see the new branch listed? While this actually exists. The only difference between this branch and the other older branches is that when I edit a file I see the following message “You can only edit files when you are on a branch”. How can I ensure that I can display and select the branch when creating a Run Job?
Thank you in advance.
Hello, @hpinstantink
It sounds like you’re encountering an issue where your new branch isn’t appearing in the list of branches when trying to run a pipeline in GitLab. Here are a few things you can check to resolve this issue:
Branch Protection: Ensure that the new branch is not protected in a way that prevents it from being listed. You can check this in your repository settings under Settings > Repository > Protected Branches.
Branch Visibility: Make sure the branch is pushed to the remote repository. Sometimes, local branches might not be pushed to the remote, which can cause them not to appear in the list.
Pipeline Configuration: Verify that your .gitlab-ci.yml file does not have any conditions that might exclude the new branch. For example, check for any only or except rules that might be filtering out the branch.
Branch Naming: Ensure there are no typos or special characters in the branch name that might cause it to be excluded or not recognized properly.
Pipeline Triggering: Sometimes, GitLab might not automatically detect new branches for pipeline runs. You can manually trigger a pipeline for the new branch by using the GitLab API or by pushing a new commit to the branch.
Here’s a quick checklist to help you troubleshoot:
Push the Branch: Ensure the branch is pushed to the remote repository.
git push origin <branch-name>
Check Branch Protection: Go to Settings > Repository > Protected Branches and ensure the branch is not protected in a way that prevents pipeline runs.
Review .gitlab-ci.yml: Ensure there are no only or except rules that might exclude the branch.
only:
- master
- develop
- <branch-name>
Manual Trigger: If the branch still doesn’t appear, try triggering the pipeline manually via the GitLab API or by pushing a new commit.
Hope this will help you.
Best regards,
samuel898