Skip to content

Commit 9c56e1e

Browse files
Merge pull request #472 from linode/dev
Release v5.24.0
2 parents 76310a4 + 96ac044 commit 9c56e1e

20 files changed

+452
-86
lines changed

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

+57-15
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ 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-
8274
- name: Install Python SDK
8375
run: make dev-install
8476
env:
@@ -92,13 +84,6 @@ jobs:
9284
env:
9385
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
9486

95-
- name: Apply Calico Rules to LKE
96-
if: always()
97-
run: |
98-
cd scripts && ./lke_calico_rules_e2e.sh
99-
env:
100-
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
101-
10287
- name: Upload test results
10388
if: always()
10489
run: |
@@ -141,3 +126,60 @@ jobs:
141126
conclusion: process.env.conclusion
142127
});
143128
return result;
129+
130+
apply-calico-rules:
131+
runs-on: ubuntu-latest
132+
needs: [integration-fork-ubuntu]
133+
if: ${{ success() || failure() }}
134+
135+
steps:
136+
- name: Checkout code
137+
uses: actions/checkout@v4
138+
with:
139+
fetch-depth: 0
140+
submodules: 'recursive'
141+
142+
- name: Download kubectl and calicoctl for LKE clusters
143+
run: |
144+
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
145+
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
146+
chmod +x calicoctl-linux-amd64 kubectl
147+
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
148+
mv kubectl /usr/local/bin/kubectl
149+
150+
- name: Apply Calico Rules to LKE
151+
run: |
152+
cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh
153+
env:
154+
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}
155+
156+
add-fw-to-remaining-instances:
157+
runs-on: ubuntu-latest
158+
needs: [integration-fork-ubuntu]
159+
if: ${{ success() || failure() }}
160+
161+
steps:
162+
- name: Set up Python
163+
uses: actions/setup-python@v5
164+
with:
165+
python-version: '3.x'
166+
167+
- name: Install Linode CLI
168+
run: |
169+
pip install linode-cli
170+
171+
- name: Create Firewall and Attach to Instances
172+
run: |
173+
FIREWALL_ID=$(linode-cli firewalls create --label "e2e-fw-$(date +%s)" --rules.inbound_policy "DROP" --rules.outbound_policy "ACCEPT" --text --format=id --no-headers)
174+
echo "Created Firewall with ID: $FIREWALL_ID"
175+
176+
for instance_id in $(linode-cli linodes list --format "id" --text --no-header); do
177+
echo "Attaching firewall to instance: $instance_id"
178+
if linode-cli firewalls device-create "$FIREWALL_ID" --id "$instance_id" --type linode; then
179+
echo "Firewall attached to instance $instance_id successfully."
180+
else
181+
echo "An error occurred while attaching firewall to instance $instance_id. Skipping..."
182+
fi
183+
done
184+
env:
185+
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }}

.github/workflows/e2e-test.yml

+83-19
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,30 @@ on:
1111
description: 'The hash value of the commit'
1212
required: false
1313
default: ''
14+
python-version:
15+
description: 'Specify Python version to use'
16+
required: false
17+
run-eol-python-version:
18+
description: 'Run EOL python version?'
19+
required: false
20+
default: 'false'
21+
type: choice
22+
options:
23+
- 'true'
24+
- 'false'
1425
push:
1526
branches:
1627
- main
1728
- dev
1829

30+
env:
31+
DEFAULT_PYTHON_VERSION: "3.9"
32+
EOL_PYTHON_VERSION: "3.8"
33+
EXIT_STATUS: 0
34+
1935
jobs:
2036
integration-tests:
2137
runs-on: ubuntu-latest
22-
env:
23-
EXIT_STATUS: 0
2438
steps:
2539
- name: Clone Repository with SHA
2640
if: ${{ inputs.sha != '' }}
@@ -40,7 +54,7 @@ jobs:
4054
- name: Setup Python
4155
uses: actions/setup-python@v5
4256
with:
43-
python-version: '3.x'
57+
python-version: ${{ inputs.run-eol-python-version == 'true' && env.EOL_PYTHON_VERSION || inputs.python-version || env.DEFAULT_PYTHON_VERSION }}
4458

4559
- name: Install Python deps
4660
run: pip install -U setuptools wheel boto3 certifi
@@ -50,14 +64,6 @@ jobs:
5064
env:
5165
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5266

53-
- name: Download kubectl and calicoctl for LKE clusters
54-
run: |
55-
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
56-
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
57-
chmod +x calicoctl-linux-amd64 kubectl
58-
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
59-
mv kubectl /usr/local/bin/kubectl
60-
6167
- name: Set LINODE_TOKEN
6268
run: |
6369
echo "LINODE_TOKEN=${{ secrets[inputs.use_minimal_test_account == 'true' && 'MINIMAL_LINODE_TOKEN' || 'LINODE_TOKEN'] }}" >> $GITHUB_ENV
@@ -70,13 +76,6 @@ jobs:
7076
env:
7177
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
7278

73-
- name: Apply Calico Rules to LKE
74-
if: always()
75-
run: |
76-
cd scripts && ./lke_calico_rules_e2e.sh
77-
env:
78-
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
79-
8079
- name: Upload test results
8180
if: always()
8281
run: |
@@ -92,10 +91,75 @@ jobs:
9291
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
9392
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
9493

94+
apply-calico-rules:
95+
runs-on: ubuntu-latest
96+
needs: [integration-tests]
97+
if: ${{ success() || failure() }}
98+
99+
steps:
100+
- name: Checkout code
101+
uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 0
104+
submodules: 'recursive'
105+
106+
- name: Set LINODE_TOKEN
107+
run: |
108+
echo "LINODE_TOKEN=${{ secrets[inputs.use_minimal_test_account == 'true' && 'MINIMAL_LINODE_TOKEN' || 'LINODE_TOKEN'] }}" >> $GITHUB_ENV
109+
110+
- name: Download kubectl and calicoctl for LKE clusters
111+
run: |
112+
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
113+
curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64"
114+
chmod +x calicoctl-linux-amd64 kubectl
115+
mv calicoctl-linux-amd64 /usr/local/bin/calicoctl
116+
mv kubectl /usr/local/bin/kubectl
117+
118+
- name: Apply Calico Rules to LKE
119+
run: |
120+
cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh
121+
env:
122+
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
123+
124+
add-fw-to-remaining-instances:
125+
runs-on: ubuntu-latest
126+
needs: [integration-tests]
127+
if: ${{ success() || failure() }}
128+
129+
steps:
130+
- name: Set up Python
131+
uses: actions/setup-python@v5
132+
with:
133+
python-version: '3.x'
134+
135+
- name: Install Linode CLI
136+
run: |
137+
pip install linode-cli
138+
139+
- name: Set LINODE_TOKEN
140+
run: |
141+
echo "LINODE_TOKEN=${{ secrets[inputs.use_minimal_test_account == 'true' && 'MINIMAL_LINODE_TOKEN' || 'LINODE_TOKEN'] }}" >> $GITHUB_ENV
142+
143+
- name: Create Firewall and Attach to Instances
144+
run: |
145+
FIREWALL_ID=$(linode-cli firewalls create --label "e2e-fw-$(date +%s)" --rules.inbound_policy "DROP" --rules.outbound_policy "ACCEPT" --text --format=id --no-headers)
146+
echo "Created Firewall with ID: $FIREWALL_ID"
147+
148+
for instance_id in $(linode-cli linodes list --format "id" --text --no-header); do
149+
echo "Attaching firewall to instance: $instance_id"
150+
if linode-cli firewalls device-create "$FIREWALL_ID" --id "$instance_id" --type linode; then
151+
echo "Firewall attached to instance $instance_id successfully."
152+
else
153+
echo "An error occurred while attaching firewall to instance $instance_id. Skipping..."
154+
fi
155+
done
156+
env:
157+
LINODE_CLI_TOKEN: ${{ env.LINODE_TOKEN }}
158+
95159
notify-slack:
96160
runs-on: ubuntu-latest
97161
needs: [integration-tests]
98-
if: always() && github.repository == 'linode/linode_api4-python' # Run even if integration tests fail and only on main repository
162+
if: ${{ (success() || failure()) && github.repository == 'linode/linode_api4-python' }} # Run even if integration tests fail and only on main repository
99163

100164
steps:
101165
- name: Notify Slack

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ['3.8','3.9','3.10','3.11', '3.12']
17+
python-version: ['3.9','3.10','3.11', '3.12']
1818
steps:
1919
- uses: actions/checkout@v4
2020
- uses: actions/setup-python@v5
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Notify Dev DX Channel on Release
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch: null
6+
7+
jobs:
8+
notify:
9+
if: github.repository == 'linode/linode_api4-python'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Notify Slack - Main Message
13+
id: main_message
14+
uses: slackapi/[email protected]
15+
with:
16+
channel-id: ${{ secrets.DEV_DX_SLACK_CHANNEL_ID }}
17+
payload: |
18+
{
19+
"blocks": [
20+
{
21+
"type": "section",
22+
"text": {
23+
"type": "mrkdwn",
24+
"text": "*New Release Published: _linode_api4-python_ <${{ github.event.release.html_url }}|${{ github.event.release.tag_name }}> is now live!* :tada:"
25+
}
26+
}
27+
]
28+
}
29+
env:
30+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 commit comments

Comments
 (0)