Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.
/ couchlock Public archive

Couchlock those running pipelines!

License

Notifications You must be signed in to change notification settings

tomologic/couchlock

Repository files navigation

Couchlock

Couchlock those running pipelines!

What is this?

This is currently the way we are trying to get global locks into our CD pipelines. Historically tried different Jenkins plugins for mutexes/semaphores and hacks by using jobs as locks.

Lock that shared resource!

  • Build machine
  • Build only one image for specific githash of docker image (at the same time)
  • Postgres server
  • Staging system
  • Single Arduino board hooked up to Jenkins
docker run -it --rm tomologic/couchlock \
    --couchdb "https://USER.cloudant.com/couchlock" \
    --lock shared_resource \
    --name $BUILD_TAG \ # Unique identifier, example Jenkins $BUILD_TAG
    lock

## Do crazy things with shared resource

docker run -it --rm tomologic/couchlock \
    --couchdb "https://USER.cloudant.com/couchlock" \
    --lock shared_resource \
    --name $BUILD_TAG \ # Unique identifier, example Jenkins $BUILD_TAG
    unlock

Couchlock is provided through our homebrew tap for OSX and linux users.

brew install tomologic/tap/couchlock

Build & package

GoReleaser is used to build and package this application.

# Install
brew install goreleaser/tap/goreleaser

# Local-only release
goreleaser release --snapshot --clean

# Build for local testing
goreleaser build --single-target

CouchDB

If you don't have couchdb internally then totally try this out with Cloudant which has a great free tier.

Development

Generate bindata

All files in data directory is packed with go-bindata.

go get -u github.com/jteeuwen/go-bindata/...
go-bindata data/...