Skip to content

Commit 3f30c83

Browse files
authored
Update for 24.3 SR Linux and ansible 2.15, 2.16, 2.17 (#26)
* bump srl version * update clab, srl version and remove oc tests for now * bump netcommon dep to 6.1.3 and retire ansible core older than 2.14 * pin ansible utils * remove <2.14 versions form ansible sanity * added pyenv * fix gnmi server for 24.3 * exclude oc test * update golden and templated config * add 30s sleep timer for ci * remove timer as it doesn't fix shit =( * added pre-test sleep and dump logs * move tests after the lab deployment * trying debumping utils * trying debump on netcommon * continue on error * bring back deps to modern versions and set clab to 0.55.1 * add inputs to start tmate before or after session * added 2.16 and 2.17 to test and build matrixes * bump checkout action * remove contrinue on error as it was masking the errors * update sanity test setup * remove py2 dep on certificate error * bring back import before doc exception * update skip modules * ignore compile on srl module * relax collection deps to a range * update setup python step
1 parent b697e64 commit 3f30c83

19 files changed

Lines changed: 3019 additions & 1586 deletions

.github/container-matrix.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,49 @@
33
# SPDX-License-Identifier: BSD-3-Clause
44

55
# a matrix list of variables used in the container build process
6+
# it is used to define what ansible core images that define both ansible core and the python interpreter
7+
# are going to be used in the container build process for the collection.
68
#
79
# python version are taken from ansible's support matrix - https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#support-life
810
# ansible-core-image version is taken from https://github.com/orgs/srl-labs/packages?repo_name=ansible-core
911
include:
10-
# 2.14.11
11-
- ansible-core-image: "2.14.11:pypy3.10"
12+
# 2.14
13+
- ansible-core-image: "2.14.17:pypy3.10"
1214
runs-on: "ubuntu-22.04"
1315

14-
- ansible-core-image: "2.14.11:py3.11"
16+
- ansible-core-image: "2.14.17:py3.11"
1517
runs-on: "ubuntu-22.04"
1618
addional-tags: "latest"
1719

18-
# 2.15.5
19-
- ansible-core-image: "2.15.5:pypy3.10"
20+
# 2.15
21+
- ansible-core-image: "2.15.12:pypy3.10"
2022
runs-on: "ubuntu-22.04"
2123

22-
- ansible-core-image: "2.15.5:py3.11"
24+
- ansible-core-image: "2.15.12:py3.11"
25+
runs-on: "ubuntu-22.04"
26+
27+
- ansible-core-image: "2.15.12:py3.12"
28+
runs-on: "ubuntu-22.04"
29+
addional-tags: "latest"
30+
31+
# 2.16
32+
- ansible-core-image: "2.16.8:pypy3.10"
33+
runs-on: "ubuntu-22.04"
34+
35+
- ansible-core-image: "2.16.8:py3.11"
36+
runs-on: "ubuntu-22.04"
37+
38+
- ansible-core-image: "2.16.8:py3.12"
2339
runs-on: "ubuntu-22.04"
2440
addional-tags: "latest"
2541

26-
- ansible-core-image: "2.15.5:py3.12"
42+
# 2.17
43+
- ansible-core-image: "2.17.1:pypy3.10"
44+
runs-on: "ubuntu-22.04"
45+
46+
- ansible-core-image: "2.17.1:py3.11"
2747
runs-on: "ubuntu-22.04"
48+
49+
- ansible-core-image: "2.17.1:py3.12"
50+
runs-on: "ubuntu-22.04"
51+
addional-tags: "latest"

.github/matrix.yml

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,67 @@
33
# SPDX-License-Identifier: BSD-3-Clause
44

55
# a matrix list of variables used in testing
6-
# kind of a manual way of creating a testing matrix with a flexibility of selecting permuatations
6+
# kind of a manual way of creating a testing matrix with a flexibility of selecting permutations
77
# support matrix for ansible control node - https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#node-requirement-summary
88

99
include:
10-
####################
11-
# Python 3.8
12-
####################
13-
- &latest-2_12
14-
ansible-core-version: "2.12.10"
15-
runs-on: "ubuntu-22.04"
16-
python-version: "3.8"
17-
18-
- &latest-2_13
19-
ansible-core-version: "2.13.13"
20-
runs-on: "ubuntu-22.04"
21-
python-version: "3.8"
22-
2310
####################
2411
# Python 3.9
2512
####################
26-
- <<: *latest-2_12
27-
python-version: "3.9"
28-
29-
- <<: *latest-2_13
30-
python-version: "3.9"
31-
3213
- &latest-2_14
33-
ansible-core-version: "2.14.11"
14+
ansible-core-version: "2.14.17"
3415
runs-on: "ubuntu-22.04"
3516
python-version: "3.9"
3617

3718
- &latest-2_15
38-
ansible-core-version: "2.15.5"
19+
ansible-core-version: "2.15.12"
3920
runs-on: "ubuntu-22.04"
4021
python-version: "3.9"
4122

4223
####################
4324
# Python 3.10
4425
####################
4526

46-
# removing 2_12 and 2_13 because TLS tests are failing
47-
# this doesn't make the collection unusable with these versions
48-
# when 23.10 comes out with TLS 1.3 we will remove these checks and bring back 2_12 and 2_13
49-
# - <<: *latest-2_12
50-
# python-version: "3.10"
51-
52-
# - <<: *latest-2_13
53-
# python-version: "3.10"
54-
5527
- <<: *latest-2_14
5628
python-version: "3.10"
5729

5830
- <<: *latest-2_15
5931
python-version: "3.10"
6032

33+
- &latest-2_16
34+
ansible-core-version: "2.16.8"
35+
runs-on: "ubuntu-22.04"
36+
python-version: "3.10"
37+
38+
- &latest-2_17
39+
ansible-core-version: "2.17.1"
40+
runs-on: "ubuntu-22.04"
41+
python-version: "3.10"
42+
6143
####################
6244
# Python 3.11
6345
####################
6446

65-
# - <<: *latest-2_12
66-
# python-version: "3.11"
67-
68-
# - <<: *latest-2_13
69-
# python-version: "3.11"
70-
7147
- <<: *latest-2_14
7248
python-version: "3.11"
7349

7450
- <<: *latest-2_15
7551
python-version: "3.11"
7652

53+
- <<: *latest-2_16
54+
python-version: "3.11"
55+
56+
- <<: *latest-2_17
57+
python-version: "3.11"
58+
7759
####################
7860
# Python 3.12
7961
####################
8062
- <<: *latest-2_15
8163
python-version: "3.12"
64+
65+
- <<: *latest-2_16
66+
python-version: "3.12"
67+
68+
- <<: *latest-2_17
69+
python-version: "3.12"

.github/workflows/cicd.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ name: CICD
1010
srlinux-version:
1111
description: "SR Linux version"
1212
required: true
13-
default: "23.3.2"
14-
start-tmate:
13+
default: "24.3.2"
14+
start-tmate-before-test:
1515
description: "start tmate before running tests"
1616
type: boolean
1717
required: false
1818
default: false
19+
start-tmate-after-test:
20+
description: "start tmate after running tests"
21+
type: boolean
22+
required: false
23+
default: false
1924
pull_request:
2025
push:
2126
tags:
@@ -27,7 +32,7 @@ jobs:
2732
outputs:
2833
matrix: ${{ steps.matrix.outputs.output }}
2934
steps:
30-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3136
- uses: fabasoad/data-format-converter-action@main
3237
id: matrix
3338
with:
@@ -37,7 +42,8 @@ jobs:
3742

3843
test:
3944
runs-on: ${{ matrix.runs-on }}
40-
needs: [prepare-matrix]
45+
needs:
46+
- prepare-matrix
4147
strategy:
4248
fail-fast: false
4349
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
@@ -47,41 +53,47 @@ jobs:
4753
run: |
4854
echo "SRLINUX_VERSION=${{ inputs.srlinux-version }}" >> $GITHUB_ENV
4955
50-
- uses: actions/checkout@v3
56+
- uses: actions/checkout@v4
5157

52-
- uses: actions/setup-python@v4
58+
- uses: actions/setup-python@v5
5359
with:
5460
python-version: ${{ matrix.python-version }}
5561

5662
- name: Install ansible core
5763
run: pip install ansible-core==${{ matrix.ansible-core-version }}
5864

65+
- name: start tmate session
66+
uses: mxschmitt/action-tmate@v3
67+
if: ${{ inputs.start-tmate-before-test }}
68+
5969
# Uncomment this section to use private images
6070
# - name: ghcr.io login
6171
# uses: docker/login-action@v2
6272
# with:
6373
# registry: ghcr.io
6474
# username: ${{ github.actor }}
6575
# password: ${{ secrets.GITHUB_TOKEN }}
76+
- name: Test
77+
run: ./run.sh ci-test
78+
# uncomment this line when you want to continue on error
79+
# and run tmate after it
80+
# continue-on-error: true
6681

6782
- name: start tmate session
6883
uses: mxschmitt/action-tmate@v3
69-
if: ${{ inputs.start-tmate }}
70-
71-
- name: Test
72-
run: ./run.sh ci-test
84+
if: ${{ inputs.start-tmate-after-test }}
7385

7486
ansible-sanity-test:
7587
runs-on: ubuntu-latest
7688
steps:
77-
- uses: actions/checkout@v3
89+
- uses: actions/checkout@v4
7890

79-
- uses: actions/setup-python@v4
91+
- uses: actions/setup-python@v5
8092
with:
81-
python-version: 3.8
93+
python-version: 3.11
8294

8395
- name: Install ansible core
84-
run: pip install ansible-core==2.13.8
96+
run: pip install ansible-core==2.15.12
8597

8698
- name: Ansible sanity test
8799
run: ./run.sh sanity-test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ipython_config.py
106106
# pyenv
107107
# For a library or package, you might want to ignore these files since the code is
108108
# intended to run in multiple environments; otherwise, check them in:
109-
# .python-version
109+
.python-version
110110

111111
# pipenv
112112
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.

galaxy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ tags:
4646
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
4747
# range specifiers can be set and are separated by ','
4848
dependencies:
49-
"ansible.netcommon": ">=5.2.0"
49+
"ansible.netcommon": ">=5.2.0,<=6.1.3"
50+
"ansible.utils": ">=3.0.0,<5.0.0"
5051

5152
# The URL of the originating SCM repository
5253
repository: https://github.com/nokia/srlinux-ansible-collection

plugins/module_utils/srlinux.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the BSD 3-Clause License.
33
# SPDX-License-Identifier: BSD-3-Clause
44

5-
""" srlinux module utils """
5+
"""srlinux module utils"""
66
# -*- coding: utf-8 -*-
77

88
from __future__ import absolute_import, division, print_function
@@ -13,7 +13,6 @@
1313

1414
from ansible.module_utils._text import to_text
1515
from ansible.module_utils.connection import Connection
16-
from ansible.module_utils.urls import CertificateError
1716

1817

1918
class JSONRPCClient:
@@ -47,10 +46,7 @@ def _httpapi_error_handle(self, method="POST", path="/jsonrpc", payload=None):
4746
self.module.fail_json(
4847
msg=f"connection error occurred: {e}",
4948
)
50-
except CertificateError as e:
51-
self.module.fail_json(
52-
msg=f"certificate error occurred: {e}",
53-
)
49+
5450
except ValueError as e:
5551
try:
5652
self.module.fail_json(msg=f"certificate not found: {e}")

run.sh

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ SCRIPTS_DIR="scripts"
1616
# Directory where the tests are located.
1717
TESTS_DIR="$(pwd)/tests"
1818

19+
# Containerlab version to use in CI tests
20+
CLAB_VERSION="0.55.1"
21+
1922
# -----------------------------------------------------------------------------
2023
# Helper functions start with _ and aren't listed in this script's help menu.
2124
# -----------------------------------------------------------------------------
@@ -57,10 +60,6 @@ function remove-local-collection {
5760
rm -rf ~/.ansible/collections/ansible_collections/nokia
5861
}
5962

60-
# Install a netcommon dependency in case ansible-core is installed.
61-
function install-netcommon {
62-
ansible-galaxy collection install --force ansible.netcommon:==4.1.0
63-
}
6463

6564
# Deploy test lab.
6665
function deploy-lab {
@@ -87,14 +86,7 @@ function revert-to-checkpoint {
8786
docker exec ${NODE_NAME} sr_cli /tools system configuration checkpoint initial revert
8887
}
8988

90-
# copy sanity ignore files from ignore-2.10.txt to all other supported ansible versions
91-
function copy-sanity-ignore {
92-
_cdTests
93-
cd sanity
94-
for version in 2.11 2.12 2.13 2.14; do
95-
cp ignore-2.10.txt ignore-${version}.txt
96-
done
97-
}
89+
9890

9991
# -----------------------------------------------------------------------------
10092
# Test functions.
@@ -297,9 +289,12 @@ function _run-tests {
297289
test-commit-confirm "$@"
298290

299291
# OC-related tests
300-
test-get-oc-container "$@"
301-
test-set-oc-leaf "$@"
302-
test-oc-validate "$@"
292+
if [[ " $* " == *" oc-tests "* ]]; then
293+
# OC-related tests
294+
test-get-oc-container "$@"
295+
test-set-oc-leaf "$@"
296+
test-oc-validate "$@"
297+
fi
303298
}
304299

305300
# prepare local dev environment and run tests
@@ -311,18 +306,37 @@ function test {
311306
_run-tests "$@"
312307
}
313308

309+
function dump-logs {
310+
ansible-galaxy collection list
311+
echo
312+
pip list
313+
python --version
314+
}
315+
314316
# ci-test is a wrapper for testing in CI which first setups the environment.
315317
function ci-test {
316-
install-containerlab 0.48.6
318+
install-containerlab ${CLAB_VERSION}
317319
install-local-collection
318320
deploy-lab
321+
322+
dump-logs
323+
319324

320325
# at this point we are already in ./tests dir
321326
# since we changed into it in deploy-lab
322327
# we use ci-ansible.cfg to make sure default collections paths is used
323328
ANSIBLE_CONFIG=ci-ansible.cfg _run-tests "$@"
324329
}
325330

331+
# copy sanity ignore files from ignore-2.10.txt to all other supported ansible versions
332+
function copy-sanity-ignore {
333+
_cdTests
334+
cd sanity
335+
for version in 2.14 2.15 2.16 2.17; do
336+
cp ignore-2.10.txt ignore-${version}.txt
337+
done
338+
}
339+
326340
# sanity-test runs ansible-test tool with sanity checks.
327341
function sanity-test {
328342
install-local-collection

0 commit comments

Comments
 (0)