Git Product home page Git Product logo

trigger-pipeline-action's Introduction

Trigger Buildkite Pipeline GitHub Action

A GitHub Action for triggering a build on a Buildkite pipeline.

Features

  • Creates builds in Buildkite pipelines, setting commit, branch, message.
  • Provides the build JSON response and the build URL as outputs for downstream actions.

Usage

Create a Buildkite API Access Token with write_builds scope, and save it to your GitHub repository’s Settings → Secrets. Then you can configure your Actions workflow with the details of the pipeline to be triggered, and the settings for the build.

Configuration Options

Configuration as Input Parameters

The following workflow creates a new Buildkite build to the target pipeline on every commit.

on: [push]

steps:
  - name: Trigger a Buildkite Build
    uses: "buildkite/[email protected]"
    with:
      buildkite_api_access_token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }} 
      pipeline: "my-org/my-deploy-pipeline"
      branch: "master"
      commit: "HEAD"
      message:  ":github: Triggered from a GitHub Action"
      build_env_vars: '{"TRIGGERED_FROM_GHA": "true"}'
      build_meta_data: '{"FOO": "bar"}'
      ignore_pipeline_branch_filter: true     
      send_pull_request: true

Outputs

The following outputs are provided by the action:

Output var Description
url The URL of the Buildkite build.
json The JSON response returned by the Buildkite API.

Development

To run the test workflow, you use act which will run it just as it does on GitHub:

act -n

Testing

To run the tests locally, use the plugin tester (that has everything already installed) by running the Docker command

docker run --rm -ti -v "$PWD":/plugin buildkite/plugin-tester:v4.0.0

Contributing

  • Fork this repository
  • Create a new branch for your work
  • Push up any changes to your branch, and open a pull request. Don't feel it needs to be perfect — incomplete work is totally fine. We'd love to help get it ready for merging.

Releasing

  • Create a new GitHub release. The version numbers in the readme will be automatically updated.

Roadmap

  • Add a WAIT option for waiting for the Buildkite build to finish.
  • Support other properties available in the Buildkite Builds REST API, such as environment variables and meta-data.

Contributions welcome! ❤️

trigger-pipeline-action's People

Contributors

boomper-bot[bot] avatar can-anyscale avatar enricomi avatar fredr avatar james2791 avatar jeremy avatar jradtilbrook avatar karensawrey avatar lizrabuya avatar pauldthomson avatar raylu avatar ticky avatar toolmantim avatar toote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trigger-pipeline-action's Issues

Set output

It would be useful if you could set the output of the step so it could be accessed in subsequent steps (unfortunately, it doesn't look like you can access the json file across steps).

Document how to run test/entrypoint.bats

There is a useful looking test script in test/entrypoint.bats can you document how to run it? I have found the bats-core, bats-support and bats-assert projects but a quick walkthrough on how to set them up would be help a lot.

WAIT step

Hi folks, I can see adding WAIT functionality is on your roadmap. Do you have any idea on when that might be available?

In lieu of that I guess I could do some polling to see when the build is done?

Add support to conditionally skip triggered pipelines

Hey BK team, I have the need to create a pipeline trigger that is only called if a specific requirement is met. In my case, if a specific file was changed. I can see this pattern surge as people make their pipelines more and more dynamic.

I was thinking on something like:

steps:
  - trigger: "<trigger-name>"
    label: "Trigger <trigger-name>"
    skip_command: ./check-specific-file-was-changed.sh

If the command return 0, the trigger should be executed. Otherwise skip.

What do you all think? Cheers!

Action exits with failure even if pipeline completes successfully

Hello!

I'm having trouble with this action. I set up a test repository with Buildkite GitHub App and as long as I use webhook - PR is marked green, pipeline passes on buildkite, all good.

However, when I try to use this action like so(changed org name):

name: Buildkite test

on:
  pull_request:

jobs:
  test-buildkite:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger Buildkite Pipeline
        uses: buildkite/[email protected]
        env:
          BUILDKITE_API_ACCESS_TOKEN: ${{ secrets.BUILDKITE_API_ACCESS_TOKEN }}
          PIPELINE: "karol-test-org/test-pipeline"

I can see my pipeline being completed successfully on Buildkite, but the action exits with error status and no further info.

Am I doing something wrong? And - is this action still maintained?

Cheers for your help!
Karol

README example needs updating.

Maybe I'm not understanding something here so I'm happy to be proven wrong, but it looks like the example we have here: https://github.com/buildkite/trigger-pipeline-action#configuration-as-input-parameters doesn't actually work.

There's a few things missing, such asjobs:, build: and runs-on:, as well as it seems you need to use - (hyphens) instead of the underscores and buildkite-token instead of buildkite_api_access_token.

I whipped up a working one below:

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Trigger a Buildkite Build
        uses: "buildkite/[email protected]"
        with:
          buildkite-token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }} 
          pipeline: "my-org/my-deploy-pipeline"
          branch: "main"
          commit: "HEAD"
          message:  ":github: Triggered from a GitHub Action"
          build-env-vars: '{"TRIGGERED_FROM_GHA": "true"}'
          build-meta-data: '{"FOO": "bar"}'
          ignore-pipeline-branch-filter: true   

Let me know if I'm missing something obvious.

More detailed docuementation?

Hi 🙂

The input parameters are not very well documented.
We don't know which are required and which are optional, whether they have default values, what their purpose is, etc.
Could you improve your documentation, please?

The action does not show API errors but silently exist

Currently the action does not provide any information on the cause of a failure. The API provides useful information but the action does not pass them to the user. This makes it very hard to identify the problem.

Issues #23 and #21 would benefit from such information.

PR #26 fixes this issue.

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.