Drone Github Comment

Himanshu Agrawal
BYJU’S Exam Prep Engineering
2 min readOct 23, 2019

Drone is a Continuous Delivery system built on container technology. It uses a simple YAML configuration file, a superset of docker-compose, to define and execute Pipelines inside Docker containers.

Common use cases include:

  1. Building Docker Images and pushing to container registry like Docker Hub/ECR
  2. Checking & Fixing Lint/PSR4 Coding Standard errors.
  3. Creating package builds and deploying to various cloud services.

At GradeUp, we use Drone to check for Lint errors for our projects and then build docker images. Lint step failures are common and thus we needed a way to simplify process of viewing CI errors. So we build a drone plugin in Golang to solve the issue.

When any step in CI process fails it throws error, users have to open Build logs and go to the step which failed to check the errors.

Drone Failed Pipeline

Drone Github Comment simplifies the process by going through the build logs and finding failed step, create a Github Comment on Pull Request with error logs. We can easily go the Pull Request Page and view the error directly on Github.

Comment added on Github by DroneGitBot

Installation Instructions can be found at Github repository: https://github.com/gradeup/drone-github-comment

Docker Image can be found at: https://hub.docker.com/r/codehimanshu/gitdrone

Sample Usage:

kind: pipeline
name: build-release

steps:
- name: publish
image: plugins/ecr
settings:
access_key:
from_secret: aws_access_key_id
environment:
AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key
AWS_DEFAULT_REGION: us-east-1
secret_key:
from_secret: aws_secret_access_key
repo: username/repository
registry: docker-or-ecr-link
build_args_from_env:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION
build_args:
- AWS_DEFAULT_REGION=us-east-1
tags:
- ${DRONE_BRANCH}
when:
branch:
- release-*

- name: update-status-to-github
image: codehimanshu/gitdrone:1.6
environment:
DRONE_PULL_REQUEST: ${DRONE_PULL_REQUEST}
DRONE_REPO_OWNER: ${DRONE_REPO_NAMESPACE}
DRONE_REPO_NAME: ${DRONE_REPO_NAME}
DRONE_ACCESS_TOKEN:
from_secret: DRONE_ACCESS_TOKEN
DRONE_HOST: ${DRONE_SYSTEM_HOST}
DRONE_BUILD_NUMBER: ${DRONE_BUILD_NUMBER}
GITHUB_INSTALLATION_ID:
from_secret: GITHUB_INSTALLATION_ID
GITHUB_APP_ID:
from_secret: GITHUB_APP_ID
PRIVATE_KEY:
from_secret: PRIVATE_KEY
when:
status: [ failure ]
branch:
- release-*

--

--

Himanshu Agrawal
BYJU’S Exam Prep Engineering

Software Engineer, Exploring new tools, working on POCs, finding peace in optimising software solutions as well as debugging colleague's issues.