Public Repository

Last pushed: 3 months ago
Short Description
Short description is empty for this repo.
Full Description

pipekit/circleci

Trigger builds in CircleCI from a container, downloading artifacts on successful build

Requirements

  • The project has been added to CircleCI already
  • A CircleCI token

Usage

First, create a secret with your CircleCI token:

docker secret create circleci -

Then, add the following step to your pipeline:

steps:
  circleci:
    tasks:
      - image: pipekit/circleci
        secrets:
          - source: circleci
            target: token

Artifacts are automatically downloaded to /run/context/artifacts.

Environment variables

  • $REPOSITORY: (default: autodetected from context) the name of the GitHub repository in namespace/name format
  • $REVISION: (default: autodetected from context) the commit hash to test
  • $BRANCH: (default: none) the name of the branch to test
  • $VCS_TYPE: github (default) or bitbucket
  • $CONTEXT: (default: /run/context) where to find the project for automatic detection of repository name and revision
  • $ARTIFACTS_PATH: (default: $CONTEXT/artifacts) where to download artifacts to
  • $TOKEN_FILE: (default: /run/secrets/token) path to the file with the CircleCI API token
  • $TOKEN: (default: none) the token to use (not recommended, use secrets instead)
  • $READ_ONLY: (default: false) set to true to prevent triggering a new build, and instead look for a build that matches the commit

Standalone usage

Using a branch name:

docker run --rm -it -e TOKEN=<token> -e REPOSITORY=<namespace/name> -e BRANCH=<branch> pipekit/circleci

Using a revision:

docker run --rm -it -e TOKEN=<token> -e REPOSITORY=<namespace/name> -e REVISION=<hash> pipekit/circleci

Automatically detecting the revision and repository names from a local project:

docker run --rm -it -e TOKEN=<token> -v $(pwd):/run/context pipekit/circleci

This will use the origin remote as $REPOSITORY, and the current checked out revision for $REVISION.

In order to fetch artifacts locally, add -v $(pwd):/run/context to the above command.

Other available environment variables:

  • $VCS_TYPE: github (default) or bitbucket
  • $CONTEXT: (default: /run/context) where to find the project for automatic detection of repository name and revision
  • $ARTIFACTS_PATH: (default: $CONTEXT/artifacts) where to download artifacts to

The $TOKEN can also be passed in as a secret, but you need to run the image as a service:

docker service create --restart-condition none --secret source=circleci,target=token [...] pipekit/circleci

Limitations

Docker Pull Command
Owner
pipekit

Comments (0)