Skip to content

Commit 01a2216

Browse files
authored
Merge pull request #29 from dcos/fix-molecule
fixed molecule
2 parents 4420c43 + ed45872 commit 01a2216

File tree

7 files changed

+29
-13
lines changed

7 files changed

+29
-13
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pipeline {
2727
}
2828
steps {
2929
retry(3) {
30-
sh("pip install ansible-lint==4.0.1 yamllint==1.11.1")
30+
sh("pip install -r test_requirements.txt")
3131
}
3232
sh("yamllint -c .yamllint.yml .")
3333
sh("ansible-lint roles/")

molecule/ec2/create.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
instance: "{{ item.name }}"
9191
molecule_region: "{{ item.region }}"
9292
molecule_ssh_user: "{{ item.ssh_user | default(ssh_user) }}"
93-
wait: true
93+
wait: yes
9494
exact_count: 1
9595
count_tag:
9696
instance: "{{ item.name }}"
@@ -113,9 +113,9 @@
113113
set_fact:
114114
instance_conf_dict: {
115115
'instance': "{{ item.instances[0].tags.instance }}",
116-
'region': "{{ item.instances[0].tags['molecule_region'] }}",
116+
'region': "{{ item.instances[0].tags.molecule_region }}",
117117
'address': "{{ item.instances[0].public_ip }}",
118-
'user': "{{ item.instances[0].tags['molecule_ssh_user'] }}",
118+
'user': "{{ item.instances[0].tags.molecule_ssh_user }}",
119119
'port': "{{ ssh_port }}",
120120
'identity_file': "{{ keypair_path }}",
121121
'instance_ids': "{{ item.instance_ids }}", }
@@ -136,10 +136,10 @@
136136

137137
- name: Wait for SSH
138138
wait_for:
139-
port: "{{ ssh_port }}"
139+
port: "{{ item.port }}"
140140
host: "{{ item.address }}"
141141
search_regex: SSH
142-
delay: 10
142+
delay: 60
143143
timeout: 320
144144
with_items: "{{ lookup('file', molecule_instance_config) | molecule_from_yaml }}"
145145

roles/DCOS.agent/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# Same version config updates for nodes that are on the same version, but differ in `dcos-config--setup` package version
2525
- name: "Same version config update? Register latest DC/OS-config--setup version from bootstrap"
2626
shell: |
27+
set -o pipefail
2728
curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/package_lists/$(curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/cluster-package-list.latest).package_list.json | \
2829
jq -r '.[] | select(.|test("dcos-config--setup"))' | sed s/dcos-config--//
2930
args:
@@ -33,6 +34,7 @@
3334

3435
- name: "Same version config update? Is latest DC/OS-config--setup package installed?"
3536
shell: |
37+
set -o pipefail
3638
/opt/mesosphere/bin/dcos-path/dcos-shell pkgpanda list | grep {{ latest_dcos_config_setup.stdout }}
3739
args:
3840
executable: bash

roles/DCOS.bootstrap/tasks/main.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@
6161

6262
- name: Purge old upgrade directory
6363
file:
64-
path: "{{ download_path }}/genconf/serve"
64+
path: "{{ download_path }}/genconf/serve/*"
6565
state: absent
66+
when: "dcos['version'] is version('1.9', '>=')"
67+
loop: >
68+
{{ groups['dcos'] | default([]) | map('extract',hostvars,'ansible_local')| list |
69+
select('defined') | selectattr('dcos_installation', 'defined') |
70+
map(attribute='dcos_installation') | map(attribute='version') | list |
71+
union([dcos['version_to_upgrade_from'] | default(dcos['version']) ]) | unique }}
6672
6773
- name: Ceate install directory/genconf
6874
file: path={{ download_path }}/genconf state=directory mode=0755
@@ -171,7 +177,9 @@
171177
union([dcos['version_to_upgrade_from'] | default(dcos['version']) ]) | unique }}
172178
173179
- name: Get upgrade directory hash
174-
shell: "ls -td -- */ | head -n 1 | cut -d'/' -f1"
180+
shell: |
181+
set -o pipefail
182+
ls -td -- */ | head -n 1 | cut -d'/' -f1
175183
args:
176184
chdir: "{{ download_path }}/genconf/serve/upgrade_from_{{ item }}"
177185
changed_when: false
@@ -189,7 +197,7 @@
189197
src: "{{ item.stdout }}"
190198
state: link
191199
when: "dcos['version'] is version('1.9', '>=')"
192-
loop: "{{upgrade_dir_hash.results}}"
200+
loop: "{{ upgrade_dir_hash.results }}"
193201

194202
# vvv serve files via http vvv
195203

roles/DCOS.master/tasks/dcos_upgrade.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# Step 1 on upgrading prcedure
3030
- name: "Upgrade: Check for all-green Exhibitor status"
3131
shell: |
32+
set -o pipefail
3233
curl --silent http://localhost:8181/exhibitor/v1/cluster/status | jq -r '.[].description' | uniq
3334
args:
3435
warn: false # Curl inside shell is what we need, silence warning.
@@ -50,7 +51,9 @@
5051
port: 5050
5152
delay: 10
5253
- name: "Upgrade: Check for mesos-master systemd unit to be 'running'"
53-
shell: systemctl status dcos-mesos-master | grep '(running)'
54+
shell: |
55+
set -o pipefail
56+
systemctl status dcos-mesos-master | grep '(running)'
5457
args:
5558
warn: false # We are not interested in changing the state itself, just if it's 'running'
5659
retries: 12
@@ -60,6 +63,7 @@
6063
# Step 5 on upgrading procedure
6164
- name: "Upgrade: Check for CockrockDB replication status (Enterprise only)"
6265
shell: |
66+
set -o pipefail
6367
/opt/mesosphere/bin/cockroach node status --ranges --certs-dir=/run/dcos/pki/cockroach --host=$(/opt/mesosphere/bin/detect_ip) --format tsv 2>/dev/null | tail -n+2 | head -n-1 | cut -f 10 | uniq
6468
retries: 12
6569
delay: 10

roles/DCOS.master/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
# Same version config updates for nodes that are on the same version, but differ in `dcos-config--setup` package version
2525
- name: "Same version config update? Register latest DC/OS-config--setup version from bootstrap"
2626
shell: |
27+
set -o pipefail
2728
curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/package_lists/$(curl {{ dcos['config']['bootstrap_url'] }}/{{ dcos_version_specifier }}/genconf/serve/cluster-package-list.latest).package_list.json | \
2829
jq -r '.[] | select(.|test("dcos-config--setup"))' | sed s/dcos-config--//
2930
args:
@@ -33,6 +34,7 @@
3334

3435
- name: "Same version config update? Is latest DC/OS-config--setup package installed?"
3536
shell: |
37+
set -o pipefail
3638
/opt/mesosphere/bin/dcos-path/dcos-shell pkgpanda list | grep {{ latest_dcos_config_setup.stdout }}
3739
args:
3840
executable: bash

test_requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
molecule==2.19.0
1+
molecule==2.20.1
22
molecule[ec2]
33
molecule[vagrant]
44
boto
55
boto3
6-
ansible-lint==4.0.1
7-
yamllint==1.11.1
6+
ansible-lint==4.1.0
7+
yamllint==1.15.0

0 commit comments

Comments
 (0)