Skip to content
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

Fix debian packaging for upgrades #5260

Merged
merged 14 commits into from
Aug 13, 2024
Merged

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Aug 6, 2024

What does this PR do?

Fixes the debian packaging to properly copy the state.enc and state.yml files to the new version of the Elastic Agent.

Why is it important?

Without this upgrading to a new version of the Elastic Agent losses the state.enc and/or state.yml file.

Checklist

  • 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 (cannot add unit tests for packaging)
  • 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

None

How to test this PR locally

Build the debian package:

$ PLATFORMS="linux/amd64" PACKAGES="deb" SNAPSHOT="true" EXTERNAL="true" mage package

Install older version of Elastic Agent

sudo dpkg -D2 -i elastic-agent-8.14.3-amd64.deb

Enroll into Fleet

sudo elastic-agent enroll --url={url} --enrollment-token={token}

Upgrade to built version

sudo dpkg -D2 -i build/distributions/elastic-agent-8.16.0-SNAPSHOT-amd64.deb

Related issues

@blakerouse blakerouse added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-8.15 Automated backport to the 8.15 branch with mergify labels Aug 6, 2024
@blakerouse blakerouse self-assigned this Aug 6, 2024
@blakerouse blakerouse requested a review from a team as a code owner August 6, 2024 14:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@pierrehilbert
Copy link
Contributor

That was fast haha

@blakerouse
Copy link
Contributor Author

@pierrehilbert I said I had it ready, I just need to add an integration test. I also want to test this change with RPM's as well.

Copy link

@blakerouse
Copy link
Contributor Author

I am getting failures from flaky tests, no failures from DEB/RPM tests or the new upgrade tests. This is ready to be merged, but will need a force merge as the flaky tests have seem to become very consistent now.

@ycombinator
Copy link
Contributor

I am getting failures from flaky tests, no failures from DEB/RPM tests or the new upgrade tests. This is ready to be merged, but will need a force merge as the flaky tests have seem to become very consistent now.

The failing test is the same K8s test that has been failing for a while now: #5275. As such, I'm OK to force merge this PR here.

@ycombinator ycombinator merged commit 44528c4 into elastic:main Aug 13, 2024
10 of 13 checks passed
mergify bot pushed a commit that referenced this pull request Aug 13, 2024
* Fix upgrade to not delete symlink and to restart daemon.

* Fix upgrade.

* Add changelog.

* Add deb/rpm upgrade tests.

* Fix build tags.

* Fix typo in service name for systemctl enable.

* Fix issue in binaryPath() to work before install.

* Don't use extract for deb/rpm in tests.

* RHEL for RPM.

* Fix test issues.

* Fix deb/rpm upgrade tests.

* Fix imports.

(cherry picked from commit 44528c4)
@blakerouse blakerouse deleted the fix-deb-upgrade branch August 13, 2024 18:47
ycombinator pushed a commit that referenced this pull request Aug 14, 2024
* Fix upgrade to not delete symlink and to restart daemon.

* Fix upgrade.

* Add changelog.

* Add deb/rpm upgrade tests.

* Fix build tags.

* Fix typo in service name for systemctl enable.

* Fix issue in binaryPath() to work before install.

* Don't use extract for deb/rpm in tests.

* RHEL for RPM.

* Fix test issues.

* Fix deb/rpm upgrade tests.

* Fix imports.

(cherry picked from commit 44528c4)
ycombinator pushed a commit that referenced this pull request Aug 15, 2024
* Fix upgrade to not delete symlink and to restart daemon.

* Fix upgrade.

* Add changelog.

* Add deb/rpm upgrade tests.

* Fix build tags.

* Fix typo in service name for systemctl enable.

* Fix issue in binaryPath() to work before install.

* Don't use extract for deb/rpm in tests.

* RHEL for RPM.

* Fix test issues.

* Fix deb/rpm upgrade tests.

* Fix imports.

(cherry picked from commit 44528c4)

Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.15 Automated backport to the 8.15 branch with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent .deb install: state.enc not copied during Elastic Agent upgrade from 8.13 and above
6 participants