Skip to content

Conversation

@AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Jan 19, 2023

What does it do?

1️⃣ Adds a buildkite_annotate action

Allows you to add a new annotation (providing a message, and an optional context and style), or delete an existing one, to/from the current CI build

if warnings.count > 0
  # Add a new annotation to surface e.g. some linter warnings using a nice markdown-formatted message
  markdown = "Linter found #{warnings.count} warnings: \n" + warnings.map { |msg, line| " - [#{msg}](\#L#{line}) }.join("\n")
  buildkite_annotate(context: 'lint-warnings', style: 'warning', message: markdown)
else
  # Remove an annotation with that given context if it exists (no-op if not)
  buildkite_annotate(context: 'lint-warnings', message: nil)
end

2️⃣ Adds a buildkite_metadata action

Allows you to set and get Buildkite metadata from the current CI build

buildkite_metadata(set: { key1: 'value1', key2: 'value2' })
buildkite_metadata(set: { 'version:name': version_name, 'version:code': version_code })
build_flavor = buildkite_metadata(get: 'flavor')

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations
  • Add Unit Tests (aka specs/*_spec.rb) if applicable
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the approprioate existing ### subsection of the existing ## Trunk section.

@AliSoftware AliSoftware self-assigned this Jan 19, 2023
@AliSoftware AliSoftware added the enhancement New feature or request label Jan 19, 2023
@AliSoftware AliSoftware requested review from a team and jkmassel and removed request for jkmassel January 19, 2023 20:03
@AliSoftware AliSoftware marked this pull request as ready for review January 19, 2023 20:03
Copy link
Contributor

@spencertransier spencertransier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These actions and tests look great! The test cases were really helpful for getting an idea of how the actions work. TIL what the term "ctx" refers to, I hadn't run into that before 🙂

Co-authored-by: Spencer Transier <[email protected]>
@AliSoftware AliSoftware merged commit 7526a1d into trunk Feb 1, 2023
@AliSoftware AliSoftware deleted the buildkite-actions branch February 1, 2023 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants