All Projects → chronotc → Monorepo Diff Buildkite Plugin

chronotc / Monorepo Diff Buildkite Plugin

Licence: mit
Run separate pipelines for each folder in your monorepo

Programming Languages

shell
77523 projects

Labels

Projects that are alternatives of or similar to Monorepo Diff Buildkite Plugin

Metav
Release and Versioning of Clojure projects using tools.deps
Stars: ✭ 62 (-43.64%)
Mutual labels:  monorepo
Cra Monorepo Examples
Monorepo w/ shared components.
Stars: ✭ 80 (-27.27%)
Mutual labels:  monorepo
Semver
Nx plugin to automate semantic versioning and CHANGELOG generation.
Stars: ✭ 99 (-10%)
Mutual labels:  monorepo
Buildpipe Buildkite Plugin
Dynamically generate Buildkite pipelines based on project changes
Stars: ✭ 67 (-39.09%)
Mutual labels:  monorepo
Purser
Interact with Ethereum wallets easily
Stars: ✭ 76 (-30.91%)
Mutual labels:  monorepo
Commudle Ng
World's first community management platform. And it's free!
Stars: ✭ 81 (-26.36%)
Mutual labels:  monorepo
React Micro Frontends
This is a monorepo ReactJS based in micro frontends
Stars: ✭ 61 (-44.55%)
Mutual labels:  monorepo
Entangled
enTangle'd is an amalgamation of all things Tangle
Stars: ✭ 107 (-2.73%)
Mutual labels:  monorepo
Generator Django Rest
Yeoman generator for a Django REST/GraphQL API, an optional React SPA & lots more!
Stars: ✭ 77 (-30%)
Mutual labels:  monorepo
Scale
The Scale library offers a set of customizable web components written with Stencil.js & TypeScript. The default theme of the library can be easily replaced so that a corresponding corporate identity of a dedicated brand can be represented.
Stars: ✭ 87 (-20.91%)
Mutual labels:  monorepo
Vitamin Web
Decathlon Design System libraries for web applications
Stars: ✭ 70 (-36.36%)
Mutual labels:  monorepo
Create React App
Yarn Workspaces Monorepo support for Create-React-App / React-Scripts.
Stars: ✭ 76 (-30.91%)
Mutual labels:  monorepo
Nx Packaged
Angular libraries with ng-packagr embedded in Nx Workspace.
Stars: ✭ 82 (-25.45%)
Mutual labels:  monorepo
Bilt
A build tool for NPM monorepos
Stars: ✭ 63 (-42.73%)
Mutual labels:  monorepo
Has Changed Path
GitHub Action that saves time and money in monorepo environments
Stars: ✭ 102 (-7.27%)
Mutual labels:  monorepo
React Native Spaceviewer
See and search upcoming and previous rocket space launches! Built with React Native, using Detox E2E tests, Fastlane and Github Actions for app store deployment.
Stars: ✭ 61 (-44.55%)
Mutual labels:  monorepo
Lite
Split a repository to read-only standalone repositories
Stars: ✭ 1,229 (+1017.27%)
Mutual labels:  monorepo
Colmena
Colmena is a starter kit for an API with an Admin interface that can be easily extended and built upon.
Stars: ✭ 1,420 (+1190.91%)
Mutual labels:  monorepo
Nx Electron
Electron schematics for nrwl nx platform
Stars: ✭ 105 (-4.55%)
Mutual labels:  monorepo
Flow Mono Cli
A command line interface that aims to solve a few issues while working with flow typed codebases in a mono-repo.
Stars: ✭ 84 (-23.64%)
Mutual labels:  monorepo

monorepo-diff-buildkite-plugin Build status

This plugin will assist you in triggering pipelines by watching folders in your monorepo.

Example

Simple

steps:
  - label: "Triggering pipelines"
    plugins:
      - chronotc/monorepo-diff#v1.3.2:
          diff: "git diff --name-only HEAD~1"
          watch:
            - path: "bar-service/"
              config:
                command: "echo deploy-bar"
            - path: "foo-service/"
              config:
                trigger: "deploy-foo-service"

Detailed

steps:
  - label: "Triggering pipelines"
    plugins:
      - chronotc/monorepo-diff#v1.3.2:
          diff: "git diff --name-only $(head -n 1 last_successful_build)"
          interpolation: false
          watch:
            - path:
                - "ops/terraform/"
                - "ops/templates/terraform/"
              config:
                command: "buildkite-agent pipeline upload ops/.buildkite/pipeline.yml"
                label: "Upload pipeline"
                retry:
                  automatic:
                  - limit: 2
                    exit_status: -1
                agents:
                  queue: performance
                artifacts:
                  - "logs/*"
                env:
                  - FOO=bar
            - path: "foo-service/"
              config:
                trigger: "deploy-foo-service"
                label: "Triggered deploy"
                build:
                  message: "Deploying foo service"
                  env:
                    - HELLO=123
                    - AWS_REGION

          wait: true
          hooks:
            - command: "echo $(git rev-parse HEAD) > last_successful_build"

Configuration

diff (optional)

This will run the script provided to determine the folder changes. Depending on your use case, you may want to determine the point where the branch occurs https://stackoverflow.com/questions/1527234/finding-a-branch-point-with-git and perform a diff against the branch point.

Sample output:

README.md
lib/trigger.bash
tests/trigger.bats

Default: git diff --name-only HEAD~1

Examples:

diff: ./diff-against-last-successful-build.sh

#!/bin/bash

set -ueo pipefail

LAST_SUCCESSFUL_BUILD_COMMIT="$(aws s3 cp "${S3_LAST_SUCCESSFUL_BUILD_COMMIT_PATH}" - | head -n 1)"
git diff --name-only "$LAST_SUCCESSFUL_BUILD_COMMIT"

diff: ./diff-against-last-built-tag.sh

#!/bin/bash

set -ueo pipefail

LATEST_BUILT_TAG=$(git describe --tags --match foo-service-* --abbrev=0)
git diff --name-only "$LATEST_TAG"

interpolation (optional)

This controls the pipeline interpolation on upload, and defaults to true. If set to false it adds --no-interpolation to the buildkite pipeline upload, to avoid trying to interpolate the commit message, which can cause failures.

watch

Declare a list of

- path: app/cms/
  config: # Required [trigger step configuration]
    trigger: cms-deploy # Required [trigger pipeline slug]
- path:
    - services/email
    - assets/images/email
  config:
    trigger: email-deploy

path

If the path specified here in the appears in the diff output, a trigger step will be added to the dynamically generated pipeline.yaml

A list of paths can be provided to trigger the desired pipeline. Changes in any of the paths will initiate the pipeline provided in trigger.

config

Configuration supports 2 different step types.

Trigger

The configuration for the trigger step https://buildkite.com/docs/pipelines/trigger-step

By default, it will pass the following values to the build attributes unless an alternative values are provided

- path: app/cms/
  config:
    trigger: cms-deploy
    build:
      commit: $BUILDKITE_COMMIT
      branch: $BUILDKITE_BRANCH

wait (optional)

Default: true

By setting wait to true, the build will wait until the triggered pipeline builds are successful before proceeding

hooks (optional)

Currently supports a list of commands you wish to execute after the watched pipelines have been triggered

hooks:
  - command: upload unit tests reports
  - command: echo success

Command

- path: app/cms/
  config:
    command: "netlify --production deploy"
    label: ":netlify: Deploy to production"
    agents:
      queue: "deploy"
    env:
      FOO: bar

There is currently limited support for command configuration. Only the command property can be provided at this point in time.

Using commands, it is also possible to use this to upload other pipeline definitions

- path: frontend/
  config:
    command: "buildkite-agent pipeline upload ./frontend/.buildkite/pipeline.yaml"
- path: infrastructure/
  config:
    command: "buildkite-agent pipeline upload ./infrastructure/.buildkite/pipeline.yaml"
- path: backend/
  config:
    command: "buildkite-agent pipeline upload ./backend/.buildkite/pipeline.yaml"

Environment

DEBUG (optional)

By turning DEBUG on, the generated pipeline will be displayed prior to upload

steps:
  - label: "Triggering pipelines"
    env:
      DEBUG: true
    plugins:
      - chronotc/monorepo-diff:
          diff: "git diff --name-only HEAD~1"
          watch:
            - path: "foo-service/"
              config:
                trigger: "deploy-foo-service"

References

https://stackoverflow.com/questions/1527234/finding-a-branch-point-with-git

Contribute

To run tests

Ensure that all tests are in the ./tests

docker-compose run --rm tests

To run lint

docker-compose run --rm lint

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].