-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add first integration CI test to run on eco vcenter
- Loading branch information
1 parent
75cad2a
commit c008601
Showing
14 changed files
with
148 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
name: Ansible Eco vCenter Integration Test | ||
on: | ||
pull_request: | ||
branches: | ||
- '**' | ||
push: | ||
branches: | ||
- main | ||
- 'release-\d.\d\d' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
ansible_integration_test: | ||
runs-on: ["self-hosted", linux, X64] | ||
steps: | ||
- name: Update pip, git | ||
if: runner.os == 'Linux' && startsWith(runner.name, 'ubuntu') | ||
run: | | ||
set -euxo pipefail | ||
sudo apt-get update | ||
sudo apt-get install podman | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ansible_collections/cloud/vmware_ops | ||
|
||
- name: Generate integration config | ||
working-directory: ansible_collections/cloud/vmware_ops/scripts | ||
run: | | ||
chmod +x generate_integration_config.sh | ||
./generate_integration_config.sh | ||
env: | ||
VCENTER_HOSTNAME: ${{ secrets.VCENTER_HOSTNAME }} | ||
VCENTER_USERNAME: ${{ secrets.VCENTER_USERNAME }} | ||
VCENTER_PASSWORD: ${{ secrets.VCENTER_PASSWORD }} | ||
|
||
- name: Run integration tests | ||
working-directory: ansible_collections/cloud/vmware_ops | ||
run: | | ||
make eco-vcenter-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
* @bardielle | ||
* @machacekondra | ||
* @mikemorency | ||
# Default code owners for all files and directories | ||
* @bardielle @machacekondra @mikemorency | ||
|
||
# Integration tests permissions | ||
/tests/integration/ @shellymiron @elsapassaro | ||
|
||
# Specific workflow file permissions | ||
.github/workflows/eco-vcenter-ci.yaml @shellymiron @elsapassaro | ||
|
||
# Scripts directory permissions | ||
/scripts/ @shellymiron @elsapassaro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2155,SC2086 | ||
|
||
# Resolve the script's directory reliably | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" | ||
cd "$SCRIPT_DIR" || exit 1 | ||
|
||
# Truncate the output file | ||
truncate -s 0 integration_config.yml | ||
|
||
# Read the template and substitute environment variables | ||
while read -r line; do | ||
eval 'echo "'"$line"'"' >> integration_config.yml | ||
done < "integration_config.yml.tpl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
vcenter_hostname: ${VCENTER_HOSTNAME} | ||
vcenter_username: ${VCENTER_USERNAME} | ||
vcenter_password: ${VCENTER_PASSWORD} | ||
ansible_tags: eco-vcenter-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ pyVmomi>=6.7 | |
podman | ||
requests | ||
pycdlib | ||
git+https://github.com/vmware/vsphere-automation-sdk-python.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
collections: | ||
- name: community.general | ||
- name: ansible.posix | ||
- name: community.vmware | ||
- name: vmware.vmware_rest | ||
- name: vmware.vmware | ||
- name: containers.podman | ||
- name: https://github.com/redhat-cop/cloud.vmware_ops.git | ||
type: git | ||
version: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
- hosts: localhost | ||
gather_facts: no | ||
collections: | ||
- community.general | ||
vars_files: | ||
- vars.yml | ||
- name: Run Info Test Tasks | ||
hosts: localhost | ||
gather_facts: false | ||
|
||
tasks: | ||
|
||
- name: Import eco-vcenter credentials | ||
ansible.builtin.include_vars: | ||
file: ../../../../scripts/integration_config.yml | ||
tags: eco-vcenter-ci | ||
|
||
- name: Import vars for testing on eco-vcenter env | ||
ansible.builtin.include_vars: | ||
file: ../vars/main.yml | ||
tags: eco-vcenter-ci | ||
|
||
- name: Import simulator vars | ||
ansible.builtin.include_vars: | ||
file: vars.yml | ||
tags: integration-ci | ||
|
||
- name: Vcsim | ||
ansible.builtin.import_role: | ||
name: prepare_soap | ||
tags: integration-ci | ||
|
||
- name: Vcsim | ||
ansible.builtin.import_role: | ||
name: prepare_rest | ||
tags: integration-ci | ||
|
||
- name: Import info role | ||
ansible.builtin.import_role: | ||
name: info_test | ||
tags: | ||
- eco-vcenter-ci | ||
- integration-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
#!/usr/bin/env bash | ||
source ../init.sh | ||
exec ansible-playbook run.yml | ||
|
||
# Extract the ansible_tags from integration_config.yml | ||
ANSIBLE_TAGS=$(awk '/ansible_tags/ {print $2}' ../../../../scripts/integration_config.yml) | ||
|
||
# Check if the ANSIBLE_TAGS variable is set | ||
if [[ -n "$ANSIBLE_TAGS" ]]; then | ||
echo "ANSIBLE_TAGS is set to: $ANSIBLE_TAGS" | ||
exec ansible-playbook run.yml --tags "$ANSIBLE_TAGS" | ||
else | ||
echo "ANSIBLE_TAGS is not set for Eco vCenter. Running on simulator." | ||
exec ansible-playbook run.yml --tags integration-ci | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
info_hostname: "{{ vcenter_hostname }}" | ||
info_username: "{{ vcenter_username }}" | ||
info_password: "{{ vcenter_password }}" | ||
info_validate_certs: false | ||
info_appliance_file: "/tmp/info_appliance_file" | ||
info_license_file: "/tmp/info_license_file" | ||
info_storage_file: "/tmp/info_storage_file" | ||
info_guest_file: "/tmp/guest_info_file" | ||
info_license: true | ||
info_storage: true | ||
info_cluster: true | ||
info_guest: true | ||
info_appliance: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2155,SC2086 | ||
|
||
BASE_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
export ANSIBLE_ROLES_PATH=${BASE_DIR} | ||
export VALIDATED_COLLECTIONS_PATH="/home/kni/actions-runner/eco-vcenter/cloud.vmware_ops/cloud.vmware_ops/ansible_collections" | ||
export ALL_COLLECTIONS_PATH="$HOME/.ansible/collections/ansible_collections" | ||
|
||
# Export the collections path | ||
export ANSIBLE_COLLECTIONS_PATH=${VALIDATED_COLLECTIONS_PATH}:${ALL_COLLECTIONS_PATH} | ||
|
||
echo "ANSIBLE_COLLECTIONS_PATH: $ANSIBLE_COLLECTIONS_PATH" | ||
BASE_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")") | ||
export ANSIBLE_ROLES_PATH=${BASE_DIR}:${ANSIBLE_COLLECTIONS_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters