Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

feat: support installing the agent with TAR installer and the install subcommand #378

Merged
merged 43 commits into from
Oct 21, 2020

Conversation

mdelapenya
Copy link
Contributor

@mdelapenya mdelapenya commented Oct 21, 2020

What does this PR do?

This PR adds the the TAR installer so that it's possible to install the agent from a TAR file. For that, we had to define a proper life cycle for agent commands (install, enroll), as depending on the installer type (RPM, DEB, TAR), the life cycle (preInstall > install > enroll > postInstall) depends on the installer:

preInstall:

  • TAR leverages preInstall phase to extract the TAR file and create the proper layout

install:

  • RPM and DEB leverage install phase to use package managers to install the artifact
  • TAR leverages install phase to actually install and enroll the agent

enroll:

  • RPM and DEP needs an extra enrollment call
  • TAR defines an enroll method to be used outside the life

postInstall:

  • RPM and DEB leverages postInstall phase to enable and run the service using systemd

This PR also refactors the scenarios (feature files) merging the subcommand feature file with Fleet one. In these files, and for the sake of a green CI build, we are removing any interaction with the RPM and DEB installers, because we prefer the TAR install process. We could at any time turn them back as Outline examples in Gherkin:

Examples:
| os     | installer |
| centos | tar       |
| centos | systemd   |
| debian | tar       |
| debian | systemd   |

We know that systemd is not an installer by itself, but it installs the elastic-agent service in Centos/Debian.

Why is it important?

The first main thing is that the PR matches the e2e tests code with the Elastic Agent way of installing the agent, which is critical. The second thing, the tests pass locally and we expect to fix the tests on CI too.

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
  • I have run the Unit tests for the CLI, and they are passing locally
  • I have run the End-2-End tests for the suite I'm working on, and they are passing locally
  • I have noticed new Go dependencies (run make notice in the proper directory)

How to test this PR locally

SUITE=fleet TAGS="fleet_mode" DEVELOPER_MODE=false TIMEOUT_FACTOR=3 LOG_LEVEL=TRACE make -C e2e functional-test

Related issues

Follow-ups

The test for uninstalling the agent is failing. Need to check. I pushed the PR to receive feedback from the team.

We could refactor the download of the agents and add it when installing the agent instead of at the beginning of the test suite. Why? Because we download them at that time to create a volume and mount it into the container, at startup. This is causing that, when running the tests in DEV mode (DEVELOPER_MODE=true) locally, where the services are not destroyed, docker-compose tries to reuse the service without recreating it (we are not using the --force-recreate option). Therefore, that installer is already there and could lead to unexpected errors because of garbage in the target container for the agent.

EricDavisX and others added 30 commits October 20, 2020 12:05
We refactored the installer install actions to delegate the execution to
the installer instead of running it in the tests.

We also added the new steps for the commands feature.
The life cycle (preInstall > install > enroll > postInstall) depends on
the installer:

- TAR leverages preInstall phase to extract the TAR file and create the
proper layout

- RPM and DEB leverage install phase to use package managers to install
the artifact
- TAR leverages install phase to actually install and enroll the agent

- RPM and DEP needs an extra enrollment call
- TAR defines an enroll method to be used outside the life cycle

- RPM and DEB leverages postInstall phase to enable and run the service
using systemd
@mdelapenya mdelapenya self-assigned this Oct 21, 2020
}
return nil
}
enrollFn := func(token string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

enroll is performed out of the box using install so this should not be necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you take a look, we are providing the enroll command for further usage in the re-enroll scenario. As defined in the life cycle (see PR description), we use install command to initial enroll, but enroll for following ones

@@ -1004,46 +1025,6 @@ func createDefaultHTTPRequest(url string) curl.HTTPRequest {
}
}

// createFleetPolicy() sends a POST request to Fleet creating a new test policy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are not creating the policy because of elastic/kibana#81236

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 21, 2020

🐛 Flaky test report

❕ There are test failures but not known flaky tests.

Test stats 🧪

Test Results
Failed 1
Passed 79
Skipped 10
Total 90

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 21, 2020

💔 Tests Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #378 updated]

  • Start Time: 2020-10-21T11:30:59.577+0000

  • Duration: 26 min 48 sec

Test stats 🧪

Test Results
Failed 1
Passed 79
Skipped 10
Total 90

Test errors 1

Expand to view the tests failures

  • Name: Initializing / End-To-End Tests / fleet_agent_endpoint_integration / Changing an Agent policy is reflected in the Security App – Agent Endpoint Integration

    • Age: 6
    • Duration: 201.34187
    • Error Details: Step the policy will reflect the change in the Security App: No endpoint-security events where found for the agent in the f789faa0-1392-11eb-a08d-919c1a41f5a2 policy

Steps errors 3

Expand to view the steps failures

  • Name: Run functional tests for fleet:agent_endpoint_integration

    • Description:

    • Duration: 15 min 5 sec

    • Start Time: 2020-10-21T11:36:36.379+0000

    • log

  • Name: Error signal

    • Description:

    • Duration: 0 min 0 sec

    • Start Time: 2020-10-21T11:51:41.819+0000

    • log

  • Name: General Build Step

    • Description: [2020-10-21T11:51:42.255Z] Archiving artifacts
      hudson.AbortException: script returned exit code 1

    • Duration: 0 min 0 sec

    • Start Time: 2020-10-21T11:51:42.251+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-10-21T11:55:05.321Z] time="2020-10-21T11:55:04Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:05.321Z] time="2020-10-21T11:55:04Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=57.854597639s hostname=18fc5e2645e2 isAgentInStatus=false retry=15 status=offline
[2020-10-21T11:55:07.233Z] time="2020-10-21T11:55:07Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:07.493Z] time="2020-10-21T11:55:07Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m0.403495913s hostname=18fc5e2645e2 isAgentInStatus=false retry=16 status=offline
[2020-10-21T11:55:10.057Z] time="2020-10-21T11:55:09Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:10.057Z] time="2020-10-21T11:55:09Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m2.96161754s hostname=18fc5e2645e2 isAgentInStatus=false retry=17 status=offline
[2020-10-21T11:55:18.253Z] time="2020-10-21T11:55:16Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:18.253Z] time="2020-10-21T11:55:16Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m10.074460598s hostname=18fc5e2645e2 isAgentInStatus=false retry=18 status=offline
[2020-10-21T11:55:22.459Z] time="2020-10-21T11:55:22Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:22.459Z] time="2020-10-21T11:55:22Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m15.590339744s hostname=18fc5e2645e2 isAgentInStatus=false retry=19 status=offline
[2020-10-21T11:55:29.036Z] time="2020-10-21T11:55:27Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:29.036Z] time="2020-10-21T11:55:27Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m20.924777601s hostname=18fc5e2645e2 isAgentInStatus=false retry=20 status=offline
[2020-10-21T11:55:35.624Z] time="2020-10-21T11:55:34Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:35.624Z] time="2020-10-21T11:55:34Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m27.561120213s hostname=18fc5e2645e2 isAgentInStatus=false retry=21 status=offline
[2020-10-21T11:55:42.198Z] time="2020-10-21T11:55:41Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:42.198Z] time="2020-10-21T11:55:41Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m34.485579346s hostname=18fc5e2645e2 isAgentInStatus=false retry=22 status=offline
[2020-10-21T11:55:46.409Z] time="2020-10-21T11:55:46Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:46.409Z] time="2020-10-21T11:55:46Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m39.347641405s hostname=18fc5e2645e2 isAgentInStatus=false retry=23 status=offline
[2020-10-21T11:55:52.988Z] time="2020-10-21T11:55:51Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:52.989Z] time="2020-10-21T11:55:51Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m44.897053333s hostname=18fc5e2645e2 isAgentInStatus=false retry=24 status=offline
[2020-10-21T11:55:54.897Z] time="2020-10-21T11:55:54Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:55:54.897Z] time="2020-10-21T11:55:54Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m47.572257062s hostname=18fc5e2645e2 isAgentInStatus=false retry=25 status=offline
[2020-10-21T11:56:01.476Z] time="2020-10-21T11:56:01Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:01.476Z] time="2020-10-21T11:56:01Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m54.34909085s hostname=18fc5e2645e2 isAgentInStatus=false retry=26 status=offline
[2020-10-21T11:56:05.673Z] time="2020-10-21T11:56:04Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:05.673Z] time="2020-10-21T11:56:04Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=1m58.134152835s hostname=18fc5e2645e2 isAgentInStatus=false retry=27 status=offline
[2020-10-21T11:56:10.954Z] time="2020-10-21T11:56:10Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:10.954Z] time="2020-10-21T11:56:10Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=2m3.878577632s hostname=18fc5e2645e2 isAgentInStatus=false retry=28 status=offline
[2020-10-21T11:56:15.161Z] time="2020-10-21T11:56:14Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:15.161Z] time="2020-10-21T11:56:14Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=2m7.647006285s hostname=18fc5e2645e2 isAgentInStatus=false retry=29 status=offline
[2020-10-21T11:56:18.467Z] time="2020-10-21T11:56:17Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:18.467Z] time="2020-10-21T11:56:17Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=2m11.057615903s hostname=18fc5e2645e2 isAgentInStatus=false retry=30 status=offline
[2020-10-21T11:56:23.750Z] time="2020-10-21T11:56:23Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:23.750Z] time="2020-10-21T11:56:23Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=2m16.56668954s hostname=18fc5e2645e2 isAgentInStatus=false retry=31 status=offline
[2020-10-21T11:56:30.322Z] time="2020-10-21T11:56:29Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:30.322Z] time="2020-10-21T11:56:30Z" level=warning msg="The Agent is not in the offline status yet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 elapsedTime=2m23.171824457s hostname=18fc5e2645e2 isAgentInStatus=false retry=32 status=offline
[2020-10-21T11:56:36.899Z] time="2020-10-21T11:56:35Z" level=debug msg="Agent listed in Fleet with online status" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:36.899Z] time="2020-10-21T11:56:36Z" level=info msg="The Agent is in the desired status" elapsedTime=2m29.176896726s hostname=18fc5e2645e2 isAgentInStatus=true retries=33 status=offline
[2020-10-21T11:56:36.899Z] time="2020-10-21T11:56:36Z" level=debug msg="Agent build hash found" commitFile=/elastic-agent/.elastic-agent.active.commit containerName=18fc5e2645e2 hash=6955665227cb13504c52a01d3cbccd0a28c7ed9e shortHash=695566
[2020-10-21T11:56:36.899Z] cat: /opt/Elastic/Agent/data/elastic-agent-695566/logs/elastic-agent.log: No such file or directory
[2020-10-21T11:56:37.173Z] time="2020-10-21T11:56:37Z" level=error msg="Could not execute command in container" command="[cat /opt/Elastic/Agent/data/elastic-agent-695566/logs/elastic-agent.log]" error="Could not run compose file: [/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/profiles/fleet/docker-compose.yml /var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/services/debian-systemd/docker-compose.yml] - Local Docker compose exited abnormally whilst running docker-compose: [exec -T debian-systemd cat /opt/Elastic/Agent/data/elastic-agent-695566/logs/elastic-agent.log]. exit status 1" service=debian-systemd
[2020-10-21T11:56:37.173Z] time="2020-10-21T11:56:37Z" level=error msg="Could not get agent logs in the container" command="[cat /opt/Elastic/Agent/data/elastic-agent-695566/logs/elastic-agent.log]" containerName=18fc5e2645e2 error="Could not run compose file: [/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/profiles/fleet/docker-compose.yml /var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/services/debian-systemd/docker-compose.yml] - Local Docker compose exited abnormally whilst running docker-compose: [exec -T debian-systemd cat /opt/Elastic/Agent/data/elastic-agent-695566/logs/elastic-agent.log]. exit status 1" hash=695566
[2020-10-21T11:56:38.119Z] OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"elastic-agent\": executable file not found in $PATH": unknown
[2020-10-21T11:56:38.120Z] time="2020-10-21T11:56:37Z" level=error msg="Could not execute command in container" command="[elastic-agent uninstall -f]" error="Could not run compose file: [/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/profiles/fleet/docker-compose.yml /var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/services/debian-systemd/docker-compose.yml] - Local Docker compose exited abnormally whilst running docker-compose: [exec -T debian-systemd elastic-agent uninstall -f]. exit status 126" service=debian-systemd
[2020-10-21T11:56:38.120Z] time="2020-10-21T11:56:37Z" level=error msg="Could not run agent command in the box" command="[elastic-agent uninstall -f]" error="Could not run compose file: [/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/profiles/fleet/docker-compose.yml /var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/services/debian-systemd/docker-compose.yml] - Local Docker compose exited abnormally whilst running docker-compose: [exec -T debian-systemd elastic-agent uninstall -f]. exit status 126" profile=fleet service=debian-systemd
[2020-10-21T11:56:38.120Z] time="2020-10-21T11:56:37Z" level=error msg="Could not uninstall the agent"
[2020-10-21T11:56:38.120Z] time="2020-10-21T11:56:37Z" level=debug msg="Un-enrolling agent in Fleet" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465 hostname=18fc5e2645e2
[2020-10-21T11:56:40.029Z] time="2020-10-21T11:56:39Z" level=debug msg="Fleet agent was unenrolled" agentID=84719529-7e2f-4c5f-9897-3e8f7128b465
[2020-10-21T11:56:40.288Z] Stopping fleet_debian-systemd_elastic-agent_1 ... 
[2020-10-21T11:56:40.883Z] 
Stopping fleet_debian-systemd_elastic-agent_1 ... done
Removing fleet_debian-systemd_elastic-agent_1 ... 
[2020-10-21T11:56:41.157Z] 
Removing fleet_debian-systemd_elastic-agent_1 ... done
Going to remove fleet_debian-systemd_elastic-agent_1
[2020-10-21T11:56:41.157Z] time="2020-10-21T11:56:41Z" level=debug msg="Docker compose executed." cmd="[rm -fvs debian-systemd]" composeFilePaths="[/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/profiles/fleet/docker-compose.yml /var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/services/debian-systemd/docker-compose.yml]" env="map[centos_systemdAgentBinarySrcPath:/tmp/elastic-agent-8.0.0-SNAPSHOT-linux-x86_64.tar.gz946789722 centos_systemdAgentBinaryTargetPath:/elastic-agent-8.0.0-SNAPSHOT-x86_64.tar.gz centos_systemdContainerName:fleet_centos-systemd_elastic-agent_1 centos_systemdTag:latest debian_systemdAgentBinarySrcPath:/tmp/elastic-agent-8.0.0-SNAPSHOT-linux-x86_64.tar.gz946789722 debian_systemdAgentBinaryTargetPath:/elastic-agent-8.0.0-SNAPSHOT-x86_64.tar.gz debian_systemdContainerName:fleet_debian-systemd_elastic-agent_1 debian_systemdTag:stretch kibanaConfigPath:/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/src/github.com/elastic/e2e-testing/e2e/_suites/fleet/configurations/kibana.config.yml stackVersion:8.0.0-SNAPSHOT]" profile=fleet
[2020-10-21T11:56:41.157Z] time="2020-10-21T11:56:41Z" level=debug msg="Service removed from compose" profile=fleet service=debian-systemd
[2020-10-21T11:56:43.065Z] time="2020-10-21T11:56:42Z" level=debug msg="The token was deleted" tokenID=5b61fb80-ec89-4050-9ebe-4dea83d7e7d2
[2020-10-21T11:56:43.065Z] time="2020-10-21T11:56:42Z" level=info msg="Integration deleted from the configuration" integration= packageConfigId= policyID=0a8407f0-1392-11eb-a1df-4b810652526e version=
[2020-10-21T11:56:43.065Z] time="2020-10-21T11:56:42Z" level=debug msg="Destroying Fleet runtime dependencies"
[2020-10-21T11:56:43.326Z] Stopping fleet_kibana_1           ... 
[2020-10-21T11:56:43.326Z] Stopping fleet_package-registry_1 ... 
[2020-10-21T11:56:43.326Z] Stopping fleet_elasticsearch_1    ... 
[2020-10-21T11:56:44.754Z] 
Stopping fleet_kibana_1           ... done

Stopping fleet_package-registry_1 ... done

Stopping fleet_elasticsearch_1    ... done
Removing fleet_kibana_1           ... 
[2020-10-21T11:56:44.755Z] Removing fleet_package-registry_1 ... 
[2020-10-21T11:56:44.755Z] Removing fleet_elasticsearch_1    ... 
[2020-10-21T11:56:44.755Z] 
Removing fleet_package-registry_1 ... done

Removing fleet_kibana_1           ... done

Removing fleet_elasticsearch_1    ... done
Removing network fleet_default
[2020-10-21T11:56:45.013Z] time="2020-10-21T11:56:44Z" level=debug msg="Docker compose executed." cmd="[down]" composeFilePaths="[/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/.op/compose/profiles/fleet/docker-compose.yml]" env="map[centos_systemdAgentBinarySrcPath:/tmp/elastic-agent-8.0.0-SNAPSHOT-linux-x86_64.tar.gz946789722 centos_systemdAgentBinaryTargetPath:/elastic-agent-8.0.0-SNAPSHOT-x86_64.tar.gz centos_systemdContainerName:fleet_centos-systemd_elastic-agent_1 centos_systemdTag:latest debian_systemdAgentBinarySrcPath:/tmp/elastic-agent-8.0.0-SNAPSHOT-linux-x86_64.tar.gz946789722 debian_systemdAgentBinaryTargetPath:/elastic-agent-8.0.0-SNAPSHOT-x86_64.tar.gz debian_systemdContainerName:fleet_debian-systemd_elastic-agent_1 debian_systemdTag:stretch kibanaConfigPath:/var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378/src/github.com/elastic/e2e-testing/e2e/_suites/fleet/configurations/kibana.config.yml stackVersion:8.0.0-SNAPSHOT]" profile=fleet
[2020-10-21T11:56:45.013Z] time="2020-10-21T11:56:44Z" level=debug msg="Elastic Agent binary was removed." installer=debian-systemd path=/tmp/elastic-agent-8.0.0-SNAPSHOT-amd64.deb739562225
[2020-10-21T11:56:45.013Z] time="2020-10-21T11:56:44Z" level=debug msg="Elastic Agent binary was removed." installer=debian-tar path=/tmp/elastic-agent-8.0.0-SNAPSHOT-linux-x86_64.tar.gz946789722
[2020-10-21T11:56:45.013Z] time="2020-10-21T11:56:44Z" level=debug msg="Elastic Agent binary was removed." installer=centos-systemd path=/tmp/elastic-agent-8.0.0-SNAPSHOT-x86_64.rpm614837287
[2020-10-21T11:56:45.013Z] <?xml version="1.0" encoding="UTF-8"?>
[2020-10-21T11:56:45.013Z] <testsuites name="main" tests="16" skipped="0" failures="0" errors="0" time="1171.93577788">
[2020-10-21T11:56:45.013Z]   <testsuite name="Fleet Mode Agent" tests="16" skipped="0" failures="0" errors="0" time="1026.842409433">
[2020-10-21T11:56:45.013Z]     <testcase name="Deploying the centos agent" status="passed" time="40.314504415"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Deploying the debian agent" status="passed" time="44.682346694"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Stopping the centos agent stops backend processes" status="passed" time="11.082387749"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Stopping the debian agent stops backend processes" status="passed" time="10.662218809"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Restarting the installed centos agent" status="passed" time="38.63115383"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Restarting the installed debian agent" status="passed" time="24.295235145"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Restarting the centos host with persistent agent restarts backend processes" status="passed" time="24.449970587"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Restarting the debian host with persistent agent restarts backend processes" status="passed" time="23.149952438"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Un-enrolling the centos agent" status="passed" time="12.71811285"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Un-enrolling the debian agent" status="passed" time="12.224082075"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Re-enrolling the centos agent" status="passed" time="42.23612954"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Re-enrolling the debian agent" status="passed" time="41.568768871"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Revoking the enrollment token for the centos agent" status="passed" time="31.235094545"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Revoking the enrollment token for the debian agent" status="passed" time="20.493140953"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Un-installing the installed centos agent" status="passed" time="159.522818916"></testcase>
[2020-10-21T11:56:45.013Z]     <testcase name="Un-installing the installed debian agent" status="passed" time="162.522503199"></testcase>
[2020-10-21T11:56:45.013Z]   </testsuite>
[2020-10-21T11:56:45.013Z] </testsuites>+ sed -e 's/^[ \t]*//; s#>.*failed$#>#g' outputs/TEST-fleet-fleet_mode
[2020-10-21T11:56:45.013Z] + grep -E '^<.*>$'
[2020-10-21T11:56:45.013Z] + exit 0
[2020-10-21T11:56:45.065Z] Recording test results
[2020-10-21T11:56:45.513Z] Archiving artifacts
[2020-10-21T11:56:46.815Z] Stage "Release" skipped due to earlier failure(s)
[2020-10-21T11:56:47.466Z] Running on worker-1244230 in /var/lib/jenkins/workspace/e2e-tests_e2e-testing-mbp_PR-378
[2020-10-21T11:56:47.506Z] [INFO] getVaultSecret: Getting secrets
[2020-10-21T11:56:47.557Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-10-21T11:56:49.409Z] + chmod 755 generate-build-data.sh
[2020-10-21T11:56:49.409Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/e2e-tests/e2e-testing-mbp/PR-378/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/e2e-tests/e2e-testing-mbp/PR-378/runs/6 FAILURE 1548449
[2020-10-21T11:56:49.409Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/e2e-tests/e2e-testing-mbp/PR-378/runs/6/steps/?limit=10000 -o steps-info.json
[2020-10-21T11:56:54.607Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/e2e-tests/e2e-testing-mbp/PR-378/runs/6/tests/?status=FAILED -o tests-errors.json

@@ -94,7 +94,7 @@ Scenario Outline: Un-installing the installed <os> agent
And the "filebeat" process is in the "stopped" state on the host
And the "metricbeat" process is in the "stopped" state on the host
And the file system Agent folder is empty
And the agent is listed in Fleet as "inactive"
And the agent is listed in Fleet as "offline"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It takes +2 minutes in reaching the offline status. Is that correct?

Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

change LGTM

@mdelapenya mdelapenya marked this pull request as ready for review October 21, 2020 11:43
@mdelapenya mdelapenya merged commit 093fc9e into elastic:master Oct 21, 2020
@mdelapenya mdelapenya deleted the 326-elastic-agent-subcommands branch October 21, 2020 13:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet / Agent ] support install / uninstall command from Agent
5 participants