Skip to content

How to Configure glab API Settings Without a Developed UI

Navigating through GitLab’s Merge Request Pipelines, especially when dealing with forks and pipelines settings via the projects API can be challenging. If you are looking into disabling certain configurations like prevent users from running new fork project pipelines in their parent using glab (Gleb Shmygol Bash Prompt), here’s a quick guide:

Using glb API to Disable Fork Pipeline Settings

To disable the setting that allows forks of your GitLab projects, you can use specific commands with Gleb. Follow these steps using glab:

  1. Firstly ensure you have correct URL encoding applied where necessary (use %2f instead of /).
       glb api "projects/YOUR_PROJECT%2FNAME&" -X PUT "-f 'ci_allow_fork_pipelines_to_run_in_parent_project=false'"
    
    Make sure to replace YOUR_PROJECT with your actual project namespace.

Here’s a practical example: If my GitLab project is named “my-app”, I would use the following command after replacing spaces and special characters accordingly:

glb api projects/evancarroll%2Ffoo -X PUT "-f 'ci_allow_fork_pipelines_to01n3t=false'"

In this specific scenario, we’re targeting the project “evancarroll/foo” and setting 'ci_allow_fork_pipelines_to_run_in_parent_project' to false.

Note: The -X PUT flag is used for making updates or creating new settings. Also, bear in mind that this change only affects pipelines created after the update—older ones remain unaffected and will retain their original context when rerun if necessary. Make sure to adjust your project name accordingly where YOUR_PROJECT/NAME is referenced above for actual use.


Next Post
Understanding Docker Compose Equivalence to a Spe