When you push code to your repository (in GitHub) the expected behavior is that your build pipeline will execute. This guide will help you troubleshoot the scenario where you push code and nothing happens in Drone.
First you should enable debug mode by setting the DRONE_LOGS_DEBUG=true
environment variable and passing this to your Drone server.
Did your version control system trigger the webhook?
When you push code to your source code management system (e.g. GitHub) it will send a webhook to Drone. Navigate to your webhook settings and verify the webhook address is correct. Also check your repository webhook history to confirm successful delivery.
The most common root cause for failed delivery are:
- You are running Drone with a
localhost
or127.0.0.1
or some other local or private address. GitHub cannot post a webhook to a local address - You are running Drone with a private address behind a firewall. GitHub cannot post a webhook to a private address.
- You are running Drone with a self-signed SSL certificate. You will need to disable SSL verification in the GitHub webhook settings
- You did not configure the correct DRONE_SERVER_HOST or DRONE_SERVER_PROTO which caused Drone to set an incorrect webhook address.
Did Drone receive the webhook?
If Drone receives and parses the webhook from the source code management system (e.g. GitHub) it will write a message to the logs indicating the webhook was parsed successfully. It will also write additional metadata to the logs, including the repository and ref.
{
"fields.time": "2019-01-10T11:42:30-08:00",
"latency": 461922291,
"level": "debug",
"method": "POST",
"msg": "",
"remote": "[::1]:64348",
"request": "/hook",
"request-id": "1ROWPl14MvfnybYrXz6qogmrtJC",
"time": "2019-01-10T11:42:30-08:00"
}
{
"commit": "16cf589c156e3274125710a971f89fb53d881bf0",
"event": "push",
"level": "debug",
"msg": "webhook parsed",
"name": "drone-test-go",
"namespace": "bradrydzewski",
"time": "2019-01-10T11:42:30-08:00"
}
{
"commit": "16cf589c156e3274125710a971f89fb53d881bf0",
"event": "push",
"level": "debug",
"msg": "trigger: received",
"ref": "refs/heads/master",
"repo": "bradrydzewski/drone-test-go",
"time": "2019-01-10T11:42:30-08:00"
}
If you do not see any logs it means a webhook was not delivered. Please see the Did your version control system trigger the webhook section of this document to troubleshoot.
Did Drone ignore the webhook or skip the build?
If Drone skips your build it will always write the skip reason to the logs. In the below example we see the build was skipped due to the [CI SKIP]
directive being found in the commit message.
{
"commit": "042bc1df43d9e9d195be53a50bef741e9702c0d6",
"event": "push",
"level": "info",
"msg": "trigger: skipping hook. found skip directive",
"ref": "refs/heads/master",
"repo": "bradrydzewski/drone-test-go",
"time": "2019-01-10T11:39:26-08:00"
}
Did your Trigger section resolve to false?
If the trigger section evaluates to false the pipeline does not execute. In the below example we see the build was skipped due to the branch conditions evaluating to false.
{
"commit": "042bc1df43d9e9d195be53a50bef741e9702c0d6",
"event": "tag",
"level": "info",
"msg": "trigger: skipping pipeline, does not match branch",
"ref": "refs/tags/v1.0.0",
"repo": "bradrydzewski/drone-test-go",
"time": "2019-01-10T11:39:26-08:00"
}
The first common mistake we see is using branch or reference conditions for tags. It is important to remember that you cannot use branch conditions with tag events. They will never evaluate to true because git does not track the source branch from which a tag was created (nor does this information get sent in the webhook).
trigger:
branch:
- master
The second common mistake we see is using branch conditions for pull requests. When Drone evaluates the pull request branch condition, it is evaluated against the target branch, not the source branch. For example, if you create a pull request to merge into master, Drone uses branch master
when evaluating your conditions.
Do you see an entry indicating an invalid signature?
The webhook signature is verified using a per-repository secret token stored in the database. The typical root cause of this error is deleting an existing Drone installation and re-installing from scratch. You can resolve this problem by re-activating your repository in the user interface. You may also need to delete any old webhooks in GitHub.
{"message":"Invalid webhook signature"}
Please remember that you cannot manually create webhooks. Drone must be responsible for creating the webhook to ensure the webhook secret is properly configured for a given repositroy.
Does the yaml file exist?
Do you see an error in the console indicating the yaml file does not exist? Drone uses the commit sha from the webhook to fetch the yaml. The most common root cause for this error is the yaml file does not exist in the source branch, or is incorrectly named.
The second most common root cause for this issue is the user that enabled the repository had their access to the repository revoked. Drone makes the API request to fetch the yaml on the behalf of this user. If the user cannot access the repository, neither can Drone. You can resolve this issue by de-activating and re-activating the repository using an account that has the appropriate access levels.
{
"commit": "042bc1df43d9e9d195be53a50bef741e9702c0d6",
"event": "push",
"level": "info",
"msg": "trigger: cannot find yaml",
"ref": "refs/heads/master",
"repo": "bradrydzewski/drone-test-go",
"time": "2019-01-10T11:39:26-08:00"
}
Do you see an entry for your build in the user interface, but it is stuck in Pending with an hour glass?
This may indicate that your agents are not properly configured or are unable to reach the Drone server to fetch jobs. See Harness Community | Harness Developer Hub for help troubleshooting.
Still having issues?
We are happy to help you troubleshoot issues, however, before we can help you will need to gather and provide the below information. We will not provide assistance until all requested information is provided.
- Provide your server configuration
- Provide your full server logs with debug logging enabled. Do not omit log entries.
- Provide your yaml configuration file
- Provide a copy of the webhook payload and headers from GitHub
- Provide a copy of the webhook response in GitHub
- Confirm you have checked all common issues described in this thread and quickly summarize how you ruled each item out.