Add support for packaging and offline execution
This change request adds support for packaging onap test framework based on xtesting and its offline execution.
Signed-off-by: eprasad <prasad.mukhedkar@est.tech>
Change-Id: Id7f2ff688e46d059c60f2bd74e5dec118096202d
Signed-off-by: eprasad <prasad.mukhedkar@est.tech>
diff --git a/package.sh b/package.sh
index e2d3730..a864da7 100755
--- a/package.sh
+++ b/package.sh
@@ -21,6 +21,25 @@
set -o nounset
set -o pipefail
-echo "Hello World!"
+#-------------------------------------------------------------------------------
+# Find and set where we are
+#-------------------------------------------------------------------------------
+STACK_ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
+export STACK_ROOT_DIR
+
+#-------------------------------------------------------------------------------
+# Start packaging process
+#-------------------------------------------------------------------------------
+echo "Info : Start packaging process"
+echo "-------------------------------------------------------------------------"
+cd "${TEST_PATH}"
+ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
+ -i "${TEST_PATH}/test/inventory/localhost.ini" \
+ "${STACK_ROOT_DIR}/playbooks/package.yaml"
+echo "-------------------------------------------------------------------------"
+echo
+echo "Info : Packaging is done!"
+echo " You can take $OFFLINE_TESTING_FILE and use it for offline test!"
# vim: set ts=2 sw=2 expandtab:
+
diff --git a/playbooks/package.yaml b/playbooks/package.yaml
new file mode 100644
index 0000000..1a69974
--- /dev/null
+++ b/playbooks/package.yaml
@@ -0,0 +1,28 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- hosts: localhost
+ connection: local
+ gather_facts: true
+ become: false
+
+ roles:
+ - role: package
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/prepare-artifacts.yaml b/playbooks/prepare-artifacts.yaml
new file mode 100644
index 0000000..7ecc175
--- /dev/null
+++ b/playbooks/prepare-artifacts.yaml
@@ -0,0 +1,30 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- hosts: jumphost
+ gather_facts: true
+ become: false
+
+ tasks:
+ - name: Prepare artifacts for offline deployment
+ include_role:
+ name: prepare-artifacts
+ when: execution_mode == "offline-test"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/prepare-testframework.yaml b/playbooks/prepare-testframework.yaml
index 42b72c9..0f9d00e 100644
--- a/playbooks/prepare-testframework.yaml
+++ b/playbooks/prepare-testframework.yaml
@@ -20,7 +20,15 @@
- hosts: jumphost
gather_facts: true
- roles:
- - role: prepare-testframework
+ tasks:
+ - name: Prepare Test Framework for online test
+ include_role:
+ name: prepare-testframework-online
+ when: execution_mode == "online-test"
+
+ - name: Prepare Test Framework for offline test
+ include_role:
+ name: prepare-testframework-offline
+ when: execution_mode == "offline-test"
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/defaults/main.yaml b/playbooks/roles/package/defaults/main.yaml
new file mode 100644
index 0000000..4fee1ec
--- /dev/null
+++ b/playbooks/roles/package/defaults/main.yaml
@@ -0,0 +1,47 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# locations of the packaged dependencies
+
+pkg_folder: "{{ offline_pkg_folder }}/pkg"
+dib_folder: "{{ offline_pkg_folder }}/dib"
+git_folder: "{{ offline_pkg_folder }}/git"
+binaries_folder: "{{ offline_pkg_folder }}/binaries"
+containers_folder: "{{ offline_pkg_folder }}/containers"
+pip_folder: "{{ offline_pkg_folder }}/pip"
+
+
+# test framework
+testfw: xtesting
+
+# git repositories
+repositories:
+ test:
+ repo: "https://gerrit.nordix.org/infra/test.git"
+ dest: "test"
+ version: "{{ lookup('env', 'NORDIX_TEST_VERSION') | default('master', true) }}"
+ refspec: "{{ lookup('env', 'NORDIX_TEST_REFSPEC') | default('master', true) }}"
+ test-onap:
+ repo: "https://gerrit.nordix.org/infra/test/onap"
+ dest: "test-onap"
+ version: "{{ lookup('env', 'TEST_STACK_VERSION') | default('master', true) }}"
+ refspec: "{{ lookup('env', 'STACK_TEST_REFSPEC') | default(omit) }}"
+
+# placeholder for other images
+
diff --git a/playbooks/roles/package/files/build.sh b/playbooks/roles/package/files/build.sh
new file mode 100755
index 0000000..56697f1
--- /dev/null
+++ b/playbooks/roles/package/files/build.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+export OFFLINE_TEST_PKG_FOLDER="${OFFLINE_TEST_PKG_FOLDER:-/tmp/test-offline-package}"
+export OFFLINE_PKG_FILE="${OFFLINE_PKG_FILE:-/tmp/offline-test-package-onap.tgz}"
+
+# NOTE (eprasad): In order to package and test the change for offline testing,
+# we need to include the change/patch within the package since that is what should
+# be used during the testing phase.
+# check if we are running as part of CI verify job
+
+GERRIT_PROJECT="${GERRIT_PROJECT:-}"
+if [[ "$GERRIT_PROJECT" == "infra/test" ]]; then
+ REPO_GIT_URL="https://gerrit.nordix.org/infra/test.git"
+ echo "Info : Running in CI - infra/test patch will be packaged for testing."
+ echo " Checking out the change/patch $GERRIT_REFSPEC for $REPO_GIT_URL"
+ # navigate to the folder and checkout the patch
+ cd "$OFFLINE_PKG_FOLDER/git/test"
+ git fetch "$REPO_GIT_URL" "$GERRIT_REFSPEC" && git checkout FETCH_HEAD
+fi
+
+# compress & archive offline dependencies
+tar -C "$OFFLINE_TEST_PKG_FOLDER" -czf "$OFFLINE_PKG_FILE" .
+
+# remove intermediate offline pkg folder
+rm -rf "$OFFLINE_TEST_PKG_FOLDER"
+
+# create self extracting installer
+cat /tmp/decompress.sh "$OFFLINE_PKG_FILE" > "$OFFLINE_TESTING_FILE"
+chmod +x "$OFFLINE_TESTING_FILE"
+
+# NOTE : if the packaging is run by release job, that job stored release
+# metadata in release.properties file. If this file exists, we need to keep tarball
+# as that must be uploaded for further delivery. The reason for this is that the
+# installer can not be scanned by XRAY
+if [[ ! -f "/tmp/release.properties" ]]; then
+ # remove intermediate offline pkg file
+ rm -rf "$OFFLINE_PKG_FILE"
+fi
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/files/decompress.sh b/playbooks/roles/package/files/decompress.sh
new file mode 100755
index 0000000..be0d8f4
--- /dev/null
+++ b/playbooks/roles/package/files/decompress.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+cat <<EOF
+#---------------------------------------------------#
+# Self Extracting Installer #
+#---------------------------------------------------#
+User : $USER
+Hostname : $HOSTNAME
+Host OS : $(source /etc/os-release &> /dev/null || source /usr/lib/os-release &> /dev/null; echo "${PRETTY_NAME}")
+IP : $(hostname -I | cut -d' ' -f1)
+#---------------------------------------------------#
+Info : Please wait while extracting dependencies.
+ This might take a while.
+#---------------------------------------------------#
+EOF
+
+TEST_WORKSPACE=/opt/test
+DESTINATION_FOLDER="$TEST_WORKSPACE/offline"
+export TEST_WORKSPACE DESTINATION_FOLDER
+
+# NOTE (eprasad): we need to clean things up in order to prevent side effects from leftovers
+sudo rm -rf "$TEST_WORKSPACE"
+sudo mkdir -p "$DESTINATION_FOLDER"
+sudo chown -R "$USER":"$USER" "$TEST_WORKSPACE"
+
+ARCHIVE=$(awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' "$0")
+
+tail -n+"$ARCHIVE" "$0" | tar -xz -C "$DESTINATION_FOLDER"
+
+cd "$DESTINATION_FOLDER"
+./test.sh
+
+exit 0
+__ARCHIVE_BELOW__
diff --git a/playbooks/roles/package/files/test.sh b/playbooks/roles/package/files/test.sh
new file mode 100755
index 0000000..d38dd99
--- /dev/null
+++ b/playbooks/roles/package/files/test.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# TODO (eprasad): This script could be enhanced to provide full testing functionality
+# by parsing arguments and executing actual test test.sh with the arguments
+
+echo "Info : Dependencies are extracted to $DESTINATION_FOLDER"
+echo "Info : Please navigate to $DESTINATION_FOLDER/git/test/test folder and issue test command"
+echo " You can get help about the test usage by issuing command ./test.sh -h"
+echo " Do not forget to specify ansible inventory file location using -i argument!"
+echo "Info : Done!"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/containers.yaml b/playbooks/roles/package/tasks/containers.yaml
new file mode 100644
index 0000000..7352f03
--- /dev/null
+++ b/playbooks/roles/package/tasks/containers.yaml
@@ -0,0 +1,64 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Create directory to store container images
+ file:
+ path: "{{ containers_folder }}"
+ state: "{{ item }}"
+ with_items:
+ - absent
+ - directory
+
+
+# NOTE (eprasad): docker_image module doesn't seem to respect become so falling back to command module
+- name: Pull test stack container images
+ command: "docker pull {{ xtesting_image_repo}}/{{ item.value.image_name }}@sha256:{{ item.value.image_version }}"
+ with_dict: "{{ framework[testfw] }}"
+ become: true
+ changed_when: false
+
+- name: Add tag to the stack images
+ command: |-
+ docker tag "{{ xtesting_image_repo}}/{{ item.value.image_name }}@sha256:{{ item.value.image_version }}"
+ "onap/{{ item.value.image_name }}:{{ test_stack_version }}"
+ with_dict: "{{ framework[testfw] }}"
+ become: true
+ changed_when: false
+
+# save container images
+- name: Save test stack container images
+ command: |-
+ docker save "onap/{{ item.value.image_name }}:{{ test_stack_version }}"
+ -o {{ item.value.image_name | replace('/', '_') }}-{{ test_stack_version }}.tar
+ with_dict: "{{ framework[testfw] }}"
+ args:
+ chdir: "{{ containers_folder }}"
+ become: true
+ changed_when: false
+
+# NOTE (eprasad): archive fails due to wrong permissions so we fix them
+- name: Fix container image permissions
+ file:
+ path: "{{ containers_folder }}"
+ state: directory
+ recurse: true
+ mode: 0755
+ become: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/git.yaml b/playbooks/roles/package/tasks/git.yaml
new file mode 100644
index 0000000..1b113a9
--- /dev/null
+++ b/playbooks/roles/package/tasks/git.yaml
@@ -0,0 +1,41 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Create directory to store git repositories
+ file:
+ path: "{{ git_folder }}"
+ state: "{{ item }}"
+ with_items:
+ - absent
+ - directory
+
+- name: Clone repositories
+ git:
+ repo: "{{ repositories[item.key].repo }}"
+ dest: "{{ git_folder }}/{{ repositories[item.key].dest }}"
+ version: "{{ repositories[item.key].version }}"
+ refspec: "{{ repositories[item.key].refspec | default(omit) }}"
+ force: true
+ with_dict: "{{ repositories }}"
+ environment:
+ http_proxy: "{{ lookup('env','http_proxy') }}"
+ https_proxy: "{{ lookup('env','https_proxy') }}"
+ no_proxy: "{{ lookup('env','no_proxy') }}"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/install-packages-Debian.yml b/playbooks/roles/package/tasks/install-packages-Debian.yml
new file mode 100644
index 0000000..ebb4df4
--- /dev/null
+++ b/playbooks/roles/package/tasks/install-packages-Debian.yml
@@ -0,0 +1,61 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Load distribution variables
+ include_vars: '{{ ansible_os_family }}.yaml'
+
+- name: Add docker apt key
+ apt_key:
+ url: https://download.docker.com/linux/ubuntu/gpg
+ state: present
+ become: true
+
+# NOTE(fdegir): ansible apt_repository gives segmentation fault so failling back to command
+- name: Add docker apt repository
+ command: |-
+ add-apt-repository \
+ "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
+ changed_when: false
+ become: true
+
+- name: Run apt update
+ apt:
+ update_cache: true
+ become: true
+
+- name: Install packages
+ apt:
+ name: "{{ packages }}"
+ state: "{{ item }}"
+ force: true
+ install_recommends: true
+ autoremove: true
+ update_cache: true
+ with_items:
+ - absent
+ - present
+ become: true
+
+- name: Restart docker service
+ service:
+ name: "{{ docker_service_name }}"
+ state: restarted
+ become: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/main.yaml b/playbooks/roles/package/tasks/main.yaml
new file mode 100644
index 0000000..9df4c7b
--- /dev/null
+++ b/playbooks/roles/package/tasks/main.yaml
@@ -0,0 +1,92 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+#- name: Prepare packaging
+# include_tasks: prepare-packaging.yaml
+
+- name: Create folder to store dependencies for offline testing
+ file:
+ path: "{{ offline_pkg_folder }}"
+ state: "{{ item }}"
+ with_items:
+ - absent
+ - directory
+
+- name: Install packages on {{ ansible_os_family }}
+ include_tasks: "install-packages-{{ ansible_os_family }}.yml"
+
+
+# collect apt packages
+- name: Fetch operating system packages
+ include_tasks: "pkg-{{ ansible_os_family }}.yaml"
+
+# clone git repositories
+- name: Fetch git repositories
+ include_tasks: git.yaml
+
+# download pip packages
+- name: Fetch pip python packages
+ include_tasks: pip.yaml
+
+# fetch xtexting container images
+- name: Fetch container images
+ include_tasks: containers.yaml
+
+# ensure we don't have leftovers
+- name: Delete outdated files
+ file:
+ path: "{{ item }}"
+ state: absent
+ with_items:
+ - "{{ offline_pkg_file }}"
+ - "{{ offline_pkg_folder }}/test.sh"
+ - "{{ offline_testing_file }}"
+ - "/tmp/decompress.sh"
+
+- name: Copy decompress and run scripts
+ copy:
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
+ mode: 0755
+ with_items:
+ - {src: "test.sh", dest: "{{ offline_pkg_folder }}/test.sh"}
+ - {src: "decompress.sh", dest: "/tmp/decompress.sh"}
+
+# check if the packaging is run by release job by looking at /tmp/release.properties
+- name: Check if /tmp/release.properties file exists
+ stat:
+ path: /tmp/release.properties
+ register: release_properties
+
+# record repo shas in release.properties file if it exists and
+# copy release.properties to tarball
+- name: Record test repo SHAs in release.properties
+ include_tasks: record-shas.yaml
+ when: release_properties.stat.exists
+
+# create tarball
+- name: Create test installer file
+ script: build.sh
+ register: build_script
+
+- name: Log build script output to console
+ debug:
+ msg: "{{ build_script.stdout_lines }}"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/pip.yaml b/playbooks/roles/package/tasks/pip.yaml
new file mode 100644
index 0000000..58c2624
--- /dev/null
+++ b/playbooks/roles/package/tasks/pip.yaml
@@ -0,0 +1,48 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Create directory to store pip packages
+ file:
+ path: "{{ pip_folder }}"
+ state: "{{ item }}"
+ with_items:
+ - absent
+ - directory
+
+# NOTE (eprasad): This could perhaps be moved to a different playbook or to engine core
+# itself so the collection of core packages are common across stacks
+- name: Download test core pip packages using requirements.txt file
+ command: "pip download -r {{ test_path }}/requirements.txt --no-cache"
+ changed_when: false
+ args:
+ chdir: "{{ pip_folder }}"
+
+- name: Download stack pip packages using requirements.txt file
+ command: "pip download -r {{ test_path }}/test/stack/{{ stack_type }}/requirements.txt --no-cache"
+ changed_when: false
+ args:
+ chdir: "{{ pip_folder }}"
+
+- name: Copy pip.conf
+ template:
+ src: pip.conf.j2
+ dest: "{{ pip_folder }}/pip.conf"
+ force: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/pkg-Debian.yaml b/playbooks/roles/package/tasks/pkg-Debian.yaml
new file mode 100644
index 0000000..e826817
--- /dev/null
+++ b/playbooks/roles/package/tasks/pkg-Debian.yaml
@@ -0,0 +1,52 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Create directory to store apt packages
+ file:
+ path: "{{ pkg_folder }}/amd64"
+ state: "{{ item }}"
+ with_items:
+ - absent
+ - directory
+
+- name: Generate ubuntu.list file from template
+ template:
+ src: ubuntu.list.j2
+ dest: /tmp/ubuntu.list
+ force: true
+
+- name: Download apt packages using ubuntu.list file
+ shell: |
+ set -o pipefail
+ apt download $(grep -vE "^\s*#" /tmp/ubuntu.list | tr "\n" " ")
+ changed_when: false
+ args:
+ executable: /bin/bash
+ chdir: "{{ pkg_folder }}/amd64"
+
+- name: Generate Packages.gz file for apt packages
+ shell: |
+ set -o pipefail
+ dpkg-scanpackages amd64 | gzip -9c > amd64/Packages.gz
+ args:
+ executable: /bin/bash
+ creates: "{{ pkg_folder }}/amd64/Packages.gz"
+ chdir: "{{ pkg_folder }}"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/prepare-packaging.yaml b/playbooks/roles/package/tasks/prepare-packaging.yaml
new file mode 100644
index 0000000..13e94b0
--- /dev/null
+++ b/playbooks/roles/package/tasks/prepare-packaging.yaml
@@ -0,0 +1,25 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+
+- name: Include vars from collected provisioners and installers vars files
+ include_vars:
+ dir: "{{ test_path }}/test/inventory/group_vars/all"
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/tasks/record-shas.yaml b/playbooks/roles/package/tasks/record-shas.yaml
new file mode 100644
index 0000000..5734489
--- /dev/null
+++ b/playbooks/roles/package/tasks/record-shas.yaml
@@ -0,0 +1,52 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# NOTE (fdegir): ansible-lint complains due to using command module for
+# getting git sha and it is suppressed since it is not possible to get
+# sha using ansible git module
+- name: Fetch commit shas of repos
+ command: git rev-parse HEAD # noqa 303
+ register: commit_shas
+ with_items:
+ - test-onap
+ - test
+ args:
+ chdir: "{{ git_folder }}/{{ item }}"
+ changed_when: false
+
+- name: Populate dictionary to map repos to shas
+ set_fact:
+ repos_shas: "{{ repos_shas|default({}) | combine( {item.item | upper | replace('-', '_') + '_SHA': item.stdout} ) }}"
+ with_items: "{{ commit_shas.results }}"
+
+- name: Record git SHAs to /tmp/release.properties file
+ lineinfile:
+ path: /tmp/release.properties
+ state: present
+ create: true
+ line: "{{ item.key }}={{ item.value }}"
+ with_dict: "{{ repos_shas }}"
+
+- name: Copy /tmp/release.properties into offline package
+ copy:
+ src: /tmp/release.properties
+ dest: "{{ offline_pkg_folder }}/release.properties"
+ force: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/package/templates/pip.conf.j2 b/playbooks/roles/package/templates/pip.conf.j2
new file mode 100644
index 0000000..f241803
--- /dev/null
+++ b/playbooks/roles/package/templates/pip.conf.j2
@@ -0,0 +1,4 @@
+[global]
+timeout=10
+find-links={{ test_workspace }}/offline/pip
+no-index=yes
diff --git a/playbooks/roles/package/templates/ubuntu.list.j2 b/playbooks/roles/package/templates/ubuntu.list.j2
new file mode 100644
index 0000000..7003921
--- /dev/null
+++ b/playbooks/roles/package/templates/ubuntu.list.j2
@@ -0,0 +1,859 @@
+accountsservice
+acl
+acpid
+adduser
+amd64-microcode
+apparmor
+apport
+apport-symptoms
+apt
+apt-cacher-ng
+apt-transport-https
+apt-utils
+at
+aufs-tools
+augeas-lenses
+base-files
+base-passwd
+bash
+bash-completion
+bc
+bcache-tools
+bind9-host
+binutils
+binutils-common:amd64
+binutils-x86-64-linux-gnu
+bridge-utils
+bsdmainutils
+bsdutils
+btrfs-progs
+btrfs-tools
+build-essential
+busybox
+busybox-initramfs
+busybox-static
+byobu
+bzip2
+ca-certificates
+chrony
+cloud-guest-utils
+cloud-image-utils
+cloud-init
+cloud-initramfs-copymods
+cloud-initramfs-dyn-netconf
+cloud-utils
+command-not-found
+command-not-found-data
+conntrack
+console-setup
+console-setup-linux
+coreutils
+cpio
+cpp
+cpp-7
+cpu-checker
+crda
+cron
+cryptsetup
+cryptsetup-bin
+curl
+dash
+dbus
+dconf-gsettings-backend:amd64
+dconf-service
+debconf
+debconf-i18n
+debianutils
+debootstrap
+dh-python
+diffutils
+dirmngr
+distro-info-data
+dmeventd
+dmidecode
+dmsetup
+dnsmasq
+dnsmasq-base
+dns-root-data
+dnsutils
+dosfstools
+dpkg
+dpkg-dev
+e2fsprogs
+eatmydata
+ebtables
+ed
+efibootmgr
+eject
+ethtool
+fakeroot
+fdisk
+file
+findutils
+fontconfig
+fontconfig-config
+fonts-dejavu-core
+fonts-ubuntu-console
+freeipmi-common
+friendly-recovery
+ftp
+fuse
+g++
+g++-7
+galera-3
+gawk
+gcc
+gcc-7
+gcc-7-base:amd64
+gcc-8-base:amd64
+gdisk
+genisoimage
+geoip-database
+gettext-base
+gir1.2-glib-2.0:amd64
+gir1.2-harfbuzz-0.0:amd64
+git
+git-man
+glib-networking:amd64
+glib-networking-common
+glib-networking-services
+gnupg
+gnupg-agent
+gnupg-l10n
+gnupg-utils
+gpg
+gpg-agent
+gpgconf
+gpgsm
+gpgv
+gpg-wks-client
+gpg-wks-server
+grep
+groff-base
+grub2-common
+grub-common
+grub-efi-amd64
+grub-efi-amd64-bin
+grub-efi-amd64-signed
+grub-gfxpayload-lists
+grub-ipxe
+grub-legacy-ec2
+grub-pc
+grub-pc-bin
+gsettings-desktop-schemas
+gstreamer1.0-plugins-base:amd64
+gstreamer1.0-plugins-good:amd64
+gstreamer1.0-x:amd64
+gzip
+hdparm
+hostname
+htop
+ibverbs-providers:amd64
+icu-devtools
+ifupdown
+info
+init
+initramfs-tools
+initramfs-tools-bin
+initramfs-tools-core
+init-system-helpers
+install-info
+intel-microcode
+ipmitool
+iproute2
+ipset
+iptables
+iputils-ping
+iputils-tracepath
+ipvsadm
+ipxe
+ipxe-qemu
+ipxe-qemu-256k-compat-efi-roms
+irqbalance
+isc-dhcp-client
+isc-dhcp-common
+iso-codes
+iucode-tool
+iw
+javascript-common
+kbd
+keyboard-configuration
+klibc-utils
+kmod
+kpartx
+krb5-locales
+landscape-common
+language-pack-en
+language-pack-en-base
+language-selector-common
+less
+libaa1:amd64
+libaccountsservice0:amd64
+libacl1:amd64
+libaio1:amd64
+libalgorithm-diff-perl
+libalgorithm-diff-xs-perl
+libalgorithm-merge-perl
+libapparmor1:amd64
+libapt-inst2.0:amd64
+libapt-pkg5.0:amd64
+libargon2-0:amd64
+libasan4:amd64
+libasn1-8-heimdal:amd64
+libasound2:amd64
+libasound2-data
+libassuan0:amd64
+libasyncns0:amd64
+libatm1:amd64
+libatomic1:amd64
+libattr1:amd64
+libaudit1:amd64
+libaudit-common
+libaugeas0:amd64
+libavahi-client3:amd64
+libavahi-common3:amd64
+libavahi-common-data:amd64
+libavc1394-0:amd64
+libbind9-160:amd64
+libbinutils:amd64
+libblkid1:amd64
+libbluetooth3:amd64
+libbrlapi0.6:amd64
+libbsd0:amd64
+libbz2-1.0:amd64
+libc6:amd64
+libc6-dev:amd64
+libcaca0:amd64
+libcacard0:amd64
+libcairo2:amd64
+libcairo-gobject2:amd64
+libcap2:amd64
+libcap2-bin
+libcap-ng0:amd64
+libc-bin
+libcc1-0:amd64
+libc-dev-bin
+libcdparanoia0:amd64
+libcgi-fast-perl
+libcgi-pm-perl
+libcilkrts5:amd64
+libcom-err2:amd64
+libconfig-inifiles-perl
+libcryptsetup12:amd64
+libcurl3-gnutls:amd64
+libcurl4:amd64
+libdatrie1:amd64
+libdb5.3:amd64
+libdbd-mysql-perl
+libdbi-perl
+libdbus-1-3:amd64
+libdconf1:amd64
+libdebconfclient0:amd64
+libdevmapper1.02.1:amd64
+libdevmapper-event1.02.1:amd64
+libdns1100:amd64
+libdns-export1100
+libdpkg-perl
+libdrm2:amd64
+libdrm-common
+libdumbnet1:amd64
+libdv4:amd64
+libeatmydata1:amd64
+libedit2:amd64
+libefiboot1:amd64
+libefivar1:amd64
+libelf1:amd64
+libencode-locale-perl
+liberror-perl
+libestr0:amd64
+libevent-2.1-6:amd64
+libexpat1:amd64
+libexpat1-dev:amd64
+libext2fs2:amd64
+libfakeroot:amd64
+libfastjson4:amd64
+libfcgi-perl
+libfdisk1:amd64
+libfdt1:amd64
+libffi6:amd64
+libffi-dev:amd64
+libfile-copy-recursive-perl
+libfile-fcntllock-perl
+libflac8:amd64
+libfontconfig1:amd64
+libfreeipmi16
+libfreetype6:amd64
+libfribidi0:amd64
+libfuse2:amd64
+libgcc1:amd64
+libgcc-7-dev:amd64
+libgcrypt20:amd64
+libgd3:amd64
+libgdbm5:amd64
+libgdbm-compat4:amd64
+libgdk-pixbuf2.0-0:amd64
+libgdk-pixbuf2.0-bin
+libgdk-pixbuf2.0-common
+libgeoip1:amd64
+libgirepository-1.0-1:amd64
+libglib2.0-0:amd64
+libglib2.0-bin
+libglib2.0-data
+libglib2.0-dev:amd64
+libglib2.0-dev-bin
+libgmp10:amd64
+libgnutls30:amd64
+libgomp1:amd64
+libgpg-error0:amd64
+libgpm2:amd64
+libgraphite2-3:amd64
+libgraphite2-dev:amd64
+libgssapi3-heimdal:amd64
+libgssapi-krb5-2:amd64
+libgstreamer1.0-0:amd64
+libgstreamer-plugins-base1.0-0:amd64
+libgstreamer-plugins-good1.0-0:amd64
+libgudev-1.0-0:amd64
+libharfbuzz0b:amd64
+libharfbuzz-dev:amd64
+libharfbuzz-gobject0:amd64
+libharfbuzz-icu0:amd64
+libhcrypto4-heimdal:amd64
+libheimbase1-heimdal:amd64
+libheimntlm0-heimdal:amd64
+libhogweed4:amd64
+libhtml-parser-perl
+libhtml-tagset-perl
+libhtml-template-perl
+libhttp-date-perl
+libhttp-message-perl
+libhx509-5-heimdal:amd64
+libibverbs1:amd64
+libicu60:amd64
+libicu-dev
+libicu-le-hb0:amd64
+libicu-le-hb-dev:amd64
+libiculx60:amd64
+libidn11:amd64
+libidn2-0:amd64
+libiec61883-0:amd64
+libio-html-perl
+libip4tc0:amd64
+libip6tc0:amd64
+libipset3:amd64
+libiptc0:amd64
+libirs160:amd64
+libisc169:amd64
+libisccc160:amd64
+libisccfg160:amd64
+libisc-export169:amd64
+libiscsi7:amd64
+libisl19:amd64
+libisns0:amd64
+libitm1:amd64
+libjack-jackd2-0:amd64
+libjbig0:amd64
+libjemalloc1
+libjpeg8:amd64
+libjpeg-turbo8:amd64
+libjs-jquery
+libjson-c3:amd64
+libjs-sphinxdoc
+libjs-underscore
+libk5crypto3:amd64
+libkeyutils1:amd64
+libklibc
+libkmod2:amd64
+libkrb5-26-heimdal:amd64
+libkrb5-3:amd64
+libkrb5support0:amd64
+libksba8:amd64
+libldap-2.4-2:amd64
+libldap-common
+liblocale-gettext-perl
+liblsan0:amd64
+libltdl7
+liblvm2app2.2:amd64
+liblvm2cmd2.02:amd64
+liblwp-mediatypes-perl
+liblwres160:amd64
+liblxc1
+liblxc-common
+liblz4-1:amd64
+liblzma5:amd64
+liblzo2-2:amd64
+libmagic1:amd64
+libmagic-mgc
+libmnl0:amd64
+libmount1:amd64
+libmp3lame0:amd64
+libmpc3:amd64
+libmpdec2:amd64
+libmpfr6:amd64
+libmpg123-0:amd64
+libmpx2:amd64
+libmspack0:amd64
+libmysqlclient20:amd64
+libncurses5:amd64
+libncursesw5:amd64
+libnetcf1:amd64
+libnetfilter-conntrack3:amd64
+libnettle6:amd64
+libnewt0.52:amd64
+libnfnetlink0:amd64
+libnghttp2-14:amd64
+libnginx-mod-http-geoip
+libnginx-mod-http-image-filter
+libnginx-mod-http-xslt-filter
+libnginx-mod-mail
+libnginx-mod-stream
+libnih1:amd64
+libnl-3-200:amd64
+libnl-genl-3-200:amd64
+libnl-route-3-200:amd64
+libnorm1:amd64
+libnpth0:amd64
+libnspr4:amd64
+libnss3:amd64
+libnss-systemd:amd64
+libntfs-3g88
+libnuma1:amd64
+libogg0:amd64
+libopenipmi0
+libopus0:amd64
+liborc-0.4-0:amd64
+libp11-kit0:amd64
+libpam0g:amd64
+libpam-cap:amd64
+libpam-modules:amd64
+libpam-modules-bin
+libpam-runtime
+libpam-systemd:amd64
+libpango-1.0-0:amd64
+libpangocairo-1.0-0:amd64
+libpangoft2-1.0-0:amd64
+libparted2:amd64
+libpcap0.8:amd64
+libpci3:amd64
+libpciaccess0:amd64
+libpcre16-3:amd64
+libpcre32-3:amd64
+libpcre3:amd64
+libpcre3-dev:amd64
+libpcrecpp0v5:amd64
+libperl5.26:amd64
+libpgm-5.2-0:amd64
+libpipeline1:amd64
+libpixman-1-0:amd64
+libplymouth4:amd64
+libpng16-16:amd64
+libpolkit-agent-1-0:amd64
+libpolkit-backend-1-0:amd64
+libpolkit-gobject-1-0:amd64
+libpopt0:amd64
+libprocps6:amd64
+libproxy1v5:amd64
+libpsl5:amd64
+libpulse0:amd64
+libpython2.7:amd64
+libpython2.7-dev:amd64
+libpython2.7-minimal:amd64
+libpython2.7-stdlib:amd64
+libpython3.6:amd64
+libpython3.6-dev:amd64
+libpython3.6-minimal:amd64
+libpython3.6-stdlib:amd64
+libpython3-dev:amd64
+libpython3-stdlib:amd64
+libpython-all-dev:amd64
+libpython-dev:amd64
+libpython-stdlib:amd64
+libquadmath0:amd64
+librados2
+libraw1394-11:amd64
+librbd1
+librdmacm1:amd64
+libreadline5:amd64
+libreadline7:amd64
+libroken18-heimdal:amd64
+librtmp1:amd64
+libsamplerate0:amd64
+libsasl2-2:amd64
+libsasl2-modules:amd64
+libsasl2-modules-db:amd64
+libsdl1.2debian:amd64
+libseccomp2:amd64
+libselinux1:amd64
+libsemanage1:amd64
+libsemanage-common
+libsensors4:amd64
+libsepol1:amd64
+libshout3:amd64
+libsigsegv2:amd64
+libslang2:amd64
+libsmartcols1:amd64
+libsndfile1:amd64
+libsnmp30:amd64
+libsnmp-base
+libsodium23:amd64
+libsoup2.4-1:amd64
+libspeex1:amd64
+libspice-server1:amd64
+libsqlite3-0:amd64
+libss2:amd64
+libssl1.0.0:amd64
+libssl1.1:amd64
+libssl-dev:amd64
+libstdc++6:amd64
+libstdc++-7-dev:amd64
+libsystemd0:amd64
+libtag1v5:amd64
+libtag1v5-vanilla:amd64
+libtasn1-6:amd64
+libterm-readkey-perl
+libtext-charwidth-perl
+libtext-iconv-perl
+libtext-wrapi18n-perl
+libthai0:amd64
+libthai-data
+libtheora0:amd64
+libtiff5:amd64
+libtimedate-perl
+libtinfo5:amd64
+libtsan0:amd64
+libtwolame0:amd64
+libubsan0:amd64
+libudev1:amd64
+libunistring2:amd64
+libunwind8:amd64
+liburi-perl
+libusb-1.0-0:amd64
+libusbredirparser1:amd64
+libutempter0:amd64
+libuuid1:amd64
+libv4l-0:amd64
+libv4lconvert0:amd64
+libvirt0:amd64
+libvirt-bin
+libvirt-clients
+libvirt-daemon
+libvirt-daemon-driver-storage-rbd
+libvirt-daemon-system
+libvirt-dev:amd64
+libvisual-0.4-0:amd64
+libvorbis0a:amd64
+libvorbisenc2:amd64
+libvpx5:amd64
+libwavpack1:amd64
+libwebp6:amd64
+libwind0-heimdal:amd64
+libwrap0:amd64
+libwsman1:amd64
+libwsman-client4:amd64
+libwsman-curl-client-transport1:amd64
+libx11-6:amd64
+libx11-data
+libxau6:amd64
+libxcb1:amd64
+libxcb-render0:amd64
+libxcb-shm0:amd64
+libxdamage1:amd64
+libxdmcp6:amd64
+libxen-4.9:amd64
+libxen-dev:amd64
+libxenstore3.0:amd64
+libxext6:amd64
+libxfixes3:amd64
+libxml2:amd64
+libxml2-dev:amd64
+libxml2-utils
+libxmlsec1:amd64
+libxmlsec1-openssl:amd64
+libxmuu1:amd64
+libxpm4:amd64
+libxrender1:amd64
+libxslt1.1:amd64
+libxslt1-dev:amd64
+libxtables12:amd64
+libxv1:amd64
+libyajl2:amd64
+libyaml-0-2:amd64
+libzmq5:amd64
+libzstd1:amd64
+linux-base
+linux-firmware
+linux-headers-4.15.0-20
+linux-headers-4.15.0-20-generic
+linux-headers-generic
+linux-headers-virtual
+linux-image-4.15.0-20-generic
+linux-image-4.15.0-88-generic
+linux-image-generic
+linux-image-virtual
+linux-libc-dev:amd64
+linux-modules-4.15.0-20-generic
+linux-modules-4.15.0-88-generic
+linux-modules-extra-4.15.0-88-generic
+linux-virtual
+locales
+login
+logrotate
+lsb-base
+lsb-release
+lshw
+lsof
+ltrace
+lvm2
+lxcfs
+lxd
+lxd-client
+make
+man-db
+manpages
+manpages-dev
+mariadb-client-10.1
+mariadb-client-core-10.1
+mariadb-common
+mariadb-server
+mariadb-server-10.1
+mariadb-server-core-10.1
+mawk
+mdadm
+mime-support
+mlocate
+mokutil
+mount
+msr-tools
+mtr-tiny
+multiarch-support
+mysql-common
+nano
+ncurses-base
+ncurses-bin
+ncurses-term
+netbase
+netcat-openbsd
+netplan.io
+net-tools
+networkd-dispatcher
+nginx
+nginx-common
+nginx-core
+nplan
+ntfs-3g
+openipmi
+open-iscsi
+openssh-client
+openssh-server
+openssh-sftp-server
+openssl
+open-vm-tools
+os-prober
+overlayroot
+parted
+passwd
+pastebinit
+patch
+pciutils
+perl
+perl-base
+perl-modules-5.26
+pinentry-curses
+pkg-config
+plymouth
+plymouth-theme-ubuntu-text
+policykit-1
+pollinate
+popularity-contest
+powermgmt-base
+procps
+psmisc
+publicsuffix
+python
+python2.7
+python2.7-dev
+python2.7-minimal
+python3
+python3.6
+python3.6-dev
+python3.6-minimal
+python3-apport
+python3-apt
+python3-asn1crypto
+python3-attr
+python3-automat
+python3-blinker
+python3-certifi
+python3-cffi-backend
+python3-chardet
+python3-click
+python3-colorama
+python3-commandnotfound
+python3-configobj
+python3-constantly
+python3-crypto
+python3-cryptography
+python3-dbus
+python3-debconf
+python3-debian
+python3-dev
+python3-distro-info
+python3-distupgrade
+python3-distutils
+python3-gdbm:amd64
+python3-gi
+python3-httplib2
+python3-hyperlink
+python3-idna
+python3-incremental
+python3-jinja2
+python3-jsonpatch
+python3-json-pointer
+python3-jsonschema
+python3-jwt
+python3-keyring
+python3-keyrings.alt
+python3-lib2to3
+python3-markupsafe
+python3-minimal
+python3-mysqldb
+python3-newt:amd64
+python3-oauthlib
+python3-openssl
+python3-pam
+python3-pip
+python3-pkg-resources
+python3-problem-report
+python3-pyasn1
+python3-pyasn1-modules
+python3-pymysql
+python3-requests
+python3-requests-unixsocket
+python3-secretstorage
+python3-serial
+python3-service-identity
+python3-setuptools
+python3-six
+python3-software-properties
+python3-systemd
+python3-twisted
+python3-twisted-bin:amd64
+python3-update-manager
+python3-urllib3
+python3-virtualenv
+python3-wheel
+python3-xdg
+python3-yaml
+python3-zmq
+python3-zope.interface
+python-all
+python-all-dev
+python-apt
+python-apt-common
+python-asn1crypto
+python-cffi-backend
+python-configparser
+python-crypto
+python-cryptography
+python-dbus
+python-dev
+python-enum34
+python-gi
+python-idna
+python-ipaddress
+python-keyring
+python-keyrings.alt
+python-minimal
+python-mysqldb
+python-openwsman
+python-pip
+python-pip-whl
+python-pkg-resources
+python-pymysql
+python-secretstorage
+python-setuptools
+python-six
+python-virtualenv
+python-wheel
+python-xdg
+qemu-block-extra:amd64
+qemu-kvm
+qemu-system-common
+qemu-system-x86
+qemu-utils
+readline-common
+rsync
+rsyslog
+run-one
+sbsigntool
+screen
+seabios
+secureboot-db
+sed
+sensible-utils
+sgabios
+shared-mime-info
+sharutils
+shim
+shim-signed
+snapd
+socat
+software-properties-common
+sosreport
+squashfs-tools
+ssh-import-id
+strace
+sudo
+systemd
+systemd-sysv
+sysvinit-utils
+tar
+tcpdump
+telnet
+tftpd-hpa
+tftp-hpa
+time
+tmux
+tzdata
+ubuntu-advantage-tools
+ubuntu-keyring
+ubuntu-minimal
+ubuntu-release-upgrader-core
+ubuntu-server
+ubuntu-standard
+ucf
+udev
+ufw
+uidmap
+unattended-upgrades
+unzip
+update-inetd
+update-manager-core
+update-notifier-common
+ureadahead
+usbutils
+util-linux
+uuid-runtime
+vim
+vim-common
+vim-runtime
+vim-tiny
+virtualenv
+wget
+whiptail
+wireless-regdb
+xauth
+xdelta3
+xdg-user-dirs
+xfsprogs
+xinetd
+xkb-data
+xxd
+xz-utils
+zerofree
+zlib1g:amd64
+zlib1g-dev:amd64
+# NOTE (fdegir): pinned docker versions
+docker-ce={{ docker_ce_version }}
+docker-ce-cli={{ docker_ce_cli_version }}
+containerd.io={{ containerd_io_version }}
diff --git a/playbooks/roles/package/vars/Debian.yaml b/playbooks/roles/package/vars/Debian.yaml
new file mode 100644
index 0000000..2c0c7a5
--- /dev/null
+++ b/playbooks/roles/package/vars/Debian.yaml
@@ -0,0 +1,29 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# package names
+packages:
+ - dpkg-dev
+ - docker-ce={{ docker_ce_version }}
+ - docker-ce-cli={{ docker_ce_cli_version }}
+ - containerd.io={{ containerd_io_version }}
+
+# service names
+docker_service_name: docker
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/prepare-artifacts/files/load_containerimages.sh b/playbooks/roles/prepare-artifacts/files/load_containerimages.sh
new file mode 100755
index 0000000..0a5702a
--- /dev/null
+++ b/playbooks/roles/prepare-artifacts/files/load_containerimages.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+TEMP=$1
+CONTAINERDIR="${TEMP:-"/opt/test/onap/offline/containers"}"
+
+cd "$CONTAINERDIR"
+
+for dockerfile in *.tar
+do
+ docker load < "$dockerfile"
+done
+
+# Proposed multithreaded approach tha seemed to work but is mothballed for now
+# find . -name \*.tar -print > /tmp/containerlist.txt
+# load containers in parallel
+# xargs -n 1 -P 4 docker load -i < /tmp/containerlist.txt
diff --git a/playbooks/roles/prepare-artifacts/files/push_containerimages.sh b/playbooks/roles/prepare-artifacts/files/push_containerimages.sh
new file mode 100755
index 0000000..3351582
--- /dev/null
+++ b/playbooks/roles/prepare-artifacts/files/push_containerimages.sh
@@ -0,0 +1,47 @@
+#!/bin/bash -x
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+set -o nounset
+set -o errexit
+
+TEMP=$1
+SERVERFQDN="${TEMP:-"engine.local"}"
+TEMP=$2
+TMPDIR="${TEMP:-"/tmp"}"
+
+# get list of existing "local" images
+docker images --format '{{ .Repository }}':'{{ .Tag }}'" "'{{ .ID }}' | grep -v 'argv[0]\|<none>' | grep "$SERVERFQDN" | sort > "$TMPDIR"/existinglocal_list.txt
+
+# get list of all non "local" images
+docker images --format '{{ .Repository }}':'{{ .Tag }}'" "'{{ .ID }}' | grep -v 'argv[0]\|<none>' | grep -v "$SERVERFQDN" > "$TMPDIR"/imagenonlocal_list.txt
+sed -i 's/^[a-zA-Z0-9:\.]*.io\///g' "$TMPDIR"/imagenonlocal_list.txt
+sed -i 's/^[a-zA-Z0-9:\.]*onap.org:10001\///g' "$TMPDIR"/imagenonlocal_list.txt
+# prepend the SERVERFQDN to the tag
+awk -v VAR="$SERVERFQDN" '{print VAR"/"$0}' "$TMPDIR"/imagenonlocal_list.txt | sort > "$TMPDIR"/newimage_list.txt
+
+# find the new entries
+comm -23 "$TMPDIR"/newimage_list.txt "$TMPDIR"/existinglocal_list.txt > "$TMPDIR"/onlynewdocker_list.txt
+# find how many new entries
+NEWENTRIES=$(wc -l < "$TMPDIR"/onlynewdocker_list.txt )
+if [[ $NEWENTRIES -gt 0 ]]
+then
+ # tag the new entries
+ awk '{print $2 " " $1 }' "$TMPDIR"/onlynewdocker_list.txt | xargs -n 2 --max-procs=1 docker tag
+ # push the new entries in parallel
+ awk '{print $1 }' "$TMPDIR"/onlynewdocker_list.txt | xargs -n 1 --max-procs=4 docker push
+fi
diff --git a/playbooks/roles/prepare-artifacts/tasks/main.yaml b/playbooks/roles/prepare-artifacts/tasks/main.yaml
new file mode 100644
index 0000000..6c5bdb1
--- /dev/null
+++ b/playbooks/roles/prepare-artifacts/tasks/main.yaml
@@ -0,0 +1,74 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2021 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+- name: Ensure {{ test_workspace }} exists
+ file:
+ path: "{{ test_workspace }}"
+ state: directory
+ mode: '0755'
+
+- name: Synchronize container images with jumphost
+ synchronize:
+ src: "{{ test_workspace }}/offline/containers"
+ dest: "{{ test_workspace }}/onap/offline"
+ recursive: true
+ delete: true
+ register: result
+ retries: 3
+ delay: 10
+ until: result is not failed
+
+- name: create temporary dir
+ tempfile:
+ state: directory
+ suffix: temp
+ register: dockerpulldir
+
+- name: copy push_containerimages.sh script to remote
+ copy:
+ dest: "{{ dockerpulldir.path }}"
+ src: push_containerimages.sh
+ mode: '0755'
+ force: true
+
+- name: copy load_containerimages.sh script to remote
+ copy:
+ dest: "{{ dockerpulldir.path }}"
+ src: load_containerimages.sh
+ mode: '0755'
+ force: true
+
+# NOTE (eeiafr): the user may not be member of docker group so we need root
+# this can be slow so run asych
+- name: Load xtesting container images from tarfiles
+ shell: "cd {{ dockerpulldir.path }}; ./load_containerimages.sh {{ test_workspace }}/onap/offline/containers"
+ async: 3600
+ poll: 30
+ changed_when: false
+ become: true
+
+# NOTE (eeiafr): the user may not be member of docker group so we need root
+- name: This can take a long time to push all the images
+ shell: "cd {{ dockerpulldir.path }}; ./push_containerimages.sh {{ server_fqdn }} {{ dockerpulldir.path }}"
+ async: 3600
+ poll: 30
+ changed_when: false
+ become: true
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/prepare-testframework/tasks/main.yaml b/playbooks/roles/prepare-testframework-offline/tasks/main.yaml
similarity index 100%
rename from playbooks/roles/prepare-testframework/tasks/main.yaml
rename to playbooks/roles/prepare-testframework-offline/tasks/main.yaml
diff --git a/playbooks/roles/prepare-testframework/tasks/prepare-xtesting-healthcheck.yaml b/playbooks/roles/prepare-testframework-offline/tasks/prepare-xtesting-healthcheck.yaml
similarity index 69%
copy from playbooks/roles/prepare-testframework/tasks/prepare-xtesting-healthcheck.yaml
copy to playbooks/roles/prepare-testframework-offline/tasks/prepare-xtesting-healthcheck.yaml
index 895af93..60cb734 100644
--- a/playbooks/roles/prepare-testframework/tasks/prepare-xtesting-healthcheck.yaml
+++ b/playbooks/roles/prepare-testframework-offline/tasks/prepare-xtesting-healthcheck.yaml
@@ -19,9 +19,10 @@
- name: Set test work and result directories
set_fact:
- testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ test_type }}"
+ testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}"
testfw_configdir: "{{ config_path }}/{{ test_framework }}"
- testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ test_type }}/results"
+ testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}/results"
+
- name: Ensure {{ testfw_workdir }} exists and empty
file:
path: "{{ testfw_workdir }}"
@@ -61,25 +62,45 @@
src: healthcheck-testcases.yaml.j2
dest: "{{ testfw_configdir }}/testcases.yaml"
-- name: Delete existing {{ healthcheck_config_map }}
+- name: Create cmd.sh file
+ copy:
+ dest: "{{ testfw_configdir }}/cmd.sh"
+ content: |
+ #!/bin/sh
+ run_tests -t ${TAG} || true
+
+- name: Delete existing {{ healthcheck_cm_testcases }}
k8s:
- name: "{{ healthcheck_config_map }}"
+ name: "{{ healthcheck_cm_testcases }}"
kind: ConfigMap
api_version: v1
state: absent
namespace: onap
-- name: Create xtesting healthcheck testcases ConfigMap - {{ healthcheck_config_map }}
- shell: kubectl create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
+- name: Delete existing {{ healthcheck_cm_run }}
+ k8s:
+ name: "{{ healthcheck_cm_run }}"
+ kind: ConfigMap
+ api_version: v1
+ state: absent
+ namespace: onap
+
+
+- name: Create ConfigMap - {{ healthcheck_cm_testcases }}
+ shell: kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_cm_testcases }} --from-file "{{ testfw_configdir }}/testcases.yaml"
+
+- name: Create ConfigMap - {{ healthcheck_cm_run }}
+ shell: kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_cm_run }} --from-file "{{ testfw_configdir }}/cmd.sh"
+
# eprasad: there is bug in ansible k8s module, removing a job doest not remove pods assisated with it hence using shell here.
- name: Delete healthcheck job
- shell: "kubectl delete job xtesting-onap-{{ test_type }} -n onap"
+ shell: "kubectl -n {{ onap_namespace }} delete job xtesting-onap-{{ healthcheck_test_tier }}"
ignore_errors: yes
- name: Construct and save healthcheck testsuite deployment to file
template:
src: "healthcheck_deployment.yaml.j2"
- dest: "{{ testfw_configdir }}/healthcheck-{{ test_type }}.yaml"
+ dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml"
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/prepare-testframework/tasks/prepare-xtesting-infra-healthcheck.yaml b/playbooks/roles/prepare-testframework-offline/tasks/prepare-xtesting-infra-healthcheck.yaml
similarity index 100%
rename from playbooks/roles/prepare-testframework/tasks/prepare-xtesting-infra-healthcheck.yaml
rename to playbooks/roles/prepare-testframework-offline/tasks/prepare-xtesting-infra-healthcheck.yaml
diff --git a/playbooks/roles/prepare-testframework/templates/healthcheck-testcases.yaml.j2 b/playbooks/roles/prepare-testframework-offline/templates/healthcheck-testcases.yaml.j2
similarity index 100%
rename from playbooks/roles/prepare-testframework/templates/healthcheck-testcases.yaml.j2
rename to playbooks/roles/prepare-testframework-offline/templates/healthcheck-testcases.yaml.j2
diff --git a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.yaml.j2 b/playbooks/roles/prepare-testframework-offline/templates/healthcheck_deployment.yaml.j2
similarity index 60%
copy from playbooks/roles/prepare-testframework/templates/healthcheck_deployment.yaml.j2
copy to playbooks/roles/prepare-testframework-offline/templates/healthcheck_deployment.yaml.j2
index 1a44f5f..59ab543 100644
--- a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.yaml.j2
+++ b/playbooks/roles/prepare-testframework-offline/templates/healthcheck_deployment.yaml.j2
@@ -1,26 +1,26 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: "xtesting-onap-{{ test_type }}"
- namespace: onap
+ name: "xtesting-onap-{{ healthcheck_test_tier }}"
+ namespace: "{{ onap_namespace}}"
spec:
template:
spec:
containers:
- env:
- name: INSTALLER_TYPE
- value: kubespray-oom
+ value: "{{ lookup('env', 'INSTALLER_TYPE') | default('kubespray-oom', true) }}"
- name: DEPLOY_SCENARIO
value: "{{ deploy_scenario }}"
- name: NODE_NAME
- value: {{ lookup('env', 'POD_NAME') | default('noname', true) }}
+ value: "{{ lookup('env', 'POD_NAME') | default('noname', true) }}"
- name: TEST_DB_URL
- value: http://testresults.opnfv.org/onap/api/v1/results
+ value: "{{ lookup('env', 'TEST_DB_URL') | default('http://testresults.opnfv.org/onap/api/v1/results', true) }}"
- name: BUILD_TAG
value: "{{ lookup('env', 'BUILD_TAG') | default('notag', true) }}"
- name: TAG
- value: "{{ test_type }}"
- image: "{{ testfw_image_name }}@sha256:{{ testfw_image_version }}"
+ value: "{{ healthcheck_test_tier }}"
+ image: "{{ xtesting_image_repo }}/{{ testfw_image_name }}:{{ test_stack_version }}"
imagePullPolicy: IfNotPresent
name: xtesting-onap
volumeMounts:
@@ -33,7 +33,10 @@
name: robot-save-results
- mountPath: /usr/lib/python3.7/site-packages/xtesting/ci/testcases.yaml
subPath: testcases.yaml
- name: "{{ healthcheck_config_map }}"
+ name: "{{ healthcheck_cm_testcases }}"
+ - mountPath: /cmd.sh
+ subPath: cmd.sh
+ name: "{{ healthcheck_cm_run }}"
restartPolicy: OnFailure
volumes:
- hostPath:
@@ -45,8 +48,12 @@
name: robot-eteshare
- configMap:
defaultMode: 493
- name: "{{ healthcheck_config_map }}"
- name: "{{ healthcheck_config_map }}"
+ name: "{{ healthcheck_cm_testcases }}"
+ name: "{{ healthcheck_cm_testcases }}"
+ - configMap:
+ defaultMode: 493
+ name: "{{ healthcheck_cm_run }}"
+ name: "{{ healthcheck_cm_run }}"
- hostPath:
path: "{{ testfw_resultdir }}"
type: DirectoryOrCreate
diff --git a/playbooks/roles/prepare-testframework-offline/templates/xtesting.env.j2 b/playbooks/roles/prepare-testframework-offline/templates/xtesting.env.j2
new file mode 100644
index 0000000..aeb3da6
--- /dev/null
+++ b/playbooks/roles/prepare-testframework-offline/templates/xtesting.env.j2
@@ -0,0 +1,5 @@
+BUILD_TAG={{ lookup('env', 'BUILD_TAG') }}
+ENERGY_RECORDER_API_URL=http://energy.opnfv.fr/resources
+CI_LOOP=daily
+INSTALLER_TYPE=kubespray-oom
+NODE_NAME={{ lookup('env', 'POD_NAME') | default('noname', true) }}
diff --git a/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2 b/playbooks/roles/prepare-testframework-offline/templates/xtesting.sh.j2
similarity index 69%
rename from playbooks/roles/prepare-testframework/templates/xtesting.sh.j2
rename to playbooks/roles/prepare-testframework-offline/templates/xtesting.sh.j2
index 226ba86..75b6a9c 100755
--- a/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2
+++ b/playbooks/roles/prepare-testframework-offline/templates/xtesting.sh.j2
@@ -5,8 +5,8 @@
sudo docker run --rm --env-file {{ testfw_workdir }}/xtesting.env \
-v $HOME/.kube/config:/root/.kube/config \
-v {{ testfw_resultdir }}:/var/lib/xtesting/results \
- {{ testfw_image_name }}@sha256:{{ testfw_image_version }} \
- run_tests -r -t {{ testcase }}
+ {{ xtesting_image_repo }}/{{ testfw_image_name }}:{{ test_stack_version }} \
+ run_tests -t {{ testcase }}
retval=$(($retval + $?))
exit $retval
diff --git a/playbooks/roles/prepare-testframework-offline/vars/main.yaml b/playbooks/roles/prepare-testframework-offline/vars/main.yaml
new file mode 100644
index 0000000..f0d1e37
--- /dev/null
+++ b/playbooks/roles/prepare-testframework-offline/vars/main.yaml
@@ -0,0 +1,24 @@
+---
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+testcase: all
+healthcheck_cm_testcases: xtesting-healthcheck-testsuit-config-map
+healthcheck_cm_run: xtesting-healthcheck-run-config-map
+
+# xtesting container image repo for offline test
+xtesting_image_repo: engine.local/onap
diff --git a/playbooks/roles/prepare-testframework/tasks/main.yaml b/playbooks/roles/prepare-testframework-online/tasks/main.yaml
similarity index 100%
copy from playbooks/roles/prepare-testframework/tasks/main.yaml
copy to playbooks/roles/prepare-testframework-online/tasks/main.yaml
diff --git a/playbooks/roles/prepare-testframework/tasks/prepare-xtesting-healthcheck.yaml b/playbooks/roles/prepare-testframework-online/tasks/prepare-xtesting-healthcheck.yaml
similarity index 86%
rename from playbooks/roles/prepare-testframework/tasks/prepare-xtesting-healthcheck.yaml
rename to playbooks/roles/prepare-testframework-online/tasks/prepare-xtesting-healthcheck.yaml
index 895af93..781714e 100644
--- a/playbooks/roles/prepare-testframework/tasks/prepare-xtesting-healthcheck.yaml
+++ b/playbooks/roles/prepare-testframework-online/tasks/prepare-xtesting-healthcheck.yaml
@@ -19,9 +19,10 @@
- name: Set test work and result directories
set_fact:
- testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ test_type }}"
+ testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}"
testfw_configdir: "{{ config_path }}/{{ test_framework }}"
- testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ test_type }}/results"
+ testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}/results"
+
- name: Ensure {{ testfw_workdir }} exists and empty
file:
path: "{{ testfw_workdir }}"
@@ -70,16 +71,16 @@
namespace: onap
- name: Create xtesting healthcheck testcases ConfigMap - {{ healthcheck_config_map }}
- shell: kubectl create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
+ shell: kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
# eprasad: there is bug in ansible k8s module, removing a job doest not remove pods assisated with it hence using shell here.
- name: Delete healthcheck job
- shell: "kubectl delete job xtesting-onap-{{ test_type }} -n onap"
+ shell: "kubectl -n {{ onap_namespace }} delete job xtesting-onap-{{ healthcheck_test_tier }}"
ignore_errors: yes
- name: Construct and save healthcheck testsuite deployment to file
template:
src: "healthcheck_deployment.yaml.j2"
- dest: "{{ testfw_configdir }}/healthcheck-{{ test_type }}.yaml"
+ dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml"
# vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/prepare-testframework/tasks/prepare-xtesting-infra-healthcheck.yaml b/playbooks/roles/prepare-testframework-online/tasks/prepare-xtesting-infra-healthcheck.yaml
similarity index 100%
copy from playbooks/roles/prepare-testframework/tasks/prepare-xtesting-infra-healthcheck.yaml
copy to playbooks/roles/prepare-testframework-online/tasks/prepare-xtesting-infra-healthcheck.yaml
diff --git a/playbooks/roles/prepare-testframework/templates/healthcheck-testcases.yaml.j2 b/playbooks/roles/prepare-testframework-online/templates/healthcheck-testcases.yaml.j2
similarity index 100%
copy from playbooks/roles/prepare-testframework/templates/healthcheck-testcases.yaml.j2
copy to playbooks/roles/prepare-testframework-online/templates/healthcheck-testcases.yaml.j2
diff --git a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.yaml.j2 b/playbooks/roles/prepare-testframework-online/templates/healthcheck_deployment.yaml.j2
similarity index 75%
rename from playbooks/roles/prepare-testframework/templates/healthcheck_deployment.yaml.j2
rename to playbooks/roles/prepare-testframework-online/templates/healthcheck_deployment.yaml.j2
index 1a44f5f..d647a3e 100644
--- a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.yaml.j2
+++ b/playbooks/roles/prepare-testframework-online/templates/healthcheck_deployment.yaml.j2
@@ -1,26 +1,26 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: "xtesting-onap-{{ test_type }}"
- namespace: onap
+ name: "xtesting-onap-{{ healthcheck_test_tier }}"
+ namespace: "{{ onap_namespace}} "
spec:
template:
spec:
containers:
- env:
- name: INSTALLER_TYPE
- value: kubespray-oom
+ value: "{{ lookup('env', 'INSTALLER_TYPE') | default('kubespray-oom', true) }}"
- name: DEPLOY_SCENARIO
value: "{{ deploy_scenario }}"
- name: NODE_NAME
- value: {{ lookup('env', 'POD_NAME') | default('noname', true) }}
+ value: "{{ lookup('env', 'POD_NAME') | default('noname', true) }}"
- name: TEST_DB_URL
- value: http://testresults.opnfv.org/onap/api/v1/results
+ value: "{{ lookup('env', 'TEST_DB_URL') | default('http://testresults.opnfv.org/onap/api/v1/results', true) }}"
- name: BUILD_TAG
value: "{{ lookup('env', 'BUILD_TAG') | default('notag', true) }}"
- name: TAG
- value: "{{ test_type }}"
- image: "{{ testfw_image_name }}@sha256:{{ testfw_image_version }}"
+ value: "{{ healthcheck_test_tier }}"
+ image: "{{ xtesting_image_repo }}/{{ testfw_image_name }}@sha256:{{ testfw_image_version }}"
imagePullPolicy: IfNotPresent
name: xtesting-onap
volumeMounts:
diff --git a/playbooks/roles/prepare-testframework/templates/xtesting.env.j2 b/playbooks/roles/prepare-testframework-online/templates/xtesting.env.j2
similarity index 100%
rename from playbooks/roles/prepare-testframework/templates/xtesting.env.j2
rename to playbooks/roles/prepare-testframework-online/templates/xtesting.env.j2
diff --git a/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2 b/playbooks/roles/prepare-testframework-online/templates/xtesting.sh.j2
similarity index 67%
copy from playbooks/roles/prepare-testframework/templates/xtesting.sh.j2
copy to playbooks/roles/prepare-testframework-online/templates/xtesting.sh.j2
index 226ba86..947ccf6 100755
--- a/playbooks/roles/prepare-testframework/templates/xtesting.sh.j2
+++ b/playbooks/roles/prepare-testframework-online/templates/xtesting.sh.j2
@@ -5,8 +5,8 @@
sudo docker run --rm --env-file {{ testfw_workdir }}/xtesting.env \
-v $HOME/.kube/config:/root/.kube/config \
-v {{ testfw_resultdir }}:/var/lib/xtesting/results \
- {{ testfw_image_name }}@sha256:{{ testfw_image_version }} \
- run_tests -r -t {{ testcase }}
+ {{ xtesting_image_repo }}/{{ testfw_image_name }}@sha256:{{ testfw_image_version }} \
+ run_tests -t {{ testcase }}
retval=$(($retval + $?))
exit $retval
diff --git a/playbooks/roles/prepare-testframework/vars/main.yaml b/playbooks/roles/prepare-testframework-online/vars/main.yaml
similarity index 100%
rename from playbooks/roles/prepare-testframework/vars/main.yaml
rename to playbooks/roles/prepare-testframework-online/vars/main.yaml
diff --git a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.j2 b/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.j2
deleted file mode 100644
index 559a3c2..0000000
--- a/playbooks/roles/prepare-testframework/templates/healthcheck_deployment.j2
+++ /dev/null
@@ -1,46 +0,0 @@
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: "xtesting-onap-{{ test_type }}"
- namespace: onap
-spec:
- template:
- spec:
- containers:
- - env:
- - name: INSTALLER_TYPE
- value: kubespray-oom
- - name: DEPLOY_SCENARIO
- value: "{{ deploy_scenario }}"
- - name: NODE_NAME
- value: {{ lookup('env', 'POD_NAME') | default('noname', true) }}
- - name: TEST_DB_URL
- value: http://testresults.opnfv.org/onap/api/v1/results
- - name: BUILD_TAG
- value: "{{ lookup('env', 'BUILD_TAG') | default('notag', true) }}"
- - name: TAG
- value: "{{ test_type }}"
- image: "{{ testfw_image_name }}@sha256:{{ testfw_image_version }}"
- imagePullPolicy: Always
- name: xtesting-onap
- volumeMounts:
- - mountPath: /etc/localtime
- name: localtime
- readOnly: true
- - mountPath: /share/config
- name: robot-eteshare
- - mountPath: /var/lib/xtesting/results/
- name: robot-save-results
- restartPolicy: Never
- volumes:
- - hostPath:
- path: /etc/localtime
- name: localtime
- - configMap:
- defaultMode: 493
- name: onapdep-robot-eteshare-configmap
- name: robot-eteshare
- - hostPath:
- path: "{{ testfw_resultdir }}"
- type: DirectoryOrCreate
- name: robot-save-results
diff --git a/playbooks/roles/run-tests/tasks/healthcheck.yaml b/playbooks/roles/run-tests/tasks/healthcheck.yaml
index 736f6d2..c65035c 100644
--- a/playbooks/roles/run-tests/tasks/healthcheck.yaml
+++ b/playbooks/roles/run-tests/tasks/healthcheck.yaml
@@ -20,21 +20,21 @@
- name: start healthcheck job
k8s:
state: present
- src: "{{ config_path }}/xtesting/healthcheck-{{ test_type }}.yaml"
+ src: "{{ config_path }}/xtesting/healthcheck-{{ healthcheck_test_tier }}.yaml"
- name: Get the name of pod created by healthcheck job
- shell: kubectl get pods -l job-name=xtesting-onap-{{ test_type }} -o name --no-headers=true | sed 's/\<pod\>//g' | sed 's/\///'
+ shell: kubectl -n {{ onap_namespace }} get pods -l job-name=xtesting-onap-{{ healthcheck_test_tier }} -o name --no-headers=true | sed 's/\<pod\>//g' | sed 's/\///'
register: xtesting_pod
- name: Wait for healthcheck job to complete
- shell: "kubectl get pods {{ xtesting_pod.stdout }}"
+ shell: "kubectl -n {{ onap_namespace }} get pods {{ xtesting_pod.stdout }}"
register: healthcheck_pod
until: '" Completed " in healthcheck_pod.stdout'
retries: 100
delay: 4
- name: collect healthcheck testsuite logs
- shell: "kubectl logs {{ xtesting_pod.stdout }}"
+ shell: "kubectl -n {{ onap_namespace }} logs {{ xtesting_pod.stdout }}"
register: healthcheck_log
- name: Log healthcheck testsuite output to console
@@ -44,7 +44,7 @@
- name: Save healthcheck testsuite output on jumphost
copy:
content: "{{ healthcheck_log.stdout }}"
- dest: "{{ test_cache }}/xtesting/{{ test_type }}/results/xtesting.log"
+ dest: "{{ test_cache }}/xtesting/{{ healthcheck_test_tier }}/results/xtesting.log"
- name: Determine the test verdict
fail:
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..2f7916d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,57 @@
+#-------------------------------------------------------------------------------
+# This file contains test python requirement version pins.
+# Changing versions might have side effects!
+#-------------------------------------------------------------------------------
+
+# NOTE: test requirements
+
+ansible==2.9.6
+appdirs==1.4.4
+backports.ssl-match-hostname==3.7.0.1
+cachetools==3.1.1
+certifi==2020.12.5
+cffi==1.14.4
+chardet==4.0.0
+cryptography==3.3.1
+decorator==4.4.2
+dictdiffer==0.8.1
+docker==4.2.0
+dogpile.cache==0.9.2
+enum34==1.1.10
+futures==3.3.0
+git-review==1.28.0
+google-auth==1.24.0
+idna==2.10
+ipaddress==1.0.23
+iso8601==0.1.13
+Jinja2==2.11.2
+jmespath==0.10.0
+jsonpatch==1.28
+jsonpointer==2.0
+keystoneauth1==4.0.1
+kubernetes==11.0.0
+MarkupSafe==1.1.1
+munch==2.5.0
+netifaces==0.10.9
+oauthlib==3.1.0
+openshift==0.11.0
+openstacksdk==0.43.0
+os-service-types==1.7.0
+pbr==5.5.1
+pyasn1==0.4.8
+pyasn1-modules==0.2.8
+pycparser==2.20
+python-dateutil==2.8.1
+python-string-utils==0.6.0
+PyYAML==5.3.1
+requests==2.25.1
+requests-oauthlib==1.3.0
+requestsexceptions==1.4.0
+rsa==4.5
+ruamel.ordereddict==0.4.15
+ruamel.yaml==0.16.12
+ruamel.yaml.clib==0.2.2
+six==1.15.0
+stevedore==1.32.0
+urllib3==1.26.2
+websocket-client==0.57.0
diff --git a/test.sh b/test.sh
index 748ccea..1a275ca 100755
--- a/test.sh
+++ b/test.sh
@@ -28,6 +28,18 @@
export STACK_ROOT_DIR
#-------------------------------------------------------------------------------
+# Prepare artifacts for offline test
+#-------------------------------------------------------------------------------
+echo "Info: Prepare artifacts for offline test "
+echo "-------------------------------------------------------------------------"
+cd "${TEST_PATH}"
+ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
+-i "${TEST_PATH}/test/inventory/inventory.ini" \
+ "${STACK_ROOT_DIR}/playbooks/prepare-artifacts.yaml"
+echo "-------------------------------------------------------------------------"
+
+
+#-------------------------------------------------------------------------------
# Prepare test framework
#-------------------------------------------------------------------------------
echo "Info : Preparing test framework"
diff --git a/vars/onap.yaml b/vars/onap.yaml
index 87aaaec..c4ecd9e 100644
--- a/vars/onap.yaml
+++ b/vars/onap.yaml
@@ -32,19 +32,31 @@
framework:
xtesting:
infra-healthcheck:
- image_name: nexus3.onap.org:10001/onap/xtesting-infra-healthcheck
+ image_name: xtesting-infra-healthcheck
# latest xtesting-infra-healthcheck image as on 2020-24-11
image_version: '75a85a5ef784e115186696ea9953dcbf0f2175401958c578aa708e2e894dea96'
healthcheck:
- image_name: nexus3.onap.org:10001/onap/xtesting-healthcheck
+ image_name: xtesting-healthcheck
# latest xtesting-healthcheck image as on 2020-24-11
image_version: '261eac403f0ecaa39194ac655042b7f1b87c2f9a57155f0f6ef5ed1eb53b766b'
# Test to peform with healthcheck testsuite. core, full, healthdist, postinstall and auto
-# tests are supported by healthcheck testsuite.
-test_type: "{{ lookup('env','HEALTHCHECK_TEST_TYPE')| default('full', true) }}"
+# test tiers are supported by healthcheck testsuite.
+healthcheck_test_tier: "{{ lookup('env','HEALTHCHECK_TEST_TIER')| default('auto', true) }}"
# Helm chart to ignore for automated testcases selection for installed onap components
healthcheck_test_ignore_list: "cassandra|cert|consul|platform|mariadb|robot"
+# xtesting container image registry
+xtesting_image_repo: nexus3.onap.org:10001/onap
+
+# versions of docker as of 13.07.2020 needed for packaging
+docker_ce_version: "5:19.03.12~3-0~ubuntu-bionic"
+docker_ce_cli_version: "{{ docker_ce_version }}"
+docker_registry_version: "2.7.1"
+containerd_io_version: "1.2.13-2"
+
+#onap namespace
+onap_namespace: "onap"
+
# vim: set ts=2 sw=2 expandtab: