Git Product home page Git Product logo

circleci-queue's Introduction

CircleCI Concurrency Control Orb

CircleCI GitHub license CircleCI Orb Version Bors enabled

CircleCI Orb to limit workflow concurrency.

Why? Some jobs (typically deployments) need to run sequentially and not parallel, but also run to completion. So CircleCI's native auto-cancel is not quite the right fit. See https://github.com/eddiewebb/circleci-challenge as an example using blue/green cloud foundry deployments.

Basic Usage

This adds concurrency limits by ensuring any jobs with this step will only continue once no previous builds are running. It supports a single argument of how many minutes to wait before aborting itself and it requires a single Environment Variable CIRCLECI_API_KEY - which can be created in account settings.

Screenshots / Examples

Suppose we have a workflow take takes a little while to run. Normally the build (#18) will run immediately, with no queuing. no queuing if only active build

Someone else on the team makes another commit, since the first build (#18) is still running, it will queue build #19. no queuing if only active build

It's late afternoon, everyone is pushing their commits in to ensure they are good before they leave for the day. Build #20 also queues. no queuing if only active build

Meanwhile, build #19 is now allowed to move forward since build #18 finished.

no queuing if only active build

Oh No! Since 1 minute is abnormally long for things to be queued, build #20 aborts itself, letting build #19 finish uninterrupted.

no queuing if only active build

Setup

See https://circleci.com/orbs/registry/orb/eddiewebb/queue#usage-examples for current examples

Note

Queueing is not supported on forked repos. If a queue from a fork happens the queue will immediately exit and the next step of the job will begin.

RealSelf fork changes

Forked eddiewebb/[email protected]. Fixed a bug when a git tag is released and the env variable CIRCLE_BRANCH is unset. Now there is a parameter circle-branch that by default has main as value, but can be set to any other branch name so that it doesn't break queueing in non-main branches.

Deployment steps

# Pack and validate orb
brew install circleci
circleci config pack src/ > pack.yml
circleci orb validate pack.yml

# Only for first time creation
circleci orb create realself/queue

# Push orb (change version to latest)
circleci orb publish ./pack.yml realself/[email protected]

circleci-queue's People

Contributors

eddiewebb avatar bors[bot] avatar zephraph avatar kobim avatar noah-empire avatar prashcr avatar sumitkharche avatar aaronstillwell avatar prophile avatar chrishelgert avatar glentakahashi avatar mu-bro avatar microbit-matt-hillsdon avatar olleolleolle avatar alonisser avatar pacoard avatar philnielsen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.