GitLab API – Automation
Trigger pipelines by using the GitLab API
- Graphql Server repository
- Custom NPM Package that contains the TypeScripts
- The main application that consumes the types from the custom NPM Package
- GraphQl server gets updated and releases a new version
- In the release process GraphQL server kicks off the Custom NPM pipeline using `triggers`
- The Custom NPM package updates the types and releases a new version automatically
To trigger the pipeline
Lister the trigger
Use GitLab API locally to upgrade multiples applications
It is a script to update all features applications in one shot.
What it does is API request to GitLab and get all apps names and ssh URL
It will check if the app is in your system if not it will clone the app.
Then stash the changes if you have something and it will create a new branch with the name of the dependency to install.
It will install the dependency and commit the changes after the commit it will push the changes and automatically will open a Merge Request targeting the main branch.
ROOT
|-script
|-apps
|--|-app1
|--|-app2
|--|-app3
....
Step-by-Step
-
- Verify if we have installed in our system the dependency jq very handy JSON command line processor.
- Ask to the user to enter the dependency name and the version we want to upgrade. Example: react-dom and version 18.2.0
- Make a curl GET request to get the list of repositories
- Print in the terminal the list of repositories available, and allow the user to select which one wants to update
- After the selection is completed enter a loop to upgrade each repository selected
- If the repo does not exist clone it
- Stash any uncommitted changes to avoid losing changes
- Move to the main branch and pull the latest code
- Create a new branch with the dependency and version
- Install the dependency or upgrade it
- Commit the new changes and push them to the origin
- Open an automatic Merge Request
- Repeat the same operation in the next repository