summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Peck <bill@pecknet.com>2020-03-06 14:15:46 -0500
committerBill Peck <bill@pecknet.com>2020-03-12 14:27:04 -0400
commit1888d918106a3e961e067bbe062351e4e88df9fa (patch)
tree1a877eec1f352985ce1f1e3ab00e36ede327fadc
parent8e56e306cb88e3d4d09ce51a5dea136a24134fa3 (diff)
Added support for downloading task dependencies
Upload CKI logs at end of run. Change-Id: Ibfe2d80b84b775962f75dd0bd2bc357903126945
-rw-r--r--files/job2restraint.xsl5
-rw-r--r--molecule/default/molecule.yml5
-rw-r--r--tasks/main.yml98
-rw-r--r--tox.ini9
4 files changed, 102 insertions, 15 deletions
diff --git a/files/job2restraint.xsl b/files/job2restraint.xsl
index eb759d2..550c068 100644
--- a/files/job2restraint.xsl
+++ b/files/job2restraint.xsl
@@ -4,7 +4,10 @@
<xsl:output method="xml" indent="yes"/>
<!-- <xsl:strip-space elements="*"/> -->
<xsl:template match="text()"/>
- <xsl:template match="job/recipeSet/recipe[1]"><job><recipeSet><recipe>
+ <xsl:template match="job/recipeSet/recipe[1]"><job><recipeSet><recipe><params><param>
+<xsl:attribute name="name">LOOKASIDE</xsl:attribute>
+<xsl:attribute name="value">http://<xsl:value-of select="$jumpHost"/>/lookaside/</xsl:attribute>
+</param></params>
<xsl:apply-templates/></recipe></recipeSet></job>
</xsl:template>
<xsl:template match="task[fetch]">
diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml
index 0d217ee..c264d7d 100644
--- a/molecule/default/molecule.yml
+++ b/molecule/default/molecule.yml
@@ -4,8 +4,8 @@ dependency:
enabled: false
driver:
name: docker
-lint:
- name: yamllint
+lint: |
+ yamllint tasks
platforms:
- name: el7
image: centos:latest
@@ -25,7 +25,6 @@ scenario:
- lint
- destroy
- dependency
- - syntax
- create
- prepare
- destroy
diff --git a/tasks/main.yml b/tasks/main.yml
index 94ddf4f..fefecf7 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -10,22 +10,110 @@
command: |
/usr/bin/sshpass -p beaker ssh-copy-id -o StrictHostKeyChecking=no \
-o UserKnownHostsFile=/dev/null root@{{ fqdn }}
+- name: Generate temp dir
+ delegate_to: localhost
+ tempfile:
+ state: directory
+ suffix: rstrnt_job
+ register: rstrnt_job
+
+- name: Mirror cki job local
+ delegate_to: localhost
+ get_url:
+ url: "{{ cki_job_url | default(job_info.job.topic.data.cki_job_url) }}"
+ dest: "{{ rstrnt_job.path }}/cki_job.xml"
+ mode: 0755
+
+- name: Get 'dependency' nodes
+ delegate_to: localhost
+ xml:
+ path: "{{ rstrnt_job.path }}/cki_job.xml"
+ xpath: //dependencies/dependency
+ content: attribute
+ register: dependencies
+
+- name: Create lookaside dir
+ delegate_to: localhost
+ file:
+ path: /var/www/html/lookaside
+ state: directory
+ mode: '0755'
+
+- name: Mirror Job Dependencies
+ delegate_to: localhost
+ get_url:
+ url: "{{ item.dependency.url }}"
+ dest: /var/www/html/lookaside/
+ mode: 0755
+ with_items: "{{ dependencies.matches }}"
+
- name: Process CKI jobs # noqa 301
delegate_to: localhost
shell: |
xsltproc --stringparam jumpHost {{ local_repo_ip }} \
- files/job2restraint.xsl cki_job.xml > processed_cki_job.xml
+ {{ role_path }}/files/job2restraint.xsl \
+ {{ rstrnt_job.path }}/cki_job.xml \
+ > {{ rstrnt_job.path }}/processed_cki_job.xml
- name: Generate CKI playbook # noqa 301
delegate_to: localhost
shell: |
- xsltproc --stringparam sutHost {{ fqdn }} files/job2dciplaybook.xsl \
- /etc/dci-rhel-agent/hooks/cki_job.xml > cki_playbook.yml
+ xsltproc --stringparam sutHost {{ fqdn }} \
+ {{ role_path }}/files/job2dciplaybook.xsl \
+ {{ rstrnt_job.path }}//cki_job.xml \
+ > {{ rstrnt_job.path }}/cki_playbook.yml
-- include_tasks: cki_playbook.yml
+- include_tasks: "{{ rstrnt_job.path }}/cki_playbook.yml"
# Run the test
- name: Execute restraint processed_cki_job.xml # noqa 301
delegate_to: localhost
command: |
- restraint --job processed_cki_job.xml --host 1=root@{{ fqdn }} -v
+ restraint --job {{ rstrnt_job.path }}/processed_cki_job.xml --host
+ 1=root@{{ fqdn }} -v
+ args:
+ chdir: "{{ rstrnt_job.path }}"
+
+- name: Generate CKI Junit results # noqa 301
+ delegate_to: localhost
+ shell: |
+ xsltproc /usr/share/restraint/client/job2junit.xml \
+ {{ rstrnt_job.path }}//processed_cki_job.01/job.xml \
+ > {{ rstrnt_job.path }}/cki-results.xml
+
+- name: Upload CKI jUnit results
+ delegate_to: localhost
+ environment:
+ - DCI_CLIENT_ID: "{{ hostvars.localhost.dci_client_id }}"
+ - DCI_API_SECRET: "{{ hostvars.localhost.dci_api_secret }}"
+ - DCI_CS_URL: "{{ hostvars.localhost.dci_cs_url }}"
+ dci_file:
+ path: "{{ rstrnt_job.path }}/cki-results.xml"
+ name: "cki-results"
+ job_id: "{{ hostvars.localhost.job_id }}"
+ mime: "application/junit"
+
+- name: Bundle up CKI logs
+ delegate_to: localhost
+ archive:
+ path: "{{ rstrnt_job.path }}/processed_cki_job.01"
+ dest: "{{ rstrnt_job.path }}/processed_cki_job.01.tgz"
+
+- name: Upload CKI log tarball
+ delegate_to: localhost
+ environment:
+ - DCI_CLIENT_ID: "{{ hostvars.localhost.dci_client_id }}"
+ - DCI_API_SECRET: "{{ hostvars.localhost.dci_api_secret }}"
+ - DCI_CS_URL: "{{ hostvars.localhost.dci_cs_url }}"
+ dci_file:
+ path: "{{ item }}"
+ name: "{{ item | basename }}"
+ job_id: "{{ hostvars.localhost.job_id }}"
+ with_fileglob:
+ - "{{ rstrnt_job.path }}/processed_cki_job.01.tgz"
+
+- name: Clean up Temp dir
+ delegate_to: localhost
+ file:
+ path: "{{ rstrnt_job.path }}"
+ state: absent
diff --git a/tox.ini b/tox.ini
index c02fb74..c4e9c06 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,18 +1,15 @@
[tox]
minversion = 1.8
-envlist = py{27,36}
+envlist = py36
skipsdist = true
[testenv]
passenv = *
deps =
- ansible>=2.7,<2.8
+ ansible>=2.8,<2.9
docker
molecule
-
-[testenv:py27]
-commands =
- molecule test
+sitepackages = False
[testenv:py36]
commands =