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

Commit cd13f3e

Browse files
jlind23mdelapenyaadam-stokesv1v
authored andcommitted
SLES15 enablement (#2007)
* SLES15 enablement * fix: set ansible_user depending on OS * fix: proper vars path * fix: rename SLES distribution file * fix: read distribution vars dynamically with include_vars * fix: keep original behaviour for installing the stack on Debian * fix: set vars correctly * chore: debug ansible user * Update .ci/.e2e-tests.yaml Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Update .ci/ansible/vars/SLES.yml Co-authored-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * Update .ci/ansible/playbook.yml Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * Fix package install for distro, update include_vars for all tasks Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * fix path to vars Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * try with ansible_playbook_vars_root Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * try var_files Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * typo Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * use full path and fix quoting Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * use include_vars Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * make include_vars first in task list for each block Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * dont include_vars on localhost execution Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * remove conflicting statements Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * have e2e-tests.yaml drive the login information Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * fix update cache on debian based systems Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * fix permission on output directory Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * fix group ownership in create test script Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * better os detection in ansible Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> * fix chown in jenkinsfile Signed-off-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com> Co-authored-by: Adam Stokes <51892+adam-stokes@users.noreply.github.com> Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> (cherry picked from commit 764116f)
1 parent 5df06e1 commit cd13f3e

8 files changed

Lines changed: 80 additions & 29 deletions

File tree

.ci/.e2e-tests-for-elastic-agent.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,31 @@ PLATFORMS:
33
stack:
44
image: "ami-0d90bed76900e679a"
55
instance_type: "c5.4xlarge"
6+
username: admin
67
helm:
78
image: "ami-0d90bed76900e679a"
89
instance_type: "c5.2xlarge"
10+
username: admin
911
fleet_arm64:
1012
image: "ami-06dac44ad759182bd"
1113
instance_type: "a1.large"
14+
username: admin
1215
fleet_amd64:
1316
image: "ami-0d90bed76900e679a"
1417
instance_type: "c5.4xlarge"
18+
username: admin
19+
fleet_sles15:
20+
image: "ami-0f7cb53c916a75006"
21+
instance_type: "c5.4xlarge"
22+
username: ec2-user
1523
fleet_elastic_pkg:
1624
image: "ami-0d90bed76900e679a"
1725
instance_type: "c5.4xlarge"
26+
username: admin
1827
kubernetes_autodiscover:
1928
image: "ami-0d90bed76900e679a"
2029
instance_type: "c5.4xlarge"
30+
username: admin
2131

2232
SUITES:
2333
- suite: "fleet"

.ci/.e2e-tests.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,31 @@ PLATFORMS:
33
stack:
44
image: "ami-0d90bed76900e679a"
55
instance_type: "c5.4xlarge"
6+
username: admin
67
helm:
78
image: "ami-0d90bed76900e679a"
89
instance_type: "c5.2xlarge"
10+
username: admin
911
fleet_arm64:
1012
image: "ami-06dac44ad759182bd"
1113
instance_type: "a1.large"
14+
username: admin
1215
fleet_amd64:
1316
image: "ami-0d90bed76900e679a"
1417
instance_type: "c5.4xlarge"
18+
username: admin
19+
fleet_sles15:
20+
image: "ami-0f7cb53c916a75006"
21+
instance_type: "c5.4xlarge"
22+
username: ec2-user
1523
fleet_elastic_pkg:
1624
image: "ami-0d90bed76900e679a"
1725
instance_type: "c5.4xlarge"
26+
username: admin
1827
kubernetes_autodiscover:
1928
image: "ami-0d90bed76900e679a"
2029
instance_type: "c5.4xlarge"
30+
username: admin
2131

2232
SUITES:
2333
- suite: "helm"
@@ -35,7 +45,7 @@ SUITES:
3545
scenarios:
3646
- name: "Fleet"
3747
tags: "fleet_mode_agent"
38-
platforms: ["fleet_arm64", "fleet_amd64"]
48+
platforms: ["fleet_arm64", "fleet_amd64", "fleet_sles15"]
3949
- name: "Integrations"
4050
tags: "integrations"
4151
platforms: ["fleet_arm64", "fleet_amd64"]

.ci/Jenkinsfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ pipeline {
204204

205205
ansible(stackWorkspace,
206206
env.RUN_ID.split('-')[0],
207-
"-t provision-stack --extra-vars=\"nodeLabel=stack nodeImage=${stackMachine.image} nodeInstanceType=${stackMachine.instance_type}\"")
207+
"-t provision-stack --extra-vars=\"nodeUser=${stackMachine.username} nodeLabel=stack nodeImage=${stackMachine.image} nodeInstanceType=${stackMachine.instance_type}\"")
208208

209209
// Must be gathered after deployment as the public IP is known at that time
210210
def stackRunner = getNodeIp(stackWorkspace, 'stack')
@@ -213,7 +213,7 @@ pipeline {
213213
ansible(
214214
stackWorkspace,
215215
env.RUN_ID.split('-')[0],
216-
"-i \"${stackRunner.ip},\" -t setup-stack --extra-vars=\"nodeLabel=stack nodeImage=${stackMachine.image} nodeInstanceType=${stackMachine.instance_type}\""
216+
"-i \"${stackRunner.ip},\" -t setup-stack --extra-vars=\"nodeLabel=stack nodeUser=${stackMachine.username} nodeImage=${stackMachine.image} nodeInstanceType=${stackMachine.instance_type}\""
217217
)
218218
}
219219

@@ -270,7 +270,7 @@ pipeline {
270270
def stackMachine = getMachineInfo(stackWorkspace, 'stack')
271271
ansible(stackWorkspace,
272272
env.RUN_ID.split('-')[0],
273-
"-t destroy --extra-vars=\"nodeLabel=stack nodeImage=${stackMachine.image} nodeInstanceType=${stackMachine.instance_type}\"")
273+
"-t destroy --extra-vars=\"nodeLabel=stack nodeUser=${stackMachine.username} nodeImage=${stackMachine.image} nodeInstanceType=${stackMachine.instance_type}\"")
274274
}
275275
}
276276
}
@@ -505,14 +505,14 @@ def generateFunctionalTestStep(Map args = [:]){
505505
// Start node, capture ip address
506506
ansible("${env.WORKSPACE}",
507507
runId,
508-
"-t start-node --extra-vars=\"stackRunner=${stackRunner.ip} nodeLabel=${platform} nodeImage=${machine.image} nodeInstanceType=${machine.instance_type}\"")
508+
"-t start-node --extra-vars=\"stackRunner=${stackRunner.ip} nodeUser=${machine.username} nodeLabel=${platform} nodeImage=${machine.image} nodeInstanceType=${machine.instance_type}\"")
509509

510510
def testRunner = getNodeIp("${env.WORKSPACE}", platform)
511511

512512
// Configure node for testing
513513
ansible("${env.WORKSPACE}",
514514
runId,
515-
"-i \"${testRunner.ip},\" -t setup-node --extra-vars=\"stackRunner=${stackRunner.ip} nodeLabel=${platform} nodeImage=${machine.image} nodeInstanceType=${machine.instance_type}\"")
515+
"-i \"${testRunner.ip},\" -t setup-node --extra-vars=\"stackRunner=${stackRunner.ip} nodeUser=${machine.username} nodeLabel=${platform} nodeImage=${machine.image} nodeInstanceType=${machine.instance_type}\"")
516516

517517
sshexec("${env.WORKSPACE}",
518518
testRunner,
@@ -524,15 +524,15 @@ def generateFunctionalTestStep(Map args = [:]){
524524
sh "mkdir -p outputs/${testRunner.ip} || true"
525525
sshexec("${env.WORKSPACE}",
526526
testRunner,
527-
"""sudo chown ${testRunner.user}:${testRunner.user} -R /home/${testRunner.user}/e2e-testing/outputs """)
527+
"""sudo chown ${testRunner.user} -R /home/${testRunner.user}/e2e-testing/outputs """)
528528
scpr("${env.WORKSPACE}",
529529
testRunner,
530530
"e2e-testing/outputs/TEST-*${runId}*.xml",
531531
"outputs/${testRunner.ip}/.")
532532
sh "ls -l outputs/${testRunner.ip}"
533533
ansible("${env.WORKSPACE}",
534534
runId,
535-
"-t destroy --extra-vars=\"nodeLabel=${platform} nodeImage=${machine.image} nodeInstanceType=${machine.instance_type}\"")
535+
"-t destroy --extra-vars=\"nodeLabel=${platform} nodeUser=${machine.username} nodeImage=${machine.image} nodeInstanceType=${machine.instance_type}\"")
536536
junit allowEmptyResults: true,
537537
keepLongStdio: true,
538538
testResults: "outputs/${testRunner.ip}/TEST-*${runId}*.xml"

.ci/ansible/playbook.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
hosts: localhost
33
gather_facts: no
44
vars:
5-
ansible_user: admin
5+
ansible_user: "{{nodeUser}}"
66
tasks:
77
- name: Setup nodes
88
include_tasks: tasks/runners.yml
@@ -14,7 +14,7 @@
1414
hosts: localhost
1515
gather_facts: no
1616
vars:
17-
ansible_user: admin
17+
ansible_user: "{{nodeUser}}"
1818
tasks:
1919
- name: Teardown Test Runners (AWS)
2020
include_tasks: tasks/teardown.yml
@@ -27,6 +27,10 @@
2727
become: True
2828
tags:
2929
- setup-stack
30+
pre_tasks:
31+
- name: Update apt cache.
32+
apt: update_cache=yes cache_valid_time=600
33+
when: ansible_os_family == 'Debian'
3034
roles:
3135
- role: geerlingguy.docker
3236
docker_daemon_options:
@@ -37,10 +41,8 @@
3741
vars:
3842
golang_version: 1.16.3
3943
vars:
40-
ansible_user: admin
44+
ansible_user: "{{nodeUser}}"
4145
ansible_python_interpreter: /usr/bin/python3
42-
pre_tasks:
43-
- apt: {update_cache: yes}
4446
tasks:
4547
- name: Install deps
4648
include_tasks: tasks/install_deps.yml
@@ -62,7 +64,6 @@
6264
include_tasks: tasks/copy_test_files.yml
6365
tags:
6466
- setup-stack
65-
6667
- name: Start stack
6768
shell: |
6869
sed -i '' -e 's,http://elasticsearch,http://{{inventory_hostname}},g' /home/{{ansible_user}}/e2e-testing/cli/config/compose/profiles/fleet/default/kibana.config.yml
@@ -78,6 +79,10 @@
7879
become: True
7980
tags:
8081
- setup-node
82+
pre_tasks:
83+
- name: Update apt cache.
84+
apt: update_cache=yes cache_valid_time=600
85+
when: ansible_os_family == 'Debian'
8186
roles:
8287
- role: geerlingguy.docker
8388
docker_daemon_options:
@@ -93,10 +98,8 @@
9398
vars:
9499
golang_version: 1.16.3
95100
vars:
96-
ansible_user: admin
97101
ansible_python_interpreter: /usr/bin/python3
98-
pre_tasks:
99-
- apt: {update_cache: yes}
102+
ansible_user: "{{nodeUser}}"
100103
tasks:
101104
- name: Install deps
102105
include_tasks: tasks/install_deps.yml
@@ -108,7 +111,6 @@
108111
tags:
109112
- setup-node
110113
- copy-source
111-
112114
- name: Configure test script
113115
include_tasks: tasks/setup_test_script.yml
114116
tags:

.ci/ansible/tasks/copy_test_files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
- name: Create outputs dir
3+
become: no
34
ansible.builtin.file:
45
path: "/home/{{ansible_user}}/e2e-testing/outputs"
56
state: directory
67
mode: '0755'
78
owner: "{{ansible_user}}"
8-
group: "{{ansible_user}}"
99

1010
- name: Copy source code
1111
become: no

.ci/ansible/tasks/install_deps.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
---
2-
- name: Update cache
3-
shell: |
4-
sudo apt-get update
5-
6-
- name: Install dependencies
7-
ansible.builtin.package:
2+
- name: Install dependencies (Debian/Ubuntu)
3+
apt:
84
name:
95
- rsync
106
- wget
117
- build-essential
128
state: latest
13-
use: apt
9+
update_cache: yes
1410
register: package_install_res
1511
retries: 5
1612
until: package_install_res is success
13+
when: ansible_pkg_mgr == 'apt' or ansible_distribution in ["Debian", "Ubuntu"]
14+
15+
- name: Install dependencies (SUSE)
16+
zypper:
17+
name:
18+
- autoconf
19+
- bison
20+
- flex
21+
- gcc
22+
- gcc-c++
23+
- kernel-default-devel
24+
- make
25+
- m4
26+
- rsync
27+
- wget
28+
state: present
29+
when: ansible_pkg_mgr == 'zypper' or ansible_os_family == "Suse"
30+
31+
- name: Install dependencies (CentOS)
32+
ansible.builtin.package:
33+
name:
34+
- autoconf
35+
- bison
36+
- flex
37+
- gcc
38+
- gcc-c++
39+
- kernel-devel
40+
- make
41+
- m4
42+
- patch
43+
- rsync
44+
- wget
45+
state: latest
46+
when: ansible_distribution in ["Fedora", "RedHat", "CentOS"]

.ci/ansible/tasks/runners.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
become: no
3737
lineinfile:
3838
state: present
39-
line: "- admin@{{addr.public_ip}}"
39+
line: "- {{nodeUser}}@{{addr.public_ip}}"
4040
insertafter: EOF
4141
dest: "{{workspace}}/{{nodeLabel}}-sshhosts"
4242
create: yes

.ci/ansible/tasks/setup_test_script.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- "export FLEET_URL=http://{{stackRunner}}:8220"
1717
- "export SKIP_PULL=1"
1818

19-
when: "'fleet_arm64' == nodeLabel or 'fleet_amd64' == nodeLabel"
19+
when: "'fleet_arm64' == nodeLabel or 'fleet_amd64' == nodeLabel or 'fleet_sles15' == nodeLabel"
2020

2121
- name: Extend environment for Fleet with elastic-package testing
2222
lineinfile:
@@ -72,7 +72,6 @@
7272
become: no
7373
copy:
7474
owner: "{{ansible_user}}"
75-
group: "{{ansible_user}}"
7675
mode: '0777'
7776
dest: "/home/{{ansible_user}}/e2e-testing/.ci/scripts/functional-test.sh"
7877
content: |

0 commit comments

Comments
 (0)