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

[Ingest Manager] Upgrade Agents in Fleet #78810

Merged
merged 24 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
623ed8b
add kibanaVersion context and hook, add upgrade available indications
neptunian Sep 23, 2020
d77784b
add agent upgrade modals and action buttons
neptunian Sep 24, 2020
d0c1c9e
fix import
neptunian Sep 24, 2020
951dc39
add bulk actions api and remove source_uri as required
neptunian Sep 29, 2020
072f456
add upgrading to AgentHealth status
neptunian Sep 29, 2020
301edb7
buildKueryForUpgradingAgents
neptunian Sep 29, 2020
d831ec5
bulk actions UI
neptunian Sep 29, 2020
09bb711
remove source_uri
neptunian Sep 29, 2020
17520b1
add release type to agent details
neptunian Sep 29, 2020
4864503
don't allow upgrade of unenrolled/unenrolling agent
neptunian Sep 29, 2020
69fd965
hide upgradeable button when not upgradeable
neptunian Sep 29, 2020
107c427
fix test
neptunian Sep 29, 2020
203f195
add udpating agent status
neptunian Oct 1, 2020
782e90f
remove upgrade available filter button for now
neptunian Oct 1, 2020
44f330f
update isUpgradeAvailable to use local_metadata upgradeable
neptunian Oct 1, 2020
88bcc58
add UPDATING to agent event subtype
neptunian Oct 1, 2020
821b767
use saved object for updating agent status
neptunian Oct 1, 2020
5b08a92
add updating badge type label
neptunian Oct 1, 2020
18c762f
add upgrade available button and update agent list endpoint to accept…
neptunian Oct 1, 2020
a24f164
add schema and type for UPDATING
neptunian Oct 2, 2020
76b2ba6
fix type
neptunian Oct 2, 2020
8ce5091
dont try to upgrade local_metadata
neptunian Oct 2, 2020
3f5be5b
exclude from AAD upgrade_started_at and upgraded_at
neptunian Oct 2, 2020
ad4a186
Merge branch 'master' into 68310-upgrade-agents
kibanamachine Oct 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test
  • Loading branch information
neptunian committed Oct 2, 2020
commit 107c427007f79c585e89ee8c73ffd26c6d791d78
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export function isAgentUpgradeable(agent: Agent, kibanaVersion: string) {
}
const kibanaVersionParsed = semver.parse(kibanaVersion);
const agentVersionParsed = semver.parse(agentVersion);
if (!agentVersionParsed || !kibanaVersionParsed) throw new Error('version cannot be parsed');
if (!agentVersionParsed || !kibanaVersionParsed) return false;
return semver.lt(agentVersionParsed, kibanaVersionParsed);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ export default function (providerContext: FtrProviderContext) {
describe('fleet upgrade agent', () => {
skipIfNoDockerRegistry(providerContext);
setupIngest(providerContext);
const kibanaVersionAccessor = kibanaServer.version;
let kibanaVersion: any;
before(async () => {
await esArchiver.loadIfNeeded('fleet/agents');
kibanaVersion = await kibanaVersionAccessor.get();
});
beforeEach(async () => {
await esArchiver.loadIfNeeded('fleet/agents');
});
Expand All @@ -34,6 +28,7 @@ export default function (providerContext: FtrProviderContext) {
});

it('should respond 200 to upgrade agent and update the agent SO', async () => {
const kibanaVersion = await kibanaServer.version.get();
await supertest
.post(`/api/ingest_manager/fleet/agents/agent1/upgrade`)
.set('kbn-xsrf', 'xxx')
Expand All @@ -49,6 +44,7 @@ export default function (providerContext: FtrProviderContext) {
expect(typeof res.body.item.upgrade_started_at).to.be('string');
});
it('should respond 200 to upgrade agent and update the agent SO without source_uri', async () => {
const kibanaVersion = await kibanaServer.version.get();
await supertest
.post(`/api/ingest_manager/fleet/agents/agent1/upgrade`)
.set('kbn-xsrf', 'xxx')
Expand All @@ -63,6 +59,7 @@ export default function (providerContext: FtrProviderContext) {
});

it('should respond 400 if trying to upgrade to a version that does not match installed kibana version', async () => {
const kibanaVersion = await kibanaServer.version.get();
const higherVersion = semver.inc(kibanaVersion, 'patch');
await supertest
.post(`/api/ingest_manager/fleet/agents/agent1/upgrade`)
Expand All @@ -74,6 +71,7 @@ export default function (providerContext: FtrProviderContext) {
.expect(400);
});
it('should respond 400 if trying to upgrade an agent that is unenrolling', async () => {
const kibanaVersion = await kibanaServer.version.get();
await supertest
.post(`/api/ingest_manager/fleet/agents/agent1/unenroll`)
.set('kbn-xsrf', 'xxx')
Expand All @@ -89,6 +87,7 @@ export default function (providerContext: FtrProviderContext) {
.expect(400);
});
it('should respond 400 if trying to upgrade an agent that is unenrolled', async () => {
const kibanaVersion = await kibanaServer.version.get();
await kibanaServer.savedObjects.update({
id: 'agent1',
type: AGENT_SAVED_OBJECT_TYPE,
Expand All @@ -104,6 +103,7 @@ export default function (providerContext: FtrProviderContext) {
});

it('should respond 200 to bulk upgrade agents and update the agent SOs', async () => {
const kibanaVersion = await kibanaServer.version.get();
await supertest
.post(`/api/ingest_manager/fleet/agents/bulk_upgrade`)
.set('kbn-xsrf', 'xxx')
Expand All @@ -122,6 +122,7 @@ export default function (providerContext: FtrProviderContext) {
});

it('should allow to upgrade multiple agents by kuery', async () => {
const kibanaVersion = await kibanaServer.version.get();
await supertest
.post(`/api/ingest_manager/fleet/agents/bulk_upgrade`)
.set('kbn-xsrf', 'xxx')
Expand All @@ -139,6 +140,7 @@ export default function (providerContext: FtrProviderContext) {
});

it('should not upgrade an unenrolling agent during bulk_upgrade', async () => {
const kibanaVersion = await kibanaServer.version.get();
await supertest
.post(`/api/ingest_manager/fleet/agents/agent1/unenroll`)
.set('kbn-xsrf', 'xxx')
Expand All @@ -160,6 +162,7 @@ export default function (providerContext: FtrProviderContext) {
expect(typeof agent2data.body.item.upgrade_started_at).to.be('string');
});
it('should not upgrade an unenrolled agent during bulk_upgrade', async () => {
const kibanaVersion = await kibanaServer.version.get();
kibanaServer.savedObjects.update({
id: 'agent1',
type: AGENT_SAVED_OBJECT_TYPE,
Expand Down