All Projects → harbur → Captain

harbur / Captain

Licence: mit
Captain - Convert your Git workflow to Docker 🐳 containers

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Captain

Mbt
The most flexible build tool for monorepo
Stars: ✭ 184 (-75.1%)
Mutual labels:  build-tool, cli, ci
Yb
A new build tool optimized for local + remote development
Stars: ✭ 29 (-96.08%)
Mutual labels:  build-tool, cli, ci
Buildpipeline
AWS-powered serverless build, test and deploy pipeline ft. multiple environments
Stars: ✭ 105 (-85.79%)
Mutual labels:  build-tool, ci
Create Elm App
🍃 Create Elm apps with zero configuration
Stars: ✭ 1,650 (+123.27%)
Mutual labels:  build-tool, cli
Travis Watch
Stream live travis test results of the current commit to your terminal!
Stars: ✭ 294 (-60.22%)
Mutual labels:  cli, ci
Gg Shield
Detect secret in source code, scan your repo for leaks. Find secrets with GitGuardian and prevent leaked credentials. GitGuardian is an automated secrets detection & remediation service.
Stars: ✭ 708 (-4.19%)
Mutual labels:  cli, ci
Handroll
🍣 Expertly rolled JavaScript. CLI + library for bundling JavaScript with Rollup.js
Stars: ✭ 66 (-91.07%)
Mutual labels:  build-tool, cli
Foy
A simple, light-weight and modern task runner for general purpose.
Stars: ✭ 157 (-78.76%)
Mutual labels:  build-tool, cli
Lighthouse Ci
A useful wrapper around Google Lighthouse CLI
Stars: ✭ 198 (-73.21%)
Mutual labels:  cli, ci
Ui5 Tooling
An open and modular toolchain to develop state of the art applications based on the UI5 framework
Stars: ✭ 339 (-54.13%)
Mutual labels:  build-tool, cli
Horusec
Horusec is an open source tool that improves identification of vulnerabilities in your project with just one command.
Stars: ✭ 311 (-57.92%)
Mutual labels:  cli, ci
Pundle
👾 peaceful bundles - js bundler, built from the ground up for speed and extensibility
Stars: ✭ 354 (-52.1%)
Mutual labels:  build-tool, cli
Toast
Containerize your development and continuous integration environments. 🥂
Stars: ✭ 748 (+1.22%)
Mutual labels:  build-tool, ci
Docker Builder
Docker builder builds Docker images from a friendly config file.
Stars: ✭ 81 (-89.04%)
Mutual labels:  build-tool, ci
Cypress Terminal Report
Better terminal and file output for cypress test logs.
Stars: ✭ 200 (-72.94%)
Mutual labels:  cli, ci
Cbt
CBT - fun, fast, intuitive, compositional, statically checked builds written in Scala
Stars: ✭ 489 (-33.83%)
Mutual labels:  build-tool, cli
Cistern
A terminal UI for Unix to monitor Continuous Integration pipelines from the command line. Current integrations include GitLab, Azure DevOps, Travis CI, AppVeyor and CircleCI.
Stars: ✭ 161 (-78.21%)
Mutual labels:  cli, ci
Npmvet
A simple CLI tool for vetting npm package versions
Stars: ✭ 193 (-73.88%)
Mutual labels:  cli, ci
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+514.48%)
Mutual labels:  cli, ci
Xcodegen
A Swift command line tool for generating your Xcode project
Stars: ✭ 5,032 (+580.92%)
Mutual labels:  cli, ci

Build Status Coverage Status

Introduction

Captain - Convert your Git workflow to Docker containers ready for Continuous Delivery

Define your workflow in the captain.yaml and use captain to your Continuous Delivery service to create containers for each commit, test them and push them to your registry only when tests passes.

  • Use captain build to build your Dockerfile(s) of your repository. If your repository has local changes the containers will only be tagged as latest, otherwise the containers will be tagged as latest, COMMIT_ID & BRANCH_NAME. Now your Git commit tree is reproduced in your local docker repository.
  • Use captain test to run your tests
  • Use captain push to send selected images to the remote repository

From the other side, you can now pull the feature branch you want to test, or create distribution channels (such as 'alpha', 'beta', 'stable') using git tags that are propagated to container tags.

intro

Installation

To install Captain, run:

curl -sSL https://raw.githubusercontent.com/harbur/captain/v1.1.3/install.sh | bash

You will need to add ~/.captain/bin in your PATH. E.g. in your .bashrc or .zshrc add:

export PATH=$HOME/.captain/bin:$PATH

Captain.yml Format

Captain will automatically configure itself with sane values without the need for any pre-configuration, so that it will work in most cases. When it doesn't, the captain.yml file can be used to configure it properly. This is a simple YAML file placed on the root directory of your git repository. Captain will look for it and use it to be configured.

Here is a full captain.yml example:

hello-world:
  build: Dockerfile
  image: harbur/hello-world
  pre:
    - echo "Preparing hello-world"
  post:
    - echo "Finished hello-world"
hello-world-test:
  build: Dockerfile.test
  image: harbur/hello-world-test
  pre:
    - echo "Preparing hello-world-test"
  post:
    - echo "Finished hello-world-test"
  test:
    - docker run -e NODE_ENV=TEST harbur/hello-world-test node mochaTest
    - docker run -e NODE_ENV=TEST harbur/hello-world-test node karmaTest
project-with-build-args:
  build: Dockerfile
  image: harbur/buildargs
  build_arg:
    keyname: keyvalue

image

The location of the Dockerfile to be compiled.

When auto-detecting, the image will be re-constructed by the following rules:

  • Dockerfile: username/parent_dir
  • Dockerfile.*: username/parent_dir.parsed_suffix

Where

  • username is the host's username
  • parent_dir is the Dockerfile's parent directory name
  • parsed_suffix: is the suffix of the Dockerfile parsed with the following rules:
    • Lower-cased to avoid invalid repository names (Repository names support only lowercase letters, digits and _ - . characters are allowed)
image: harbur/hello-world

build

The relative path of the Dockerfile to be used to compile the image. The Dockerfile's directory is also the build context that is sent to the Docker daemon.

When auto-detecting it will walk current directory and all subdirectories to locate Dockerfiles of the following format:

  • Dockerfile
  • Dockerfile.*

The build path will be reconstructed automatically to compile the Dockerfile. The build context will be the directory where the Dockerfile is located.

Note: If more than one Dockerfiles are needed on specific directory, suffix can be used to separate them and share the same build context.

build: Dockerfile
build: Dockerfile.custom
build: path/to/file/Dockerfile
build: path/to/file/Dockerfile.custom

test

A list of commands that are run as tests after the compilation of the specific image. If any command fail, then captain stops and reports a non-zero exit status.

test:
  - docker run -e NODE_ENV=TEST harbur/hello-world-test node mochaTest
  - docker run -e NODE_ENV=TEST harbur/hello-world-test node karmaTest

pre

A list of commands that are run as preparation before the compilation of the specific image. If any command fail, then captain stops and reports a non-zero exit status.

pre:
  - echo "Preparing compilation"

post

A list of commands that are run as post-execution after the compilation of the specific image. If any command fail, then captain stops and reports a non-zero exit status.

post:
  - echo "Reporting after compilation"

build_arg

A set of key values that are passed to docker build as --build-arg flag. For more information about build-args see here.

build_arg:
  keyname: keyvalue

CLI Commands

build

Builds the docker image(s) of your repository

It will build the docker image(s) described on captain.yml in order they appear on file

Flags:

-B, --all-branches=false: Build all branches on specific commit instead of just working branch
-f, --force=false: Force build even if image is already built

test

Runs the tests

It will execute the commands described on test section in order they appear on file

push

Pushes the images to remote registry

It will push the generated images to the remote registry

By default it pushes the 'latest' and the 'branch' docker tags.

Flags:

-B, --all-branches=false: Push all branches on specific commit instead of just working branch
-b, --branch-tags=true: Push the 'branch' docker tags
-c, --commit-tags=false: Push the 'commit' docker tags

pull

Pulls the images from remote registry

It will pull the images from the remote registry

By default it pulls the 'latest' and the 'branch' docker tags.

Flags:

-B, --all-branches=false: Pull all branches on specific commit instead of just working branch
-b, --branch-tags=true: Pull the 'branch' docker tags
-c, --commit-tags=false: Pull the 'commit' docker tags

self-update

Updates Captain to the last available version.

version

Display version

Displays the version of Captain

help

Help provides help for any command in the application.

Simply type captain help [path to command] for full details.

Global CLI Flags

-D, --debug=false: Enable debug mode
-h, --help=false: help for captain
-N, --namespace="username": Set default image namespace

Docker Tags Lifecycle

The following is the workflow of tagging Docker images according to git state.

  • If you're in non-git repository, captain will tag the built images with latest.
  • If you're in dirty-git repository, captain will tag the built images with latest.
  • If you're in pristine-git repository, captain will tag the built images with latest, commit-id, branch-name, tag-name. A maximum of one tag per commit id is supported.

Roadmap

Here are some of the features pending to be implemented:

  • Environment variables to set captain flags
  • Implementation of captain detect that outputs the generated captain.yml with auto-detected content.
  • Implementation of captain ci [travis|circle|etc.] to output configuration wrappers for each CI service
  • Configure which images are to be pushed (e.g. to exclude test images)
  • Configure which tag regex are to be pushed (e.g. to exclude development sandbox branches)
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].