Continuous integration
What is continuous integration
Martin Fowler defines continuous integration as a software development practice in which team development members integrate their work frequently, usually at least once a day per member, which means that multiple integrations may occur per day. Each integration is verified by an automated build (including compilation, release, and automated testing) to find integration errors as quickly as possible. Many teams find that this process greatly reduces integration problems, allowing teams to develop cohesive software more quickly. Similarly, continuous delivery best practices further extend continuous integration (CI) to ensure that software checks are on primary programs and can be deployed to users to ensure that the actual deployment process can be very fast.
Benefits of continuous integration
-
Errors can be found quickly and easily located by integrating into the trunk every time an update is done
-
Prevent branches from deviating too far from the trunk, which can become more difficult or even difficult to integrate in the future if it is not integrated frequently and the trunk is constantly updated
-
Faster release of updates, continuous integration helps teams release and update applications faster and more aggressively. It can automatically complete a lot of repetitive work and save manpower
Drone
introduce
Drone is a continuous delivery system built based on Docker technology. Drone uses a simple YAML profile (a Docker composite command set) to define and execute pipes in a Docker container.
- Drone can seamlessly integrate with multiple source code management systems, including Github, Github Enterprise Edition, Bitbucket, Gitlab, Gogs, Gitea, and more.
- Drone itself supports multiple operating systems and systems architectures, including Linux X64, ARM, ARM64, and Windows X64
- Drone handles any language, database or service running inside a Docker container. You can choose from a public Docker image source, or provide your own.
The deployment of
This article describes how to install Drone services for Gitea. Drone + Gitea is used to realize continuous integration platform, and yML is used to realize packaging front-end, back-end and mobile terminal projects.
1. Install Gitea
Gitea we installed using Docker
Docker pull gitea/gitea:1.12.6 docker run -d --name=gitea -p 10022:22 -p 10080:3000 -v /var/lib/gitea:/data gitea/gitea:latestCopy the code
2. Create an authentication source in Gitea
As shown in the figure, log in with the administrator account and add an authentication source in the Management panel -> Authentication Source. The client ID and key can be generated by yourself
3. Install the Drone
docker pull drone/drone:1
Copy the code
When creating a mirror, set the following parameters as required
Docker run \ --volume=/var/lib/drone:/data \ --env=DRONE_GITEA_SERVER={{create Gitea server IP address}} \ --env=DRONE_GITEA_CLIENT_ID={{client ID generated in the previous step}} \ --env=DRONE_GITEA_CLIENT_SECRET={client key generated in the previous step}} \ --env=DRONE_RPC_SECRET={{Drone program shared key, --env=DRONE_SERVER_HOST={{Drone external server address}} --env=DRONE_SERVER_PROTO={{Drone external server port}} \ --publish=80:80 \ --publish=443:443 \ --restart=always \ --detach=true \ --name=drone \ drone/drone:1Copy the code
4. Check whether the installation is successful
After the successful installation, you can open the address + port of Drone to check whether the installation is successful. If the installation is successful, it will jump to the login interface of Gitea, and jump to the console of Drone after login
You can see the project in Gitea in the console of Drone. If the project is not found in the list, you can click SYNC button for synchronization