diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eb7321dce..54717e8a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ variables: GCE_PREEMPTIBLE: "false" ANSIBLE_KEEP_REMOTE_FILES: "1" ANSIBLE_CONFIG: ./tests/ansible.cfg + ANSIBLE_INVENTORY: /tmp/inventory RESET_CHECK: "false" REMOVE_NODE_CHECK: "false" UPGRADE_TEST: "false" diff --git a/tests/Makefile b/tests/Makefile index b05d5be63..70ad9a0f6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -9,20 +9,16 @@ create-tf: delete-tf: ./scripts/delete-tf.sh -$(INVENTORY_DIR): +$(ANSIBLE_INVENTORY): mkdir $@ -create-packet: init-packet | $(INVENTORY_DIR) +create-packet: init-packet | $(ANSIBLE_INVENTORY) ansible-playbook cloud_playbooks/create-packet.yml -c local \ - -e @"files/${CI_JOB_NAME}.yml" \ - -e test_name="$(subst .,-,$(CI_PIPELINE_ID)-$(CI_JOB_ID))" \ - -e branch="$(CI_COMMIT_BRANCH)" \ - -e pipeline_id="$(CI_PIPELINE_ID)" \ - -e inventory_path=$| + -e @"files/${CI_JOB_NAME}.yml" delete-packet: ; -create-vagrant: | $(INVENTORY_DIR) +create-vagrant: | $(ANSIBLE_INVENTORY) vagrant up cp $(CI_PROJECT_DIR)/.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory $| diff --git a/tests/cloud_playbooks/roles/packet-ci/defaults/main.yml b/tests/cloud_playbooks/roles/packet-ci/defaults/main.yml index 5ec7ce046..b936deb25 100644 --- a/tests/cloud_playbooks/roles/packet-ci/defaults/main.yml +++ b/tests/cloud_playbooks/roles/packet-ci/defaults/main.yml @@ -6,16 +6,10 @@ vm_cpu_sockets: 1 vm_cpu_threads: 2 vm_memory: 2048 -# Replace invalid characters so that we can use the branch name in kubernetes labels -branch_name_sane: "{{ branch | regex_replace('/', '-') }}" - # Request/Limit allocation settings cpu_allocation_ratio: 0.25 memory_allocation_ratio: 1 -# Default path for inventory -inventory_path: "/tmp/{{ test_name }}/inventory" - # Deployment mode mode: all-in-one diff --git a/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml b/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml index b360e3944..26658580b 100644 --- a/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml +++ b/tests/cloud_playbooks/roles/packet-ci/tasks/main.yml @@ -45,5 +45,5 @@ - name: Create inventory for CI tests copy: content: "{{ ci_inventory | to_yaml }}" - dest: "{{ inventory_path }}/ci_inventory.yml" + dest: "{{ ansible_inventory_sources[0] }}/ci_inventory.yml" mode: "0644" diff --git a/tests/scripts/testcases_run.sh b/tests/scripts/testcases_run.sh index 89a8d641a..387641d6d 100755 --- a/tests/scripts/testcases_run.sh +++ b/tests/scripts/testcases_run.sh @@ -26,9 +26,8 @@ fi export ANSIBLE_REMOTE_USER=$SSH_USER export ANSIBLE_BECOME=true export ANSIBLE_BECOME_USER=root -export ANSIBLE_INVENTORY=/tmp/inventory/ -make -C tests INVENTORY_DIR=${ANSIBLE_INVENTORY} create-${CI_PLATFORM} -s +make -C tests create-${CI_PLATFORM} -s # Test collection build and install by installing our collection, emptying our repository, adding # cluster.yml, reset.yml, and remote-node.yml files that simply point to our collection's playbooks, and then