-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This project should be verified by the CI test job. So far, it will just simply deploy microshift role with basic parameters and run the linters: ansible-lint and markdown lint.
- Loading branch information
Showing
6 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.tox/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
# FIXME: find a way to provide pull-secret.txt secret to the CI | ||
# job and skip using base-microshift-openstack base job. | ||
- job: | ||
name: test-ansible-microshift-role | ||
parent: base-microshift-openstack | ||
nodeset: centos-9-microshift-single-node | ||
timeout: 10800 | ||
required-projects: | ||
- opendev.org/zuul/zuul-jobs | ||
run: ci/playbooks/deploy_microshift.yaml | ||
post-run: ci/playbooks/collect_logs.yaml | ||
|
||
- project: | ||
name: openstack-k8s-operators/ansible-microshift-role | ||
github-check: | ||
jobs: | ||
- tox-linters | ||
- markdownlint | ||
- test-ansible-microshift-role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- hosts: all | ||
gather_facts: false | ||
vars: | ||
log_dir: "{{ ansible_user_dir }}/zuul-output/logs" | ||
tasks: | ||
- name: Create log dir | ||
file: | ||
path: "{{ log_dir }}" | ||
state: directory | ||
mode: 0755 | ||
|
||
- name: Collect pod logs | ||
ansible.builtin.shell: | | ||
oc get pods > all_pods.txt | ||
oc get secrets > all_secrets.txt | ||
oc get pv > all_pv.txt | ||
oc get events > oc_events.txt | ||
oc get routes > oc_routes.txt | ||
mkdir pod | ||
all_pods=$(oc get pods -o name) | ||
for pod in $all_pods; do | ||
echo $pod | ||
oc logs $pod > ${pod}-logs.txt | ||
oc get -o yaml $pod > ${pod}.yaml | ||
oc describe $pod > ${pod}-describe.txt | ||
done | ||
oc get all --all-namespaces > all-resources.txt | ||
args: | ||
chdir: "{{ log_dir }}" | ||
changed_when: true | ||
|
||
- name: Copy files from {{ work_dir }} on node | ||
include_role: | ||
name: fetch-output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
- hosts: controller | ||
vars: | ||
fqdn: microshift.dev | ||
pv_storageclass: somestorage | ||
setup_olm: true | ||
pv_count: | ||
start: 1 | ||
end: 12 | ||
overwrite_container_policy: true | ||
delete_openshift_storage: true | ||
tasks: | ||
- name: Setup Microshift | ||
block: | ||
- name: Start Microshift deployment | ||
include_role: | ||
name: ansible-microshift-role | ||
|
||
# NOTE: The topolvm requires additional volume and create a lvm | ||
# on that volume. We don't use that for CI, so just skip it. | ||
- name: Create script to verify deployment | ||
copy: | ||
content: | | ||
for i in {1..20}; do | ||
echo "Ensuring that containers are spawned... ${i}" | ||
count=$(/usr/local/bin/oc get pods --all-namespaces | grep openshift | grep -viE 'topolvm|running' -c) | ||
if [ "$count" -eq "0" ]; then | ||
echo "Microshift is deployed, we can continue..." | ||
break | ||
else | ||
echo "The Microshift containers are not ready..." | ||
sleep 15 | ||
fi | ||
done | ||
echo "Skipping waiting for openshift-storage - topolvm" | ||
dest: /tmp/check-microshift.sh | ||
mode: "0755" | ||
|
||
- name: Check if all containers are up and ready | ||
shell: /tmp/check-microshift.sh | ||
always: | ||
- name: Remove sensitive data | ||
include_role: | ||
name: ansible-microshift-role | ||
tasks_from: cleanup.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ansible-lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[tox] | ||
envlist = ansiblelint | ||
skipsdist = True | ||
|
||
[testenv] | ||
basepython = python3 | ||
deps = -r{toxinidir}/test-requirements.txt | ||
|
||
[testenv:ansiblelint] | ||
show-source = True | ||
commands = | ||
ansible-lint |