Skip to content

Commit

Permalink
Merge pull request #425 from linode/dev
Browse files Browse the repository at this point in the history
Release v5.17.0
  • Loading branch information
yec-akamai authored Jun 20, 2024
2 parents c6726f8 + d4e8f9f commit 8d0ecc7
Show file tree
Hide file tree
Showing 39 changed files with 1,032 additions and 314 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/e2e-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ on:
pull_request:
workflow_dispatch:
inputs:
test_path:
description: 'Enter specific test path. E.g. linode_client/test_linode_client.py, models/test_account.py'
test_suite:
description: 'Enter specific test suite. E.g. domain, linode_client'
required: false
sha:
description: 'The hash value of the commit.'
Expand All @@ -26,7 +26,7 @@ jobs:
- uses: actions-ecosystem/action-regex-match@v2
id: validate-tests
with:
text: ${{ inputs.test_path }}
text: ${{ inputs.test_suite }}
regex: '[^a-z0-9-:.\/_]' # Tests validation
flags: gi

Expand Down Expand Up @@ -71,6 +71,14 @@ jobs:
- name: Install Python deps
run: pip install -U setuptools wheel boto3 certifi

- name: Download kubectl and calicoctl for LKE clusters
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
chmod +x calicoctl-linux-amd64 kubectl
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
mv kubectl /usr/local/bin/kubectl
- name: Install Python SDK
run: make dev-install
env:
Expand All @@ -80,26 +88,28 @@ jobs:
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_sdk_test_report.xml"
status=0
if ! python3 -m pytest test/integration/${INTEGRATION_TEST_PATH} --disable-warnings --junitxml="${report_filename}"; then
echo "EXIT_STATUS=1" >> $GITHUB_ENV
fi
make testint TEST_ARGS="--junitxml=${report_filename}" TEST_SUITE="${{ github.event.inputs.test_suite }}"
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

- name: Apply Calico Rules to LKE
if: always()
run: |
cd scripts && ./lke_calico_rules_e2e.sh
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

- name: Add additional information to XML report
- name: Upload test results
if: always()
run: |
filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
python tod_scripts/add_to_xml_test_report.py \
--branch_name "${GITHUB_REF#refs/*/}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
--xmlfile "${filename}"
- name: Upload test results
run: |
report_filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
python3 tod_scripts/test_report_upload_script.py "${report_filename}"
sync
python3 tod_scripts/test_report_upload_script.py "${filename}"
env:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
Expand Down Expand Up @@ -131,12 +141,3 @@ jobs:
conclusion: process.env.conclusion
});
return result;
- name: Test Execution Status Handler
run: |
if [[ "$EXIT_STATUS" != 0 ]]; then
echo "Test execution contains failure(s)"
exit $EXIT_STATUS
else
echo "Tests passed!"
fi
15 changes: 15 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download kubectl and calicoctl for LKE clusters
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
chmod +x calicoctl-linux-amd64 kubectl
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
mv kubectl /usr/local/bin/kubectl
- name: Run Integration tests
run: |
timestamp=$(date +'%Y%m%d%H%M')
Expand All @@ -40,6 +48,13 @@ jobs:
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

- name: Apply Calico Rules to LKE
if: always()
run: |
cd scripts && ./lke_calico_rules_e2e.sh
env:
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

- name: Upload test results
if: always()
run: |
Expand Down
9 changes: 9 additions & 0 deletions docs/linode_api4/linode_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ with buckets and objects, use the s3 API directly with a library like `boto3`_.

.. _boto3: https://github.com/boto/boto3

PlacementAPIGroup
^^^^^^^^^^^^

Includes methods related to VM placement.

.. autoclass:: linode_api4.linode_client.PlacementAPIGroup
:members:
:special-members:

PollingGroup
^^^^^^^^^^^^

Expand Down
9 changes: 9 additions & 0 deletions docs/linode_api4/objects/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ Object Storage Models
:undoc-members:
:inherited-members:

Placement Models
--------------

.. automodule:: linode_api4.objects.placement
:members:
:exclude-members: api_endpoint, properties, derived_url_path, id_attribute, parent_id_name
:undoc-members:
:inherited-members:

Profile Models
--------------

Expand Down
1 change: 1 addition & 0 deletions linode_api4/groups/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .networking import *
from .nodebalancer import *
from .object_storage import *
from .placement import *
from .polling import *
from .profile import *
from .region import *
Expand Down
1 change: 0 additions & 1 deletion linode_api4/groups/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
ServiceTransfer,
User,
)
from linode_api4.objects.profile import PersonalAccessToken


class AccountGroup(Group):
Expand Down
14 changes: 9 additions & 5 deletions linode_api4/groups/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
import os
from collections.abc import Iterable

from linode_api4 import Profile
from linode_api4.common import SSH_KEY_TYPES, load_and_validate_keys
from linode_api4.common import load_and_validate_keys
from linode_api4.errors import UnexpectedResponseError
from linode_api4.groups import Group
from linode_api4.objects import (
AuthorizedApp,
Base,
ConfigInterface,
Firewall,
Image,
Instance,
Kernel,
PersonalAccessToken,
SSHKey,
StackScript,
Type,
)
from linode_api4.objects.filtering import Filter
from linode_api4.objects.linode import _expand_placement_group_assignment
from linode_api4.paginated_list import PaginatedList


Expand Down Expand Up @@ -269,6 +266,8 @@ def instance_create(
:param interfaces: An array of Network Interfaces to add to this Linode’s Configuration Profile.
At least one and up to three Interface objects can exist in this array.
:type interfaces: list[ConfigInterface] or list[dict[str, Any]]
:param placement_group: A Placement Group to create this Linode under.
:type placement_group: Union[InstancePlacementGroupAssignment, PlacementGroup, Dict[str, Any], int]
:returns: A new Instance object, or a tuple containing the new Instance and
the generated password.
Expand Down Expand Up @@ -315,6 +314,11 @@ def instance_create(
for i in interfaces
]

if "placement_group" in kwargs:
kwargs["placement_group"] = _expand_placement_group_assignment(
kwargs.get("placement_group")
)

params = {
"type": ltype.id if issubclass(type(ltype), Base) else ltype,
"region": region.id if issubclass(type(region), Base) else region,
Expand Down
163 changes: 0 additions & 163 deletions linode_api4/groups/obj.py

This file was deleted.

7 changes: 6 additions & 1 deletion linode_api4/groups/object_storage.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import List, Optional, Union
from urllib import parse

from linode_api4.errors import UnexpectedResponseError
Expand Down Expand Up @@ -53,7 +54,11 @@ def keys(self, *filters):
"""
return self.client._get_and_filter(ObjectStorageKeys, *filters)

def keys_create(self, label, bucket_access=None):
def keys_create(
self,
label: str,
bucket_access: Optional[Union[dict, List[dict]]] = None,
):
"""
Creates a new Object Storage keypair that may be used to interact directly
with Linode Object Storage in third-party applications. This response is
Expand Down
Loading

0 comments on commit 8d0ecc7

Please sign in to comment.