-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add a mage target that packages elastic-agent using elastic-agent-core DRA #4403
Conversation
This pull request does not have a backport label. Could you fix it @pchila? 🙏
NOTE: |
62ecfea
to
137f9c6
Compare
2731879
to
ca8aa74
Compare
2ecfcc0
to
354e2d7
Compare
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Love all the added verbose logging, btw.
buildkite package this |
1 similar comment
buildkite package this |
changelog/fragments/1710863577-Add-mage-target-to-package-elastic-agent-using-DRAs.yaml
Outdated
Show resolved
Hide resolved
a518031
to
2e294bb
Compare
This commit fixes the major.minor.patch version for the dependencies base on the version declared in manifest. This makes packageUsingDRA target independent on the actual branch it's called from.
3230d4a
to
3ff4616
Compare
Verified the MacOS artifact works now. Thanks! When we merge this, it is going to make it so that snapshots and build candidates depend on the output of the elastic-agent-binary-dra buildkite pipeline that produces the elastic-agent-core artifact. Looking at the pipeline https://buildkite.com/elastic/elastic-agent-binary-dra I don't think it runs often enough. Main seems to be on a daily schedule, and I'm not sure what triggers 8.13 as it is now several days behind the head of the 8.13 branch. It looks like this job only takes 5m most of the time, as part of this PR can we change this agent core DRA step to execute for every commit? It is cheap and that will avoid the situation where someone forgets to kick it manually for a build candidate. Looking at the buildkite pipeline definition it isn't obvious to me why it isn't already working this way for these branches. https://github.com/elastic/elastic-agent/blob/8.13/.buildkite/pipeline.elastic-agent-binary-dra.yml |
There's nothing in the pipeline definition that would limit the I think that the reason why we don't get a build out of every commit is that the option has not been selected on the pipeline Github configuration If we want to build on every commit on main and release branches I think we need to enable that option (not sure if we need to keep the schedule ?) I would like a second opinion from our eng-prod team before making any changes though... Edit: had an OOB chat with @alexsapran, in the end the most sensible thing seems to be having a scheduled buildkite job for each of the release branches. I will raise that modification in a separate PR and crossreference with this one. Edit2: switched to building branches, PR: #4550 |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
…e DRA (#4403) * Extract dependencies download to its own function * Add PackageUsingDRA mage target * filter elastic-agent-core artifacts by platform * update buildkite package script with packageUsingDRA target * Add sha512 validation for downloaded elastic-agent-core packages * Override the elastic agent commit hash when packaging using DRA * change Manifest URL env variable name (cherry picked from commit 87336db) # Conflicts: # dev-tools/mage/settings.go # magefile.go
…e DRA (#4403) * Extract dependencies download to its own function * Add PackageUsingDRA mage target * filter elastic-agent-core artifacts by platform * update buildkite package script with packageUsingDRA target * Add sha512 validation for downloaded elastic-agent-core packages * Override the elastic agent commit hash when packaging using DRA * change Manifest URL env variable name
…e DRA (#4403) * Extract dependencies download to its own function * Add PackageUsingDRA mage target * filter elastic-agent-core artifacts by platform * update buildkite package script with packageUsingDRA target * Add sha512 validation for downloaded elastic-agent-core packages * Override the elastic agent commit hash when packaging using DRA * change Manifest URL env variable name
…using elastic-agent-core DRA (#4589) * Add a mage target that packages elastic-agent using elastic-agent-core DRA (#4403) * Extract dependencies download to its own function * Add PackageUsingDRA mage target * filter elastic-agent-core artifacts by platform * update buildkite package script with packageUsingDRA target * Add sha512 validation for downloaded elastic-agent-core packages * Override the elastic agent commit hash when packaging using DRA * change Manifest URL env variable name --------- Co-authored-by: Paolo Chilà <[email protected]>
What does this PR do?
This PR adds 2 new mage targets:
ManifestURL
environment variable.This target assumes that downloadManifest has been called with the same manifest
The algorithm is pretty straightforward:
packageAgent
now receives an mg.F parameter to run as dependency to obtain the agent binaries:Package
target we passGolangCrossbuild
as the dependency to runPackageUsingDRA
we passmg.F(useDRAAgentBinaryForPackage, manifestUrl)
to retrieve the binaries from the elastic-agent-core DRA packages specified in the manifestThere is also some refactoring to break up the
packageAgent
function in more manageable pieces:collectPackageDependencies
andflattenDependencies
have been extracted from the original function body.Why is it important?
When repackaging agent for early releases we want to specify what agent binaries to use via the manifest instead of rebuilding from the HEAD of a give release branch.
Checklist
[ ] 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./changelog/fragments
using the changelog tool[ ] I have added an integration test or an E2E testAuthor's Checklist
How to test this PR locally
To test the packaging functionality we can run
mage packageUsingDRA
specifiying a manifest and a version, for example:The dependencies and agent binaries will be downloaded according to what is specified in the manifest and packages will be created with the correct package version in
build/distributions
To just fetch the agent-core binaries (useful for debugging scenarios) we call FetchLatestAgentCoreStagingDRA with a release branch as argument (we can have a look at what is available in the DRA report):
Related issues
Use cases
Screenshots
Logs
Questions to ask yourself