All Projects → duck8823 → duci

duck8823 / duci

Licence: MIT license
The simple ci server

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to duci

branch-protection-bot
A bot tool to disable and re-enable "Include administrators" option in branch protection
Stars: ✭ 57 (-21.92%)
Mutual labels:  ci
AzDo.VstsDashboard
Provide a simple way to view all Builds and Releases on a single page. The intend was to see what's currently happened into the CI/CD pipeline and provide quick feedback of what's going on.
Stars: ✭ 16 (-78.08%)
Mutual labels:  ci
github-create-release-action
Create a GitHub release from a Tag
Stars: ✭ 33 (-54.79%)
Mutual labels:  ci
micromamba-docker
Rapid builds of small Conda-based containers using micromamba.
Stars: ✭ 97 (+32.88%)
Mutual labels:  ci
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (-78.08%)
Mutual labels:  ci
laravel-realworld-example-app
Exemplary RealWorld backend API built with Laravel PHP framework.
Stars: ✭ 34 (-53.42%)
Mutual labels:  ci
python-test-reporter
DEPRECATED Uploads Python test coverage data to Code Climate
Stars: ✭ 18 (-75.34%)
Mutual labels:  ci
docker-coala-base
coala base docker image
Stars: ✭ 20 (-72.6%)
Mutual labels:  ci
OneStack
IT管理系统,实现自动化运维,整合CMDB和监控,实现自动化部署,打通开发、运维和测试的边界,实现一栈式管理。
Stars: ✭ 73 (+0%)
Mutual labels:  ci
github-status-updater
Command line utility for updating GitHub commit statuses and enabling required status checks for pull requests
Stars: ✭ 83 (+13.7%)
Mutual labels:  ci
devops-guidebook
📚 DevOps 知识图谱 关于Linux、服务器、数据库、部署等相关体系
Stars: ✭ 25 (-65.75%)
Mutual labels:  ci
buildservice
Project build service using node, CI script
Stars: ✭ 21 (-71.23%)
Mutual labels:  ci
breakcheck
Backwards compatibility linter for Go.
Stars: ✭ 66 (-9.59%)
Mutual labels:  ci
prettier
🔨 Native, blazingly-fast Prettier CLI on Github Actions
Stars: ✭ 19 (-73.97%)
Mutual labels:  ci
release-helper
🤖 A GitHub Action that help you publish release.
Stars: ✭ 27 (-63.01%)
Mutual labels:  ci
std-env
Detect current Javascript environment
Stars: ✭ 85 (+16.44%)
Mutual labels:  ci
cookiecutter-cpp-project
A cookiecutter for a C++ Project with lots of configuration options
Stars: ✭ 25 (-65.75%)
Mutual labels:  ci
k8s-buildkite-plugin
Run any buildkite build step as a Kubernetes Job
Stars: ✭ 37 (-49.32%)
Mutual labels:  ci
netlify-plugin-cache
⚡ Generic plugin for caching any files and/or folders between Netlify builds
Stars: ✭ 19 (-73.97%)
Mutual labels:  ci
action-junit-report
Reports junit test results as GitHub Pull Request Check
Stars: ✭ 103 (+41.1%)
Mutual labels:  ci

duci

Language GitHub release GoDoc Build Status Coverage Status Go Report Card MIT License

duci [zushi] (Docker Under Continuous Integration) is a simple ci server.

DSL is Unnecessary For CI

Let's define the task in the task runner.
Let's define the necessary infrastructure for the task in the Dockerfile.
duci just only execute the task in docker container.

Features

  • Execute the task in Docker container
  • Execute the task triggered by GitHub pull request comment or push
  • Execute tasks asynchronously
  • Create GitHub commit status
  • Store and Show logs

How to use

Target Repository

The target repository must have Dockerfile in repository root or .duci/Dockerfile.
If there is .duci/Dockerfile, duci read it preferentially.

In Dockerfile, I suggest to use ENTRYPOINT.

e.g.

ENTRYPOINT ["mvn"]
CMD ["compile"]
ENTRYPOINT ["fastlane"]
CMD ["build"]

When push to github, duci execute mvn compile / fastlane build.
And when comment ci test on github pull request, execute mvn test / fastlane test.

Using host environment variables

If exists ARG instruction in Dockerfile, override value from host environment variable.

ARG FOO=default
ARG BAR

and you can use as envrionment variable in command.

ARG FOO=default
ENV FOO=$FOO

Runtime configuration

volumes

You can use volumes options for external dependency, cache and etc.
Set configurations in .duci/config.yml

volumes:
  - '/path/to/host/dir:/path/to/container/dir'

environment variable

You can set environment variables in docker container.
Add the following to .duci/config.yml

environments:
  - ENVIRONMENT_VAIRABLE=value

Server Settings

Installation

# binary will be $(go env GOPATH)/bin/duci
curl -sfL https://raw.githubusercontent.com/duck8823/duci/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
duci version

You can also install a specific version. (replace vX.Y.Z with the specific version from the releases page):

# binary will be $(go env GOPATH)/bin/duci
curl -sfL https://raw.githubusercontent.com/duck8823/duci/master/install.sh | sh -s -- -b $(go env GOPATH)/bin vX.Y.Z
duci version

Setting SSH (optional)

If target repository is private, You can use SSH key to clone repository from github.com.
Please set the public key of the pair at https://github.com/settings/keys.

Add Webhooks to Your GitHub repository

duci start to listen webhook with port 8080 (default) and endpoint /.
In GitHub target repository settings (https://github.com/<owner>/<repository>/settings/hooks), Add endpoint of duci to Payload URL and application/json to Content type respectively.

Run Server

$ duci server

Server Configuration file

You can specify configuration file with -c option. The configuration file must be yaml format. Possible values ​​are as follows.

server:
  workdir: '/path/to/tmp/duci'
  port: 8080
  database_path: '$HOME/.duci/db'
github:
  # (optional) You can use SSH key to clone. ex. '${HOME}/.ssh/id_rsa'
  ssh_key_path: ''
  # For create commit status. You can also use environment variable
  api_token: ${GITHUB_API_TOKEN}
job:
  timeout: 600
  concurrency: 4 # default is number of cpu

You can check the configuration values.

$ duci config

Using Docker

You can use Docker to run server.

$ docker run -p 8080:8080 \
             -e GITHUB_API_TOKEN=<your toekn> \
             -v /var/run/docker.sock:/var/run/docker.sock \
             duck8823/duci

When you want to clone with SSH in container,

$ docker run -p 8080:8080 \
             -e GITHUB_API_TOKEN=<your toekn> \
             -e SSH_KEY_PATH=/root/.ssh/id_rsa \
             -v ~/.ssh:/root/.ssh:ro \ 
             -v /var/run/docker.sock:/var/run/docker.sock \
             duck8823/duci

Run with docker-compose

With docker-compose, you can also start ui and reverse proxy together.

$ git clone https://github.com/duck8823/duci.git
$ cd duci
$ docker-compose up -d

If you start up on another host, set your host name (default: localhost) to environment variable DUCI_HOST.

Read job log

GitHub send payload as webhook including X-GitHub-Delivery header.
You can read job log with the X-GitHub-Delivery value formatted UUID.

$ curl -XGET http://localhost:8080/logs/{X-GitHub-Delivery}

The endpoint returns NDJSON (Newline Delimited JSON) formatted log.

{"time":"2018-09-21T22:19:42.572879+09:00","message":"Step 1/10 : FROM golang:1.11-alpine"}
{"time":"2018-09-21T22:19:42.573093+09:00","message":"\n"}
{"time":"2018-09-21T22:19:42.573494+09:00","message":" ---\u003e 233ed4ed14bf\n"}
{"time":"2018-09-21T22:19:42.573616+09:00","message":"Step 2/10 : MAINTAINER shunsuke maeda \[email protected]\u003e"}
{"time":"2018-09-21T22:19:42.573734+09:00","message":"\n"}
...

Health Check

This server has an health check API endpoint (/health) that returns the health of the service. The endpoint returns 200 status code if all green.

$ curl -XGET -I http://localhost:8080/health
HTTP/1.1 200 OK
Date: Wed, 31 Oct 2018 20:33:42 GMT
Content-Length: 0

The check items are as follows

  • Whether the Docker daemon is running or not

You can also check with health sub-command.

$ duci health
INFO[14/Jan/2019 07:17:38.864] ok.

License

MIT License

Copyright (c) 2018 Shunsuke Maeda

See LICENSE file

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].