-
Notifications
You must be signed in to change notification settings - Fork 153
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
Changes to binary distribution #6542
Conversation
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
} | ||
|
||
// SpecsForFlavor returns spec files associated with specific flavor | ||
func SpecsForFlavor(flavor FlavorDefinition) ([]string, error) { |
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.
This function always returns nil
as error, is the error needed?
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.
leftover from previous design, thanks for pointing it out
|
||
// fix versionedHome | ||
versionedHome = strings.ReplaceAll(versionedHome, "\\", "/") | ||
log.Errorf("using %q", versionedHome) |
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.
Is this needed? It's not an error, right?
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.
it's not an error, this is because zip on windows are using unix paths 🤦
Co-authored-by: Andrzej Stencel <[email protected]>
…agent into feat/binary-distr
Manually testing this this and it works so far:
Things that still need to be tested:
|
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.
No big comments mostly nits.
I wonder if you can use the "upgrade to same commit" test to add a basic test of upgrading from an agent installed with a flavor to another one installed with the same flavor to make sure the unpacking logic works properly.
t.Run(fmt.Sprintf("Upgrade on a repackaged version of agent %s (%s)", currentVersion, unPrivilegedString), func(t *testing.T) { |
@cmacknz i did not want to add same commit upgrade as it may not uncover some issues e.g if there are leftovers from servers install and only basic is applied. but test would evaluate properly. i will add tests once we have snapshot. |
Quality Gate passedIssues Measures |
As long as you tested this manually I'm fine added a separate test once a snapshot exists as a follow up. |
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, it works and the only comments are nits. Make sure this is followed up with an integration test for an upgrade from a basic->basic flavor and servers->servers flavor.
Also address any outstanding comments from others before merge if you haven't already.
|
||
"github.com/elastic/go-ucfg/yaml" | ||
|
||
yamlv3 "gopkg.in/yaml.v3" |
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.
nit: we are using both github.com/elastic/go-ucfg/yaml
and gopkg.in/yaml.v3
at the same time
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.
i wanted to reduce ucfg step. and keeping ucfg one for NewConfigFrom use cases i don't want to address in this PR if that makes sense.
otherwise insteadn of unmarshal it would be
unmarshal -> ucfg.NewFrom -> Unpack
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.
If it's not trivial to address I'm fine just leaving it as is
elastic/beats#42348 |
We also need to test that the spec file changes to include additional files for every integration work correctly. We have an integration test that installs defend but nothing for osquery or apm server (those are the ones I remember off the top of my head). |
Follow up testing work captured into #6631 so we don't forget. |
What does this PR do?
This PR changes logic of installation and ugprades in following manner.
Default
install
installs only:additional flag is added that includes components above and:
Upon installation user choice is backed into
.flavor
file.Part of elastic agent package is
.flavors
file defining flavor for this particular version.Upon upgrade or install
.flavors
is read and only components specified in desired flavor (using flag withinstall
or content of.flavor
in case ofupgrade
) are copied.In case of any issues with parsing any of the above files we fall back to previous way and copy everything.
Each components needs to define files in addition to binary, spec and config in a form
in their spec file.
During upgrade target version spec file is parsed. not the current installation.
Why is it important?
Reducing space on disk by omitting not needed components.
Checklist
./changelog/fragments
using the changelog toolHow to test this PR locally
Scenario 1 and 2 (installation)
Build package and install without and with flag
--install-server
check components present
Scenario 3 - upgrade to future version
Prepare same agent but with different commit hash (do small change and commit locally)
Run
upgrade 9.0.0-SNAPSHOT --source-uri="file://....zip" --skip-verify
and check only desired components are presentScenario 4 - upgrade from stale version
Upgrade from previous version to this one and check ALL components are present