Run drone-server on Cloudron
Find a file
Felix Bartels 2f413b92b1 Add separate stage to build a distrobox optimized container
Signed-off-by: Felix Bartels <felix@9wd.eu>
2023-08-06 17:54:37 +02:00
.github Create FUNDING.yml 2020-06-06 09:21:11 +02:00
helpers Add separate stage to build a distrobox optimized container 2023-08-06 17:54:37 +02:00
runner Incorporate updates suggested in https://forum.cloudron.io/topic/9756/guide-auto-deploy-of-hugo-via-gitea-drone-ci 2023-08-02 17:17:01 +02:00
.dockerignore move runner into subfolder 2020-06-07 17:07:27 +02:00
.drone.yml Add example for file linting 2022-07-07 14:55:59 +02:00
.gitignore Update gitignore 2022-07-25 12:37:09 +02:00
CloudronManifest.json Update cloudron base image and Drone version to their latest releases 2023-08-02 17:27:46 +02:00
Dockerfile Update cloudron base image and Drone version to their latest releases 2023-08-02 17:27:46 +02:00
LICENSE.txt add license 2020-06-10 14:50:51 +02:00
logo.png add logo 2020-06-09 12:08:43 +02:00
Makefile Update Drone to 2.5.0 2021-11-20 12:55:14 +01:00
POSTINSTALL.md Update cloudron base image and Drone version to their latest releases 2023-08-02 17:27:46 +02:00
README.md Update cloudron base image and Drone version to their latest releases 2023-08-02 17:27:46 +02:00
start.sh add logo 2020-06-09 12:08:43 +02:00
supervisor-drone-server.conf Add scripting to run drone-server on Cloudron 2020-06-05 22:25:57 +02:00

Drone CI for Cloudron

Run the Drone server on Cloudron and the agents locally.

I use this setup together with a Gitea running on the same Cloudron installation.

Requirements

  • docker compose (on the system you want to run the agent on)
  • git
  • jq
  • make
  • Cloudron CLI

Installation

  • Run DOCKER_REPO=your-docker-hub-user make install to install the Drone server component at drone.yourdomain.com (yourdomain.com will adapt automatically to your Cloudron setup).
  • Run make exec' to open the app's CLI and modify the .env' so that it can connect to your Git instance.
  • Run cloudron restart to restart the application and apply your changes.
  • Check that your setup works by going to https://drone.yourdomain.com.
  • If all looks good, run `runner/start.sh' to start the Drone agent on your local machine (it will grab the credentials directly from the installed app).
  • Add the drone configuration to your desired repositories

Tips and tricks

I would also like to share some very useful commands. To install the drone CLI, follow the official docs.

Using drone-cli

Go to your user settings and get the login information

export DRONE_SERVER=https://drone.9wd.eu
export DRONE_TOKEN=your token
drone info

Running pipelines directly

You can also run pipelines directly from the Drone CLI:

drone exec --secret-file secrets.txt .drone.yml

A template for secrets.txt:

slack_url=https://hooks.slack.com/services/xxxxxxxxxxxx

Adding secrets from the CLI

You can either add secrets via the web interface or use drone directly from your terminal:

drone secret add -repository username/repository-name --name foo --data bar --allow-pull-request

Trigger build via curl

curl -X POST -i https://drone.9wd.eu/api/repos/felix/cloudron-drone-app/builds -H "Authorization: Bearer your-token"

Get token from https://drone.9wd.eu/account

Webhooks do not trigger builds in drone?

  • Remove the webhook in Gitea
  • Go to the Drone dashboard and disable the individual project in the settings.
  • re-enable the project
  • Go back to Gitea and "test delivery" your new webhook.

Inspiration