At our company, the DevOps team is not only responsible for CI/CD and online server maintenance, but we are also responsible for the development of automation tools to improve efficiency, such as BOT.
Because we are engaged in a creative work, so we hate all repetitive human labor. In particular, we look at repetitive tasks in our colleagues’ daily jobs and develop automated tools to eliminate them.
In this article we will share some of the scenarios automated by our bot.
1. Automatic package upgrade
1.1 When a new version is released for a package
We currently have multiple PHP Application projects within the company that require a lot of logic reuse, so we have packaged a lot of common logic, and now we have over 50 PHP LIBS projects.
In order to ensure the minimum difference among all projects and reduce the accumulation of technical debt, we require developers to be responsible for upgrading all the versions dependent on a project to the latest after the release of a new version of the package, which is extremely painful and error-prone, because:
- You need to perform Composer Upgrade in several projects each time
- It is often not clear which projects are relied on by infrequently used packages, and upgrades are often omitted
- Due to the domestic network, each time for Composer upgrade is extremely time-consuming
To this end, we developed the automatic package upgrade bot, which will automatically upgrade the project package after the developer releases a new version of the package, according to the following strategies:
- Automatically resolve package dependencies and check which projects depend on the package
- According to theSemantic Version, compared to the version project currently relies on
- If there is no breaking change, upgrade package changes are directly committed to the development branch
- Otherwise, upgrade package changes are committed to a branch and a PR is automatically created and assigned to Manager Review.
1.2 After the Master is Cut
We had a weekly release cycle, and we wanted to upgrade all the packages in the warehouse to the latest version to avoid the accumulation of technical debt at the start of a new release cycle every week. Because of the large number of our warehouses and network reasons, this was also painful once a week.
Now, our bot will automatically upgrade packages after the weekly master cut
Git Flow
Our company follows a Branch management strategy with Git Flow, so every time we switch phases of the development cycle, we need to do the following in the REPO: Merge release branch to Develop, merge Release branch to Master, delete release branch, tag master.
Since we have several projects in our company, it is also a weekly experience to perform such a repetitive process in each REPO. Since all of our projects follow the same development cycle, this process can be fully automated in batches. For this purpose, we developed Slack Bot, which will automatically complete the above tasks in all projects with only two instructions.
Lottery take food
Well, this bot is interesting. The scene is like this. Because we have a very good relationship with colleagues, we have a meal together every day. But with so many people eating, it’s obviously not optimal for everyone to go downstairs at the same time, so we think we only need one or two people to go downstairs and get everyone’s lunch at once. How do you decide who goes down to pick up your meal without ruining the rapport of your colleagues? We explore: fair lottery!
All YOU have to do is tell Big Brain (my cat) which people are eating together today, and Big Brain will pick two people at random. Why two people? Or to maintain a harmonious relationship between colleagues, so that the chosen one is not too lonely.
conclusion
The above are the most commonly used automated bots in our company, of course, there are far more than these in practice, but because most of them are too deeply bound to our own business logic or cover scenarios are not common, there is not much value to share.
If you are interested in our Bot culture, please join us.
Welcome to follow our wechat official account “RightCapital”