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

[Elastic Agent] Add ability to re-exec agent #20111

Merged
merged 5 commits into from
Jul 28, 2020

Conversation

blakerouse
Copy link
Contributor

What does this PR do?

This adds the ability to re-exec Elastic Agent in the same PID and memory address space (on unix) and with in the same service on Windows (not same PID and address space).

This has been tested on Windows using SIGINT and Windows services, but the SIGINT catch is removed in the PR because it cannot be that way truly. Adding a way to perform this on Windows will occur in a follow up branch.

Why is it important?

This is one of the steps to self-upgrading the Elastic Agent. This will also be used to allow reloading of the Elastic Agent when a configuration change that does not automatically get applied through the reloader.

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 (very hard to unit test)
  • [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • Send signal SIGHUP to process will perform shutdown of the application and the re-exec itself.

How to test this PR locally

Start the elastic-agent then send SIGHUP.

$ ./elastic-agent run &
$ sleep 60
$ kill -HUP $!

@blakerouse blakerouse self-assigned this Jul 21, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 21, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 21, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 21, 2020

💔 Tests Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20111 updated]

  • Start Time: 2020-07-22T13:40:18.011+0000

  • Duration: 111 min 45 sec

Test stats 🧪

Test Results
Failed 16
Passed 14890
Skipped 1884
Total 16790

Test errors

Expand to view the tests failures

  • Name: Build and Test / Auditbeat x-pack / test_connected_udp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.122
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_connected_udp_ipv6 – test_system_socket.Test

    • Age: 1
    • Duration: 60.026
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_enrichment – test_system_socket.Test

    • Age: 1
    • Duration: 60.123
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_long_request – test_system_socket.Test

    • Age: 1
    • Duration: 60.046
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_udp_ipv6 – test_system_socket.Test

    • Age: 1
    • Duration: 60.033
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_dns_unidirectional_udp – test_system_socket.Test

    • Age: 1
    • Duration: 60.137
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_multi_udp_upv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.041
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_no_dns_enrichment – test_system_socket.Test

    • Age: 1
    • Duration: 60.033
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_tcp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.042
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_tcp_ipv6_disabled – test_system_socket.Test

    • Age: 1
    • Duration: 60.115
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_udp_ipv4 – test_system_socket.Test

    • Age: 1
    • Duration: 60.12
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_udp_ipv6 – test_system_socket.Test

    • Age: 1
    • Duration: 60.035
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Auditbeat x-pack / test_udp_ipv6_disabled – test_system_socket.Test

    • Age: 1
    • Duration: 60.032
    • Error Details: Expected exit code to be 0, but it was 1
  • Name: Build and Test / Filebeat x-pack / test_fileset_file_095_cylance – test_xpack_modules.XPackTest

    • Age: 1
    • Duration: 9.454
    • Error Details: The following expected object doesn't match:
      Diff:
      {'values_changed': {"root['@timestamp']": {'new_value': '2020-07-24T10:58:48.000Z', 'old_value': '2019-07-24T10:58:48.000Z'}, "root['rsa.time.event_time']": {'new_value': '2020-07-24T10:58:48.000Z', 'old_value': '2019-07-24T10:58:48.000Z'}}}, full object:
      {'rsa.internal.messageid': 'CylancePROTECT', 'rsa.identity.firstname': 'rinc', 'rsa.identity.lastname': 'tno', 'rsa.investigations.event_cat': 1609000000, 'rsa.investigations.event_cat_name': 'System.Alerts', 'rsa.time.event_time': '2020-07-24T10:58:48.000Z', 'rsa.db.index': 'rExce', 'rsa.misc.device_name': 'ncididu', 'rsa.misc.event_type': 'Alert', 'rsa.misc.mail_id': 'meumf', 'rsa.network.alias_host': ['squ2213.www.test'], 'log.offset': 24048, 'fileset.name': 'protect', 'tags': ['cylance.protect', 'forwarded'], 'observer.product': 'Protect', 'observer.vendor': 'Cylance', 'observer.type': 'Anti-Virus', 'input.type': 'log', '@timestamp': '2020-07-24T10:58:48.000Z', 'service.type': 'cylance', 'host.name': 'squ2213.www.test', 'event.original': '24-Jul-2019 8:58:48 very-high uiacon6640.api.localhost suntexpl <sBonoru 24T08:58:48.everi squ2213.www.test CylancePROTECT Event Name:Alert, Device Message: Device: ncididu; Zones Removed: itati; Zones Added: nostrude, User: rinc tno (meumf), Zone Names:rExce Device Id: quisquam', 'event.code': 'CylancePROTECT', 'event.module': 'cylance', 'event.action': 'Alert', 'event.dataset': 'cylance.protect'}
      -------------------- >> begin captured stdout << ---------------------
      Using elasticsearch: http://elasticsearch:9200
      Testing cylance/protect on /go/src/github.com/elastic/beats/x-pack/filebeat/module/cylance/protect/test/generated.log

--------------------- >> end captured stdout << ----------------------

  • Name: Build and Test / Metricbeat OSS Go Integration tests / TestFetchRedisInfo – redis

    • Age: 1
    • Duration: 18.11
    • Error Details: Failed
  • Name: Build and Test / Metricbeat OSS Go Integration tests / TestFetch – info

    • Age: 1
    • Duration: 19.12
    • Error Details: Failed

Steps errors

Expand to view the steps failures

  • Name: Mage build test

    • Description: mage build test

    • Duration: 8 min 27 sec

    • Start Time: 2020-07-22T14:04:18.256+0000

    • log

  • Name: Mage build test

    • Description: mage build test

    • Duration: 27 min 49 sec

    • Start Time: 2020-07-22T14:04:19.997+0000

    • log

  • Name: Mage update build test

    • Description: mage update build test

    • Duration: 20 min 16 sec

    • Start Time: 2020-07-22T14:04:19.026+0000

    • log

  • Name: Mage build test

    • Description: mage build test

    • Duration: 7 min 21 sec

    • Start Time: 2020-07-22T14:04:18.877+0000

    • log

  • Name: Mage goIntegTest

    • Description: mage goIntegTest

    • Duration: 43 min 39 sec

    • Start Time: 2020-07-22T14:04:25.214+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-22T15:30:10.880Z]  OS/Arch:           darwin/amd64
[2020-07-22T15:30:10.880Z]  Experimental:      false
[2020-07-22T15:30:10.880Z] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[2020-07-22T15:30:10.880Z] It requires Docker daemon to be installed and running
[2020-07-22T15:30:29.611Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats
[2020-07-22T15:30:29.926Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-22T15:30:29.940Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Lint
[2020-07-22T15:30:30.073Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-07-22T15:30:30.176Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-07-22T15:30:30.276Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Winlogbeat-oss
[2020-07-22T15:30:30.393Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Dockerlogbeat
[2020-07-22T15:30:30.515Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Journalbeat-oss
[2020-07-22T15:30:30.637Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-07-22T15:30:30.764Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-07-22T15:30:30.897Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-07-22T15:30:31.026Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Packetbeat-Linux
[2020-07-22T15:30:31.165Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-07-22T15:30:31.321Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Libbeat-oss
[2020-07-22T15:30:31.487Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Heartbeat-oss
[2020-07-22T15:30:31.617Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Filebeat-oss
[2020-07-22T15:30:31.778Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-07-22T15:30:31.933Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-07-22T15:30:32.056Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-07-22T15:30:32.210Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-07-22T15:30:32.345Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-07-22T15:30:32.556Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Libbeat-x-pack
[2020-07-22T15:30:32.773Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-07-22T15:30:33.007Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Filebeat-Windows
[2020-07-22T15:30:33.232Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-07-22T15:30:33.411Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-07-22T15:30:33.601Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-Windows
[2020-07-22T15:30:33.770Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-07-22T15:30:33.924Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-07-22T15:30:34.063Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-07-22T15:30:34.221Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Filebeat-x-pack
[2020-07-22T15:30:34.349Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-07-22T15:30:34.489Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-07-22T15:30:34.612Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-07-22T15:30:34.740Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-07-22T15:30:34.879Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-07-22T15:30:35.009Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Heartbeat-Mac-OS-X
[2020-07-22T15:30:35.142Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Packetbeat-Mac-OS-X
[2020-07-22T15:30:35.336Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-07-22T15:30:35.501Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Functionbeat-Mac-OS-X-x-pack
[2020-07-22T15:30:35.759Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-OSS-Python-Integration-tests
[2020-07-22T15:30:35.913Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests
[2020-07-22T15:30:36.079Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Heartbeat-Windows
[2020-07-22T15:30:36.227Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Packetbeat-Windows
[2020-07-22T15:30:36.477Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-07-22T15:30:36.667Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Functionbeat-Windows
[2020-07-22T15:30:36.812Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Generators-Metricbeat-Mac-OS-X
[2020-07-22T15:30:36.966Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Generators-Beat-Mac-OS-X
[2020-07-22T15:30:37.408Z] + cat
[2020-07-22T15:30:37.408Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-22T15:30:37.408Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-22T15:30:44.101Z] runbld>>> runbld started
[2020-07-22T15:30:44.101Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-22T15:30:45.494Z] runbld>>> The following profiles matched the job 'Beats/beats/PR-20111' in order of occurrence in the config (last value wins).
[2020-07-22T15:30:46.881Z] runbld>>> Debug logging enabled.
[2020-07-22T15:30:46.881Z] runbld>>> Storing result
[2020-07-22T15:30:47.143Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-22T15:30:47.143Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200722153046-EB5B4658
[2020-07-22T15:30:47.143Z] runbld>>> Adding system facts.
[2020-07-22T15:30:48.089Z] runbld>>> Adding vcs info for the latest commit:  8073fa422ca9a3c9013620a626a4c4d9b1e87393
[2020-07-22T15:30:48.089Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-22T15:30:48.089Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-22T15:30:48.089Z] Processing JUnit reports with runbld...
[2020-07-22T15:30:48.089Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-22T15:30:48.659Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-22T15:30:48.659Z] runbld>>> DURATION: 24ms
[2020-07-22T15:30:48.659Z] runbld>>> STDOUT: 40 bytes
[2020-07-22T15:30:48.659Z] runbld>>> STDERR: 49 bytes
[2020-07-22T15:30:48.659Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-22T15:30:48.659Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats
[2020-07-22T15:30:49.603Z] runbld>>> Storing build metadata: 
[2020-07-22T15:30:49.603Z] runbld>>> Adding test report.
[2020-07-22T15:30:49.603Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats
[2020-07-22T15:30:50.546Z] runbld>>> Found 132 test output files
[2020-07-22T15:30:51.494Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-07-22T15:30:51.494Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-07-22T15:30:51.756Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-07-22T15:30:51.756Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-07-22T15:30:51.756Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-07-22T15:30:51.756Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-07-22T15:30:51.756Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20111/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-07-22T15:30:53.158Z] runbld>>> Test output logs contained: Errors: 0 Failures: 16 Tests: 16640 Skipped: 1624
[2020-07-22T15:30:53.158Z] runbld>>> Storing result
[2020-07-22T15:30:53.158Z] runbld>>> FAILURES: 16
[2020-07-22T15:30:56.492Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-22T15:30:56.492Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200722153046-EB5B4658
[2020-07-22T15:30:56.492Z] runbld>>> Email notification disabled by environment variable.
[2020-07-22T15:30:56.492Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-22T15:31:02.298Z] Running on worker-395930 in /var/lib/jenkins/workspace/Beats_beats_PR-20111
[2020-07-22T15:31:02.454Z] [INFO] getVaultSecret: Getting secrets
[2020-07-22T15:31:02.626Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-22T15:31:04.796Z] + chmod 755 generate-build-data.sh
[2020-07-22T15:31:04.796Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20111/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20111/runs/2 FAILURE 6645358
[2020-07-22T15:31:04.796Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20111/runs/2/steps/?limit=10000 -o steps-info.json
[2020-07-22T15:31:07.091Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20111/runs/2/tests/?status=FAILED -o tests-errors.json
[2020-07-22T15:31:10.303Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20111/runs/2/log/ -o pipeline-log.txt

return errors.New(err, "failed to query service")
}
if status.State == svc.Stopped {
err = service.Start()
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to handle case when service is set to auto-restart?

Copy link
Contributor Author

@blakerouse blakerouse Jul 22, 2020

Choose a reason for hiding this comment

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

It does handle this case, by checking the service.ProcessId with the previous servicePid. When the command is called the previous pid is sent in the arguments to the command. Inside the loop it checks if the service is stopped (if so it starts it, and exits) if its not stopped it checks the current service.ProcessId against the previous pid and if it is different then it means it was already restarted so we also exit.

@blakerouse
Copy link
Contributor Author

CI failures are unrelated to this PR.

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.

LGTM

@blakerouse blakerouse merged commit 5a37193 into elastic:master Jul 28, 2020
@blakerouse blakerouse deleted the agent-reexec branch July 28, 2020 12:20
blakerouse added a commit to blakerouse/beats that referenced this pull request Jul 28, 2020
* Add ability to reexec on all platforms.

* Get it working on Windows

* Fix on mac.

* Fix vet.

* Update ShutdownChan to be receive only.

(cherry picked from commit 5a37193)
blakerouse added a commit that referenced this pull request Jul 28, 2020
* Add ability to reexec on all platforms.

* Get it working on Windows

* Fix on mac.

* Fix vet.

* Update ShutdownChan to be receive only.

(cherry picked from commit 5a37193)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
* Add ability to reexec on all platforms.

* Get it working on Windows

* Fix on mac.

* Fix vet.

* Update ShutdownChan to be receive only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants