Skip to content

Commit

Permalink
allow to test changes from nfv-example-cnf-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlepied committed Jun 8, 2023
1 parent 252952d commit bf485c5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion testpmd/hooks/install.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Deploy the Example CNF applications
include_role:
name: "{{ dci_config_dir }}/hooks/{{ cluster_name }}/nfv-example-cnf-deploy/roles/example-cnf-app"
name: "{{ deploy_dir }}/roles/example-cnf-app"

- name: Apply configuration for CNF Cert Suite execution
include_role:
Expand Down
42 changes: 29 additions & 13 deletions testpmd/hooks/pre-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
with_items: "{{ hostvars.localhost.job_info.job.components }}"
when: item["type"] == "nfv-example-cnf-index"

- name: Check change presence
- name: Check example-cnf change presence
block:
- name: Check if example-cnf is part of the change
stat:
Expand All @@ -28,7 +28,7 @@

- block:
- name: Generate versions
shell: "./generate-versions.sh {{ job_logs.path }}/versions.cfg pr$(jq -r .number ../example-cnf-[0-9]*.json).$(jq -r .head.sha ../example-cnf-[0-9]*.json|cut -c1-8)"
shell: 'JSON=$(ls ../example-cnf-[0-9]*.json); if [ -z "$JSON" ]; then JSON=../github.json; fi; ./generate-versions.sh {{ job_logs.path }}/versions.cfg pr$(jq -r .number $JSON).$(jq -r .head.sha $JSON|cut -c1-8)'
args:
chdir: "{{ dci_change_dir }}/example-cnf"

Expand Down Expand Up @@ -59,6 +59,16 @@
# state: absent

when: examplecnf_change_dir.stat.exists and examplecnf_change_dir.stat.isdir

- name: Check if nfv-example-cnf-deploy is part of the change
stat:
path: "{{ dci_change_dir }}/nfv-example-cnf-deploy"
register: deploy_change_dir

- name: Override the deploy_dir variable
set_fact:
deploy_dir: "{{ dci_change_dir }}/nfv-example-cnf-deploy"
when: deploy_change_dir.stat.exists and deploy_change_dir.stat.isdir
when:
- dci_change_dir is defined

Expand Down Expand Up @@ -153,16 +163,6 @@
ignore_errors: true
no_log: true

- name: Checkout Example CNF deployment role
git:
repo: "https://github.com/rh-nfv-int/nfv-example-cnf-deploy.git"
dest: "{{ dci_config_dir }}/hooks/{{ cluster_name }}/nfv-example-cnf-deploy"
version: "{{ example_cnf_deploy_script_version|default('master') }}"
update: yes
register: gitresult

- debug: msg="Git hash is {{ gitresult.after }}"

- name: "Install required rpm packages"
package:
name:
Expand All @@ -174,13 +174,29 @@
state: latest
become: true

- name: Override the deploy_dir variable
set_fact:
deploy_dir: "{{ dci_config_dir }}/hooks/{{ cluster_name }}/nfv-example-cnf-deploy"
when:
- deploy_dir is not defined

- name: Checkout Example CNF deployment role
git:
repo: "https://github.com/rh-nfv-int/nfv-example-cnf-deploy.git"
dest: "{{ deploy_dir }}"
version: "{{ example_cnf_deploy_script_version|default('master') }}"
update: yes
register: gitresult

- debug: msg="Git hash is {{ gitresult.after }}"

- name: Mirror catalog in disconnected environment
include_tasks: mirror-catalog.yml
when:
- dci_disconnected | default(false) | bool

- name: Deploy NFV Example CNF catalog
include_role:
name: "{{ dci_config_dir }}/hooks/{{ cluster_name }}/nfv-example-cnf-deploy/roles/example-cnf-catalog"
name: "{{ deploy_dir }}/roles/example-cnf-catalog"

...
2 changes: 1 addition & 1 deletion testpmd/hooks/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Run migration test
include_role:
name: "{{ dci_config_dir }}/hooks/{{ cluster_name }}/nfv-example-cnf-deploy/roles/example-cnf-validate"
name: "{{ deploy_dir }}/roles/example-cnf-validate"
when:
- run_migration_test|default(true)|bool

Expand Down

0 comments on commit bf485c5

Please sign in to comment.