jwplayer / buildpipe-buildkite-plugin

:shipit: Dynamically generate Buildkite pipelines based on project changes
Apache License 2.0
94 stars 24 forks source link

Defining dependencies between projects? #72

Open evandam opened 4 years ago

evandam commented 4 years ago

Hey there 👋

This looks like an awesome project but I was hoping to get some clarification.

You mention "Especially useful for monorepos where you want to create dependencies between projects." Is there an example that shows how to define dependencies between projects? I can't find docs around this anywhere.

If it helps, here's the use case I have in mind. I'm looking to do Packer builds, where if I change the base image, I want to trigger all subsequent builds:

Ex:

└── packer
    ├── golang
    ├── node
    ├── python
    ├── ruby
    └── ubuntu

I would like the language-specific images to have a dependency on the ubuntu build, so if I update the base image, all the others will be updated.

Similarly, I might want to do something like run tests on all projects in the monorepo if a shared library changes.

ksindi commented 4 years ago

Hi @evandam! Check out https://github.com/ksindi/buildkite-monorepo-example for a working example.

ksindi commented 4 years ago

You can definitely set ubuntu as a dependency for the other projects by adding it to their paths.

bradbarrow commented 3 years ago

Hi friends,

I trust there's no way to be more granular about this dependency on a per step basis?

e.g. In this example, app depends on some packages

root/
  app/
  packages/

Tests My app depends on packages so I want to run tests on both when packages change.

Linting Changing packages doesn't affect the source code of app so I don't want to lint app

--

The current config method for defining buildpipe dependencies is the paths:

projects:
  - label: App
    path:
      - root/app
      - root/packages
  - label: Packages
    path: root/packages

steps:
  - label: 'Test'
    env:
      BUILDPIPE_SCOPE: project
    command:
      - cd $$BUILDPIPE_PROJECT_PATH
      - yarn run test
  - label: 'Lint'
    env:
      BUILDPIPE_SCOPE: project
    command:
      - cd $$BUILDPIPE_PROJECT_PATH
      - yarn run lint

But in this case, changing code in packages will cause app to be linted.

ksindi commented 3 years ago

@bradbarrow unfortunately there's no easy way. The most you can probably do is have custom logic on the step that inspects environment variables set.