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

chore: use Ansible's built-in replace instead of sed #2048

Merged
merged 3 commits into from
Jan 24, 2022

Conversation

mdelapenya
Copy link
Contributor

What does this PR do?

Instead of sed, it uses Ansible's built-in command for replacing strings in Kibana config file

Why is it important?

We are seeing sed errors in Ansible execution

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 (make unit-test), 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)

Related issues

@mdelapenya mdelapenya added backport-v7.16.0 Automated backport with mergify backport-v7.17.0 Automated backport with mergify backport-v8.0.0 Automated backport with mergify labels Jan 24, 2022
@mdelapenya mdelapenya self-assigned this Jan 24, 2022
@mdelapenya mdelapenya requested a review from a team January 24, 2022 12:22
sed -i '' -e 's,http://package-registry:8080,https://epr-staging.elastic.co,g' /home/{{ansible_user}}/e2e-testing/cli/config/compose/profiles/fleet/default/kibana.config.yml
ansible.builtin.replace:
path: "/home/{{ ansible_user }}/e2e-testing/cli/config/compose/profiles/fleet/default/kibana.config.yml"
regexp: '^{{ item.old }}$'
Copy link
Member

Choose a reason for hiding this comment

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

the original sed didn't use ^ and $ but a global search, maybe those limited flags should not be used just in case the content of the file includes spaces or any other special chars?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was doubting about that, yeah. I was following the official docs for the built-in task and thought they were needed: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html#parameter-regexp

I've been following the pipeline and it seems to work fine (https://beats-ci.elastic.co/blue/organizations/jenkins/e2e-tests%2Fe2e-testing-mbp/detail/PR-2048/1/pipeline/312), but we can remove those tokens if not needed.

[2022-01-24T12:32:02.554Z] TASK [Configure stack files] ***************************************************
[2022-01-24T12:32:03.492Z] ok: [13.59.150.119] => (item={'old': 'http://elasticsearch', 'new': 'http://13.59.150.119'})
[2022-01-24T12:32:04.060Z] ok: [13.59.150.119] => (item={'old': 'http://fleet-server', 'new': 'http://13.59.150.119'})
[2022-01-24T12:32:04.996Z] ok: [13.59.150.119] => (item={'old': 'http://package-registry:8080', 'new': 'https://epr-staging.elastic.co'})

.ci/ansible/playbook.yml Outdated Show resolved Hide resolved
@mdelapenya mdelapenya requested a review from v1v January 24, 2022 12:50
@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 24, 2022

💔 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 preview

Expand to view the summary

Build stats

  • Start Time: 2022-01-24T12:50:55.187+0000

  • Duration: 62 min 14 sec

  • Commit: 9cb7604

Test stats 🧪

Test Results
Failed 45
Passed 173
Skipped 0
Total 218

Test errors 45

Expand to view the tests failures

> Show only the first 10 test failures

Initializing / End-To-End Tests / fleet_amd64_backend_processes / Deploying the agent – Backend Processes
    Expand to view the error details

     Step the "elastic-agent" process is in the "started" state on the host 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Stopping the agent stops backend processes – Backend Processes
    Expand to view the error details

     Step the "elastic-agent" process is "stopped" on the host 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Restarting the installed agent – Backend Processes
    Expand to view the error details

     Step the "elastic-agent" process is "restarted" on the host 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Un-enrolling the agent stops backend processes – Backend Processes
    Expand to view the error details

     Step the agent is un-enrolled 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Re-enrolling the agent starts the elastic-agent process – Backend Processes
    Expand to view the error details

     Step the agent is un-enrolled 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Un-installing the installed agent – Backend Processes
    Expand to view the error details

     Step the "elastic-agent" process is "uninstalled" on the host 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Un-enrolling Elastic Agent stops Elastic Endpoint – Backend Processes
    Expand to view the error details

     Step the agent is un-enrolled 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_amd64_backend_processes / Removing Endpoint from Agent policy stops the connected Endpoint – Backend Processes
    Expand to view the error details

     Step the "Endpoint Security" integration is "removed" in the policy 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_arm64_backend_processes / Deploying the agent – Backend Processes
    Expand to view the error details

     Step the "elastic-agent" process is in the "started" state on the host 
    

  • no stacktrace
Initializing / End-To-End Tests / fleet_arm64_backend_processes / Stopping the agent stops backend processes – Backend Processes
    Expand to view the error details

     Step the "elastic-agent" process is "stopped" on the host 
    

  • no stacktrace

Steps errors 18

Expand to view the steps failures

Show only the first 10 steps failures

Shell Script
  • Took 2 min 31 sec . View more details here
  • Description: ssh -tt -o TCPKeepAlive=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /var/lib/jenkins/workspace/PR-2048-2-e34bea0e-57bd-495a-9b8c-074246e0bc58/e2essh [email protected] -- 'sudo bash /home/admin/e2e-testing/.ci/scripts/functional-test.sh "linux_integration && ~@nightly && ~@skip:amd64" '
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-01-24T13:12:05.104Z] Archiving artifacts script returned exit code 2
Shell Script
  • Took 12 min 8 sec . View more details here
  • Description: ssh -tt -o TCPKeepAlive=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /var/lib/jenkins/workspace/PR-2048-2-822d1a57-4840-46dc-9458-32847233a8e7/e2essh [email protected] -- 'sudo bash /home/admin/e2e-testing/.ci/scripts/functional-test.sh "backend_processes && ~@nightly && ~@skip:arm64" '
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-01-24T13:23:02.219Z] Archiving artifacts script returned exit code 2
Shell Script
  • Took 11 min 19 sec . View more details here
  • Description: ssh -tt -o TCPKeepAlive=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /var/lib/jenkins/workspace/PR-2048-2-6b5d5f77-091f-41d0-addc-175ee53e7e4e/e2essh [email protected] -- 'sudo bash /home/admin/e2e-testing/.ci/scripts/functional-test.sh "backend_processes && ~@nightly && ~@skip:amd64" '
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-01-24T13:22:07.555Z] Archiving artifacts script returned exit code 2
Shell Script
  • Took 7 min 29 sec . View more details here
  • Description: ssh -tt -o TCPKeepAlive=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /var/lib/jenkins/workspace/PR-2048-2-581b0899-5b8c-48ab-a8cf-eed159d06dc7/e2essh [email protected] -- 'sudo bash /home/admin/e2e-testing/.ci/scripts/functional-test.sh "running_on_beats && ~@nightly && ~@skip:arm64" '
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-01-24T13:17:26.342Z] Archiving artifacts script returned exit code 2
Shell Script
  • Took 6 min 20 sec . View more details here
  • Description: ssh -tt -o TCPKeepAlive=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /var/lib/jenkins/workspace/PR-2048-2-9bc8469c-b2f3-4fe4-a9be-0614eded4454/e2essh [email protected] -- 'sudo bash /home/admin/e2e-testing/.ci/scripts/functional-test.sh "running_on_beats && ~@nightly && ~@skip:amd64" '
Archive the artifacts
  • Took 0 min 0 sec . View more details here
  • Description: [2022-01-24T13:17:03.358Z] Archiving artifacts script returned exit code 2

🐛 Flaky test report

❕ There are test failures but not known flaky tests.

Expand to view the summary

Genuine test errors 45

💔 There are test failures but not known flaky tests, most likely a genuine test failure.

  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Deploying the agent – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Stopping the agent stops backend processes – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Restarting the installed agent – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Un-enrolling the agent stops backend processes – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Re-enrolling the agent starts the elastic-agent process – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Un-installing the installed agent – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Un-enrolling Elastic Agent stops Elastic Endpoint – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_amd64_backend_processes / Removing Endpoint from Agent policy stops the connected Endpoint – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Deploying the agent – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Stopping the agent stops backend processes – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Restarting the installed agent – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Un-enrolling the agent stops backend processes – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Re-enrolling the agent starts the elastic-agent process – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Un-installing the installed agent – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Un-enrolling Elastic Agent stops Elastic Endpoint – Backend Processes
  • Name: Initializing / End-To-End Tests / fleet_arm64_backend_processes / Removing Endpoint from Agent policy stops the connected Endpoint – Backend Processes
  • Name: Initializing / End-To-End Tests / kubernetes_autodiscover_elastic-agent / [empty] – TEST-x86_64-kubernetes-autodiscover-c4672bd3-2022-01-24-13:11:20.xml
  • Name: Initializing / End-To-End Tests / fleet_amd64_fleet_mode_agent / Deploying the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_amd64_fleet_mode_agent / Restarting the installed agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_amd64_fleet_mode_agent / Un-enrolling the agent deactivates the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_amd64_fleet_mode_agent / Re-enrolling the agent activates the agent in Fleet – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_amd64_fleet_mode_agent / Revoking the enrollment token for the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_amd64_fleet_mode_agent / Un-installing the installed agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_arm64_fleet_mode_agent / Deploying the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_arm64_fleet_mode_agent / Restarting the installed agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_arm64_fleet_mode_agent / Un-enrolling the agent deactivates the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_arm64_fleet_mode_agent / Re-enrolling the agent activates the agent in Fleet – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_arm64_fleet_mode_agent / Revoking the enrollment token for the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_arm64_fleet_mode_agent / Un-installing the installed agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_sles15_fleet_mode_agent / Deploying the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_sles15_fleet_mode_agent / Restarting the installed agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_sles15_fleet_mode_agent / Un-enrolling the agent deactivates the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_sles15_fleet_mode_agent / Re-enrolling the agent activates the agent in Fleet – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_sles15_fleet_mode_agent / Revoking the enrollment token for the agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_sles15_fleet_mode_agent / Un-installing the installed agent – Fleet Mode Agent
  • Name: Initializing / End-To-End Tests / fleet_amd64_linux_integration / Adding the Linux Integration to an Agent ... – Linux Integration
  • Name: Initializing / End-To-End Tests / fleet_arm64_linux_integration / Adding the Linux Integration to an Agent ... – Linux Integration
  • Name: Initializing / End-To-End Tests / fleet_amd64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of filebeat #1 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_amd64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of metricbeat #1 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_amd64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of filebeat #2 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_amd64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of metricbeat #2 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_arm64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of filebeat #1 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_arm64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of metricbeat #1 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_arm64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of filebeat #2 – Running on top of Beats
  • Name: Initializing / End-To-End Tests / fleet_arm64_running_on_beats / Deploying the Elastic-Agent with enroll and then run on top of metricbeat #2 – Running on top of Beats

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@mdelapenya mdelapenya merged commit 6b930a0 into elastic:main Jan 24, 2022
mergify bot pushed a commit that referenced this pull request Jan 24, 2022
* chore: use Ansible's built-in replace instead of sed

* chore: whitespace variable

* chore: simplify regexp

(cherry picked from commit 6b930a0)
mergify bot pushed a commit that referenced this pull request Jan 24, 2022
* chore: use Ansible's built-in replace instead of sed

* chore: whitespace variable

* chore: simplify regexp

(cherry picked from commit 6b930a0)
mergify bot pushed a commit that referenced this pull request Jan 24, 2022
* chore: use Ansible's built-in replace instead of sed

* chore: whitespace variable

* chore: simplify regexp

(cherry picked from commit 6b930a0)
mdelapenya added a commit that referenced this pull request Jan 24, 2022
* chore: use Ansible's built-in replace instead of sed

* chore: whitespace variable

* chore: simplify regexp

(cherry picked from commit 6b930a0)

Co-authored-by: Manuel de la Peña <[email protected]>
mdelapenya added a commit that referenced this pull request Jan 24, 2022
* chore: use Ansible's built-in replace instead of sed

* chore: whitespace variable

* chore: simplify regexp

(cherry picked from commit 6b930a0)

Co-authored-by: Manuel de la Peña <[email protected]>
mdelapenya added a commit that referenced this pull request Jan 24, 2022
* chore: use Ansible's built-in replace instead of sed

* chore: whitespace variable

* chore: simplify regexp

(cherry picked from commit 6b930a0)

Co-authored-by: Manuel de la Peña <[email protected]>
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Jan 26, 2022
* main: (45 commits)
  feat: add CentOS 8 support (elastic#2034)
  fix: set default region for AWS cli (elastic#2053)
  chore: use Ansible's built-in replace instead of sed (elastic#2048)
  chore: split stack configuration and start into two tasks (elastic#2044)
  feat: enable SSH access to users for debugging cloud instances (elastic#2001)
  fix: use the right branch for 7.17 backports (elastic#2025)
  SLES15 enablement (elastic#2007)
  chore: bump stale agent for main (elastic#2014)
  Update `fetchBeatsBinary` to be reused in elastic-agent-poc (elastic#1984)
  chore: add resiliency when provisioning the stack (elastic#1990)
  chore: bump elastic-package to v0.32.1 (elastic#1959)
  feat: export Fetch&Download methods in the /pkg directory (elastic#1943)
  bump stack version 8.1.0-dbc834fd (elastic#1948)
  bump stack version 8.1.0-76902d39 (elastic#1946)
  chore: retire 7.15 adding 7.17 (elastic#1938)
  ci: use withAPMEnv (elastic#1917)
  Update main branch (elastic#1928)
  bump stack version 8.1.0-befff95a (elastic#1929)
  chore: properly evaluate how tests are skipped on CI when checking modified files (elastic#1924)
  bump stack version 8.1.0-60bffc32 (elastic#1921)
  ...
@mdelapenya mdelapenya deleted the sed-config-files branch July 13, 2022 09:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport-v7.16.0 Automated backport with mergify backport-v7.17.0 Automated backport with mergify backport-v8.0.0 Automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants