Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(workflow): tests integration #20

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 10 additions & 68 deletions .github/workflows/ansible-test-integration.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: integration
name: Integration

on:
pull_request:
branches:
- main
push:
branches:
- main
# schedule:
# - cron: "0 6 * * *"
workflow_dispatch:

jobs:
Expand All @@ -18,78 +18,20 @@ jobs:
max-parallel: 1
matrix:
module:
# - scaleway_account_project
# - scaleway_applesilicon_server
# - scaleway_baremetal_server
# - scaleway_container
# - scaleway_container_cron
# - scaleway_container_domain
# - scaleway_container_namespace
# - scaleway_container_token
# - scaleway_domain_ssl_certificate
# - scaleway_flexibleip_flexible_ip
# - scaleway_function
# - scaleway_function_cron
# - scaleway_function_domain
# - scaleway_function_namespace
# - scaleway_function_token
# - scaleway_function_trigger
# - scaleway_iam_api_key
# - scaleway_iam_application
# - scaleway_iam_group
# - scaleway_iam_policy
# - scaleway_iam_ssh_key
# - scaleway_instance_image
# - scaleway_instance_ip
# - scaleway_instance_placement_group
# - scaleway_instance_private_nic
# - scaleway_instance_security_group
# - scaleway_instance_security_group_rule
# - scaleway_instance_snapshot
# - scaleway_instance_volume
# - scaleway_iot_device
# - scaleway_iot_hub
# - scaleway_iot_network
# - scaleway_iot_route
# - scaleway_k8s_cluster
# - scaleway_k8s_pool
# - scaleway_lb
# - scaleway_lb_acl
# - scaleway_lb_backend
# - scaleway_lb_certificate
# - scaleway_lb_frontend
# - scaleway_lb_route
# - scaleway_lb_subscriber
# - scaleway_mnq_credential
# - scaleway_mnq_namespace
# - scaleway_rdb_database_backup
# - scaleway_rdb_endpoint
# - scaleway_rdb_instance
# - scaleway_rdb_read_replica
# - scaleway_rdb_snapshot
# - scaleway_redis_cluster
- scaleway_registry_namespace
# - scaleway_secret
# - scaleway_vpc_private_network
# - scaleway_vpcgw_dhcp
# - scaleway_vpcgw_dhcp_entry
# - scaleway_vpcgw_gateway
# - scaleway_vpcgw_gateway_network
# - scaleway_vpcgw_ip
# - scaleway_vpcgw_pat_rule

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Perform testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
pre-test-cmd: >-
SCW_ACCESS_KEY=${{ secrets.SCW_ACCESS_KEY }}
SCW_SECRET_KEY=${{ secrets.SCW_SECRET_KEY }}
SCW_DEFAULT_PROJECT_ID=${{ secrets.SCW_DEFAULT_PROJECT_ID }}
eval
"echo \"$(cat "tests/integration/integration_config.yml.template")\""
> tests/integration/integration_config.yml
target-python-version: 3.9
controller-python-version: auto
target: ${{ matrix.module }}
testing-type: integration
env:
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
SCW_DEFAULT_PROJECT_ID: ${{ secrets.SCW_DEFAULT_PROJECT_ID }}
Original file line number Diff line number Diff line change
@@ -1,59 +1,48 @@
---
- block:
- name: Ensure Access Key is provided
ansible.builtin.fail:
msg: scw_access_key should be defined in tests/integration/integration_config.yml
when:
- scw_access_key is not defined
- scw_access_key | length == 0
- name: Ensure required keys are provided
ansible.builtin.fail:
msg: "{{ item }} should be defined in you env"
when: item is not defined or item | length == 0
loop:
- scw_access_key
- scw_secret_key
- scw_default_project_id

- name: Ensure Secret Key is provided
ansible.builtin.fail:
msg: scw_secret_key should be defined in tests/integration/integration_config.yml
when:
- scw_secret_key is not defined
- scw_secret_key | length == 0
- name: Create registry_namespace
scaleway.scaleway.scaleway_registry_namespace:
name: "{{ resource_name }}"
region: "{{ resource_region }}"
project_id: "{{ lookup('env', 'SCW_DEFAULT_PROJECT_ID') }}"
access_key: "{{ lookup('env', 'SCW_ACCESS_KEY') }}"
secret_key: "{{ lookup('env', 'SCW_SECRET_KEY') }}"
state: present
description: "{{ resource_description }}"
is_public: "{{ resource_is_public }}"
register: integration_registry_namespace_creation

- name: Ensure Default Project ID is provided
ansible.builtin.fail:
msg: scw_default_project_id should be defined in tests/integration/integration_config.yml
when:
- scw_default_project_id is not defined
- scw_default_project_id | length == 0
- name: Delete registry_namespace
scaleway.scaleway.scaleway_registry_namespace:
name: "{{ resource_name }}"
region: "{{ resource_region }}"
project_id: "{{ lookup('env', 'SCW_DEFAULT_PROJECT_ID') }}"
access_key: "{{ lookup('env', 'SCW_ACCESS_KEY') }}"
secret_key: "{{ lookup('env', 'SCW_SECRET_KEY') }}"
state: absent
description: "{{ resource_description }}"
is_public: "{{ resource_is_public }}"
register: integration_registry_namespace_deletion

- name: Create registry_namespace
scaleway.scaleway.scaleway_registry_namespace:
name: "{{ resource_name }}"
region: "{{ resource_region }}"
project_id: "{{ scw_default_project_id }}"
access_key: "{{ scw_access_key }}"
secret_key: "{{ scw_secret_key }}"
state: present
description: "{{ resource_description }}"
is_public: "{{ resource_is_public }}"
register: integration_registry_namespace_creation
- name: Create a registry_namespace (Check)
check_mode: yes
scaleway.scaleway.scaleway_registry_namespace:
name: "{{ resource_name }}"
region: "{{ resource_region }}"
project_id: "{{ lookup('env', 'SCW_DEFAULT_PROJECT_ID') }}"
access_key: "{{ lookup('env', 'SCW_ACCESS_KEY') }}"
secret_key: "{{ lookup('env', 'SCW_SECRET_KEY') }}"
state: present
description: "{{ resource_description }}"
is_public: "{{ resource_is_public }}"
register: integration_registry_namespace_creation_check

- name: Delete registry_namespace
scaleway.scaleway.scaleway_registry_namespace:
name: "{{ resource_name }}"
region: "{{ resource_region }}"
project_id: "{{ scw_default_project_id }}"
access_key: "{{ scw_access_key }}"
secret_key: "{{ scw_secret_key }}"
state: absent
description: "{{ resource_description }}"
is_public: "{{ resource_is_public }}"
register: integration_registry_namespace_deletion

- name: Create a registry_namespace (Check)
check_mode: yes
scaleway.scaleway.scaleway_registry_namespace:
name: "{{ resource_name }}"
region: "{{ resource_region }}"
project_id: "{{ scw_default_project_id }}"
access_key: "{{ scw_access_key }}"
secret_key: "{{ scw_secret_key }}"
state: present
description: "{{ resource_description }}"
is_public: "{{ resource_is_public }}"
register: integration_registry_namespace_creation_check
Loading