Skip to content

buildkite: run DRA if any changes #8552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

v1v
Copy link
Member

@v1v v1v commented Jun 17, 2025

What does this PR do?

  • Run the DRA pipelines when there are any changes in some of the files related to the DRA.
  • Replace DRY_RUN with a boolean instead of a string.
  • Run DRY_RUN without notifying on Slack.

Why is it important?

This should help with detecting breaking changes on a PR basis related to the packaging, see elastic/beats#44701 (comment).

It's also possible to run with some GH commands, see

"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:dra)\\W+(?:this|it))|^/dra$",

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

How to test this PR locally

In the CI only

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@v1v v1v self-assigned this Jun 17, 2025
@v1v v1v added skip-changelog backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches backport-8.19 Automated backport to the 8.19 branch labels Jun 17, 2025
@@ -167,6 +167,7 @@ steps:
env:
DRA_PROJECT_ID: "elastic-agent-package"
DRA_PROJECT_ARTIFACT_ID: "agent-package"
DRA_DRY_RUN: "true"
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the signature for the env variable value. Besides, let's avoid scripted env variables and use the env BK step scope instead.

WORKFLOW="${DRA_WORKFLOW:=""}"
COMMIT="${DRA_COMMIT:="${BUILDKITE_COMMIT:=""}"}"
BRANCH="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}"
PACKAGE_VERSION="${DRA_VERSION:="${BEAT_VERSION:=""}"}"
VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}"

# force main branch on PR's or it won't execute
Copy link
Member Author

Choose a reason for hiding this comment

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

I think we don't need this but BUILDKITE_BRANCH, and in our case, I use DRA_BRANCH=${BUILDKITE_PULL_REQUEST_BASE_BRANCH} in the .buildkite/pipeline.yml itself

BRANCH=main
DRY_RUN="--dry-run"
echo "+++ Running in PR and setting branch main and --dry-run"
if [[ "${DRA_DRY_RUN:="false"}" == "true" ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -159,7 +159,7 @@ metadata:
description: Buildkite pipeline for packaging Elastic Agent package
links:
- title: Pipeline
url: https://buildkite.com/elastic/elastic-agent
url: https://buildkite.com/elastic/elastic-agent-package
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes a typo

# don't run snapshot builds with prereleases (non empty VERSION_QUALIFIER) unless forced (RUN_SNAPSHOT=true)
if: build.env("RUN_SNAPSHOT") == "true" || (build.env('VERSION_QUALIFIER') == null && (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9x]+\$/))
if: (build.env("RUN_SNAPSHOT") == "true" || build.env('VERSION_QUALIFIER') == null)
Copy link
Member Author

Choose a reason for hiding this comment

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

Run always regardless of the branch.

@@ -26,7 +25,8 @@ function release_manager_login {
export VAULT_ADDR_SECRET VAULT_ROLE_ID_SECRET VAULT_SECRET
}

if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-package" ]]; then
# TODO: use the buildkite plugin to access the secrets
if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-package" || "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent" ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

Enable the elastic-agent BK pipeline to run the DRA also, otherwise the release_manager_login won't work. Hence the reason for adding the TODO, so we can remove this complex if conditions and use the declarative approach with the BK plugins in a follow-up.

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.19 Automated backport to the 8.19 branch backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants