Skip to content

Commit 8d0ecc7

Browse files
authored
Merge pull request #425 from linode/dev
Release v5.17.0
2 parents c6726f8 + d4e8f9f commit 8d0ecc7

39 files changed

+1032
-314
lines changed

.github/workflows/e2e-test-pr.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ on:
22
pull_request:
33
workflow_dispatch:
44
inputs:
5-
test_path:
6-
description: 'Enter specific test path. E.g. linode_client/test_linode_client.py, models/test_account.py'
5+
test_suite:
6+
description: 'Enter specific test suite. E.g. domain, linode_client'
77
required: false
88
sha:
99
description: 'The hash value of the commit.'
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions-ecosystem/action-regex-match@v2
2727
id: validate-tests
2828
with:
29-
text: ${{ inputs.test_path }}
29+
text: ${{ inputs.test_suite }}
3030
regex: '[^a-z0-9-:.\/_]' # Tests validation
3131
flags: gi
3232

@@ -71,6 +71,14 @@ jobs:
7171
- name: Install Python deps
7272
run: pip install -U setuptools wheel boto3 certifi
7373

74+
- name: Download kubectl and calicoctl for LKE clusters
75+
run: |
76+
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
77+
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
78+
chmod +x calicoctl-linux-amd64 kubectl
79+
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
80+
mv kubectl /usr/local/bin/kubectl
81+
7482
- name: Install Python SDK
7583
run: make dev-install
7684
env:
@@ -80,26 +88,28 @@ jobs:
8088
run: |
8189
timestamp=$(date +'%Y%m%d%H%M')
8290
report_filename="${timestamp}_sdk_test_report.xml"
83-
status=0
84-
if ! python3 -m pytest test/integration/${INTEGRATION_TEST_PATH} --disable-warnings --junitxml="${report_filename}"; then
85-
echo "EXIT_STATUS=1" >> $GITHUB_ENV
86-
fi
91+
make testint TEST_ARGS="--junitxml=${report_filename}" TEST_SUITE="${{ github.event.inputs.test_suite }}"
92+
env:
93+
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
94+
95+
- name: Apply Calico Rules to LKE
96+
if: always()
97+
run: |
98+
cd scripts && ./lke_calico_rules_e2e.sh
8799
env:
88100
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
89101

90-
- name: Add additional information to XML report
102+
- name: Upload test results
103+
if: always()
91104
run: |
92105
filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
93106
python tod_scripts/add_to_xml_test_report.py \
94107
--branch_name "${GITHUB_REF#refs/*/}" \
95108
--gha_run_id "$GITHUB_RUN_ID" \
96109
--gha_run_number "$GITHUB_RUN_NUMBER" \
97110
--xmlfile "${filename}"
98-
99-
- name: Upload test results
100-
run: |
101-
report_filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
102-
python3 tod_scripts/test_report_upload_script.py "${report_filename}"
111+
sync
112+
python3 tod_scripts/test_report_upload_script.py "${filename}"
103113
env:
104114
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
105115
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
@@ -131,12 +141,3 @@ jobs:
131141
conclusion: process.env.conclusion
132142
});
133143
return result;
134-
135-
- name: Test Execution Status Handler
136-
run: |
137-
if [[ "$EXIT_STATUS" != 0 ]]; then
138-
echo "Test execution contains failure(s)"
139-
exit $EXIT_STATUS
140-
else
141-
echo "Tests passed!"
142-
fi

.github/workflows/e2e-test.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ jobs:
3232
env:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434

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

51+
- name: Apply Calico Rules to LKE
52+
if: always()
53+
run: |
54+
cd scripts && ./lke_calico_rules_e2e.sh
55+
env:
56+
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
57+
4358
- name: Upload test results
4459
if: always()
4560
run: |

docs/linode_api4/linode_client.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ with buckets and objects, use the s3 API directly with a library like `boto3`_.
155155

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

158+
PlacementAPIGroup
159+
^^^^^^^^^^^^
160+
161+
Includes methods related to VM placement.
162+
163+
.. autoclass:: linode_api4.linode_client.PlacementAPIGroup
164+
:members:
165+
:special-members:
166+
158167
PollingGroup
159168
^^^^^^^^^^^^
160169

docs/linode_api4/objects/models.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ Object Storage Models
104104
:undoc-members:
105105
:inherited-members:
106106

107+
Placement Models
108+
--------------
109+
110+
.. automodule:: linode_api4.objects.placement
111+
:members:
112+
:exclude-members: api_endpoint, properties, derived_url_path, id_attribute, parent_id_name
113+
:undoc-members:
114+
:inherited-members:
115+
107116
Profile Models
108117
--------------
109118

linode_api4/groups/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .networking import *
1313
from .nodebalancer import *
1414
from .object_storage import *
15+
from .placement import *
1516
from .polling import *
1617
from .profile import *
1718
from .region import *

linode_api4/groups/account.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
ServiceTransfer,
2020
User,
2121
)
22-
from linode_api4.objects.profile import PersonalAccessToken
2322

2423

2524
class AccountGroup(Group):

linode_api4/groups/linode.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,21 @@
22
import os
33
from collections.abc import Iterable
44

5-
from linode_api4 import Profile
6-
from linode_api4.common import SSH_KEY_TYPES, load_and_validate_keys
5+
from linode_api4.common import load_and_validate_keys
76
from linode_api4.errors import UnexpectedResponseError
87
from linode_api4.groups import Group
98
from linode_api4.objects import (
10-
AuthorizedApp,
119
Base,
1210
ConfigInterface,
1311
Firewall,
1412
Image,
1513
Instance,
1614
Kernel,
17-
PersonalAccessToken,
18-
SSHKey,
1915
StackScript,
2016
Type,
2117
)
2218
from linode_api4.objects.filtering import Filter
19+
from linode_api4.objects.linode import _expand_placement_group_assignment
2320
from linode_api4.paginated_list import PaginatedList
2421

2522

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

317+
if "placement_group" in kwargs:
318+
kwargs["placement_group"] = _expand_placement_group_assignment(
319+
kwargs.get("placement_group")
320+
)
321+
318322
params = {
319323
"type": ltype.id if issubclass(type(ltype), Base) else ltype,
320324
"region": region.id if issubclass(type(region), Base) else region,

linode_api4/groups/obj.py

Lines changed: 0 additions & 163 deletions
This file was deleted.

linode_api4/groups/object_storage.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import List, Optional, Union
12
from urllib import parse
23

34
from linode_api4.errors import UnexpectedResponseError
@@ -53,7 +54,11 @@ def keys(self, *filters):
5354
"""
5455
return self.client._get_and_filter(ObjectStorageKeys, *filters)
5556

56-
def keys_create(self, label, bucket_access=None):
57+
def keys_create(
58+
self,
59+
label: str,
60+
bucket_access: Optional[Union[dict, List[dict]]] = None,
61+
):
5762
"""
5863
Creates a new Object Storage keypair that may be used to interact directly
5964
with Linode Object Storage in third-party applications. This response is

0 commit comments

Comments
 (0)