This GitHub Action downloads artifacts from a Buildkite pipeline that builds the respective commit.
The action picks up a Buildkite build from the commit status that is set by Buildkite integration with Github, which looks like this:
After termination of the Buildkite build, the action downloads finished artifacts into your GitHub workflow where you can use them in other steps and jobs.
You can add this action to your GitHub workflow for (e.g. runs-on: ubuntu-latest
) runners:
- name: Buildkite Artifacts
uses: EnricoMi/download-buildkite-artifact-action@v1
with:
buildkite_token: ${{ secrets.BUILDKITE_TOKEN }}
output_path: artifacts
Use this for (e.g. runs-on: macos-latest
)
and (e.g. runs-on: windows-latest
) runners:
- name: Buildkite Artifacts
uses: EnricoMi/download-buildkite-artifact-action/composite@v1
with:
buildkite_token: ${{ secrets.BUILDKITE_TOKEN }}
output_path: artifacts
You can trigger a Buildkite build with the buildkite/trigger-pipeline-action action and then download the artifacts from that build:
steps:
- name: Trigger Buildkite Pipeline
id: build
uses: buildkite/[email protected]
env:
PIPELINE: "<org-slug>/<pipeline-slug>"
BUILDKITE_API_ACCESS_TOKEN: ${{ secrets.BUILDKITE_TOKEN }}
- name: Download Buildkite Artifacts
uses: EnricoMi/download-buildkite-artifact-action@v1
with:
buildkite_token: ${{ secrets.BUILDKITE_TOKEN }}
buildkite_build_url: ${{ steps.build.outputs.url }}
ignore_build_states: blocked,canceled,skipped,not_run
ignore_job_states: timed_out,failed
output_path: artifacts
It is generally good practice to restrict permissions for actions in your workflows and jobs to the required minimum.
When buildkite_build_url
is provided, no permissions are needed by this action at all:
permissions: {}
When buildkite_build_url
is not provided, the action picks up any Buildkite check created by
Buildkite integration with Github.
Then, the following permissions are required:
permissions:
metadata: read
contents: read
statuses: read
The output_path
and log_level
variables are optional. Their default values are .
(current directory) and INFO
, respectively. The Python logging module defines the available log levels.
You have to provide a Buildkite API Access Token via buildkite_token
to be stored in your GitHub secrets.
This Buildkite token requires read_artifacts
and read_builds
scopes:
Artifacts are stored under the following path: {output_path}/{job_name}/{artifact_path}
output_path
is a configured above or defaults to the current directory.job_name
avoids conflicts between artifacts that have the same artifact_path
in different jobs.artifact_path
is the path and filename for the artifact as displayed on the Buildkite build page:The action provides the following outputs:
output | description |
---|---|
build-number |
The number of the Buildkite build |
build-state |
The state of the Buildkite build: passed , failed , blocked , canceled , skipped , not_run
|
download-state |
The outcome of downloading artifacts: skipped , success , failure
|
download-paths |
The paths of the downloaded artifacts as a Json array of strings |
download-files |
The number of downloaded files |