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 9, 2023
1 parent 252952d commit a27e714
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
3 changes: 2 additions & 1 deletion testpmd/hooks/install.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---

- 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
56 changes: 38 additions & 18 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,8 +28,9 @@

- 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:
executable: /bin/bash
chdir: "{{ dci_change_dir }}/example-cnf"

- name: Get index version
Expand All @@ -52,13 +53,23 @@
example_cnf_index_image: "quay.io/rh-nfv-int/nfv-example-cnf-catalog:{{ index_output.stdout }}"
app_version: "{{ app_output.stdout }}"

# - name: 'Remove component from the job'
# dci_job_component:
# component_id: "{{ git_operator_component_id }}"
# job_id: " {{ job_id }} "
# state: absent
- name: 'Remove component from the job'
dci_job_component:
component_id: "{{ operator_component_id }}"
job_id: " {{ job_id }} "
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 +164,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 +175,32 @@
state: latest
become: true

- block:
- name: Checkout Example CNF deployment roles
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: true
register: gitresult

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

- name: Set 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: 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 a27e714

Please sign in to comment.