derekahn / autoapp

Example of CI/CD with a simple go app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autoapp 🤖

license Go Report Card Codacy Badge Codacy Badge Build Status Docker Repository on Quay GitHub tag (latest SemVer)

An example of CI/CD with a simple go application utilizing a multistage docker build.

Run

🐳ized

# creates a new image
$ make build

# runs the image
$ make run

🐹ized

# installs deps etc
$ make install

# execute binary
$ ./bin/cmd

Example

example view

Environment Variables

# defaults to "8080"
PORT=3000

# defaults to "Gopher"
NAME="Edgar Allan Poe"

# forces tests to fail
FAILED=true

Commands

Run make help to list available commands:

  $  make help

Choose a command run in autoapp:

  install    Install missing dependencies. Builds binary in ./bin
  build      Creates a docker image of the app
  fail       Forces a failed docker build of the app due to failing tests
  run        Runs the current docker image on port 8080
  clean      Clean build files. Runs `go clean` internally
  fmt        Runs gofmt on all source files
  test       Runs all the tests.
  coverage   Tests code coverage
  missing    Displays lines of code missing from coverage

CI/CD How To 🧙

This tutorial assumes you have access to the Google Cloud Platform. While GCP is used for basic infrastructure requirements, the lessons learned in this tutorial can be applied to other platforms.

It's not a requirement. But reading through this tutorial will be easier and available offline utilizing vmd. It requires node.js installed which you can do with $ brew install node and then $ npm install -g vmd. Then in the root of the project $ cd ~/<WORK_DIR>/autoapp/ && vmd.

Section Description
Prerequisites Preface, disclaimers and setting expectations
Installing the Client Tools Setup and install of CLIs required
Creating A New Cluster Creating and connecting to a GCP GKE cluster
Deploying Spinnaker Deploying Spinnaker to our cluster
Setting up Quay Step by step configuration for Quay's hooks
Setting up Spinnaker Step by step configuration for spinnaker to automate deployments
Setting up Drone Wire up a simple CI pre-merge check
Deploying 🚀 Submitting a pull-request which on successful merge will trigger our CI/CD

About

Example of CI/CD with a simple go app

License:MIT License


Languages

Language:Go 44.6%Language:Makefile 26.4%Language:Dockerfile 18.6%Language:HTML 5.4%Language:CSS 5.1%