Skip to content
rrizun edited this page Jun 30, 2016 · 80 revisions

clevertools

Welcome to the clevertools wiki!

clevertools is a public github project!!

clevertools is a set of helper scripts that (hopefully!) helps you build and deploy your projects!!

  1. encourage many small builds/deploys (vs few large builds/deploys)
  2. make it as painless and hassle-free as possible to do builds/deploys
  3. building and deploying should be fearless and unremarkable

Install

linux and mac:

sudo pip install https://github.com/CleverPet/clevertools/archive/master.zip

Concept

  1. helper scripts to help you build and deploy your projects (whatever that means!)
  2. a monotonically increasing cleverbuild number (CLEVERBUILD_NUMBER environment variable, increases on successful builds), persisted in the target git project as a git tag, e.g., "cleverbuild-5"
  3. a single per-project non-idempotent ".cleverbuild" script (optional) that results in new git tags to help you build (and manage) your project
  4. multiple per-project idempotent ".cleverscript" scripts (optional) that do "interesting things" to help you deploy (and manage) your projects
  5. .cleverbuild scripts act as documentation on how to build your projects
  6. .cleverscript scripts act as documentation on how to deploy your projects

Overview

there are two (2) main clevertools actions/concepts:

  1. clevertag (runs .cleverbuild script)
  2. cleverrun (runs .cleverscript scripts)

/usr/bin/clevertag:

  1. runs the project's .cleverbuild script in a isolated sandbox, with the next optomistic monotonically increasing cleverbuild number, to try to build a new build and
  2. if success then tags git repo with the cleverbuild number

/usr/bin/cleverrun:

  1. runs a project .cleverscript script in a isolated sandbox against existing cleverbuild tag and
  2. there is no 2

running clevertag creates a new git tag; running cleverscripts do not

there is only one (1) .cleverbuild script; there may be zero or more .cleverscripts (as many as u need to do whatever u need that makes sense for your project)

be conservative when running clevertag (because it creates new git tags); be liberal when running .cleverscript scripts (because they do not create new git tags)

Tips

clevertools scripts should be "fail fast", e.g., for bash scripts use

#!/bin/sh -e

-e means "fail fast"

better yet, use -ex, e.g.,

#!/bin/sh -ex

-x means print commands as they are run

Appendix

things I didn't like (never liked) about building software w/jenkins

  1. jenkins kept track of "failed" builds (and incremented build number on failed builds too).. this is understandable on jenkins part as jenkins is primarily a unit test runner and u do want to keep track of failed unit tests
  2. because jenkins kept track of build number then that meant that the jenkins install was "sacred", i.e., that it needed to be managed in case of disaster (e.g., backup/restore)

TODO

  1. branches, e.g., "cleverbuild hotfix1"
  2. self hosted clevertools, i.e., clevertools uses clevertools
  3. automatically create rough draft release notes?
  4. if cleverbuild and no diff then run cleverscript? bad idea
  5. cleverbuild/script assumes "origin".. needs fixing?
  6. prune /tmp folders
  7. don't run "git fetch" ?!?
  8. cleverscript --cleverbuild_number zzz
  9. pass args to .cleverbuild and/or .cleverscripts
Clone this wiki locally