From 1d8ddd0d46195c34fa7a396818fed4ba143e5ce5 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Tue, 25 Apr 2023 15:45:27 +0300 Subject: [PATCH 1/5] bump netcommon and docs cleanup --- .gitignore | 4 ++++ README.md | 7 +++---- galaxy.yml | 5 +++-- run.sh | 8 ++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 924b614..3a54e6c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,10 @@ ### Private folder ### private/ +# galaxy api key +apikey +# ignore build artifacts +*.tar.gz ### containerlab ### **/clab-*/ diff --git a/README.md b/README.md index 838dfb0..3d0cd21 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,14 @@ # SR Linux Ansible Collection -> **Warning** -> This is a work in progress. The collection is not yet published to Ansible Galaxy. +Ansible Collection to manage Nokia SR Linux devices. Documentation is provided at ## Dev setup Start with cloning the repo: ```bash -git clone git@github.com:srl-labs/srl-ansible-collection.git -cd srl-ansible-collection +git clone git@github.com:nokia/srlinux-ansible-collection.git +cd srlinux-ansible-collection ``` Deploy the lab to support the tests: diff --git a/galaxy.yml b/galaxy.yml index 134154d..9c26624 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -45,7 +45,8 @@ tags: # collection label 'namespace.name'. The value is a version range # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version # range specifiers can be set and are separated by ',' -dependencies: { "ansible.netcommon": "==4.1.0" } +dependencies: + "ansible.netcommon": ">=5.1.0" # The URL of the originating SCM repository repository: https://github.com/nokia/srlinux-ansible-collection @@ -54,7 +55,7 @@ repository: https://github.com/nokia/srlinux-ansible-collection issues: https://github.com/nokia/srlinux-ansible-collection/issues # The URL to any online docs -documentation: https://learn.srlinux.dev/programmability/ansible/ +documentation: https://learn.srlinux.dev/ansible/collection/ # A list of file glob-like patterns used to filter any files or directories that should not be included in the build # artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This diff --git a/run.sh b/run.sh index 73124e9..29e5903 100755 --- a/run.sh +++ b/run.sh @@ -235,6 +235,14 @@ function sanity-test { ansible-test sanity --docker default -v "$@" } +# ----------------------------------------------------------------------------- +# Publish functions. +# ----------------------------------------------------------------------------- + +function build-collection { + # build the collection + ansible-galaxy collection build --force +} # ----------------------------------------------------------------------------- # Bash runner functions. From 9d28c19ad5fa13fed3f67d2bee09ab5341bc13aa Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Tue, 25 Apr 2023 15:47:56 +0300 Subject: [PATCH 2/5] remove docker login step --- .github/workflows/cicd.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 2d30293..60ebb32 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -41,12 +41,13 @@ jobs: - name: Install ansible core run: pip install ansible-core==${{ matrix.ansible-core-version }} - - name: ghcr.io login - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + # Uncomment this section to use private images + # - name: ghcr.io login + # uses: docker/login-action@v2 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} - name: Test run: ./run.sh ci-test From 78e3bfd5f2f9a8a64b34a2d97019f7baf2dc6dd7 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Tue, 25 Apr 2023 15:59:40 +0300 Subject: [PATCH 3/5] added publish function --- README.md | 2 +- run.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d0cd21..4f23f17 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Run the automated suite of tests to make sure nothing is missing. This will also ./run.sh test ``` -To validate that the code passes ansible's sanity check, run: +To validate that the code passes Ansible's sanity check, run: ```bash ./run.sh sanity-test diff --git a/run.sh b/run.sh index 29e5903..3ddc9d9 100755 --- a/run.sh +++ b/run.sh @@ -244,6 +244,11 @@ function build-collection { ansible-galaxy collection build --force } +function publish-collection { + # build the collection + ansible-galaxy collection publish --token $(cat apikey) +} + # ----------------------------------------------------------------------------- # Bash runner functions. # ----------------------------------------------------------------------------- From 16bfe4b373c3572780405ac36b524e0b5258c5e9 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Tue, 25 Apr 2023 16:24:25 +0300 Subject: [PATCH 4/5] fix tags and publish function --- galaxy.yml | 2 +- run.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 9c26624..ffb8902 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -38,7 +38,7 @@ tags: - nokia - srlinux - jsonrpc - - rest-api + - httpapi - network # Collections that this collection requires to be installed for it to be usable. The key of the dict is the diff --git a/run.sh b/run.sh index 3ddc9d9..7adfd8f 100755 --- a/run.sh +++ b/run.sh @@ -240,13 +240,16 @@ function sanity-test { # ----------------------------------------------------------------------------- function build-collection { + # cleanup + rm -f nokia-srlinux-*.tar.gz # build the collection ansible-galaxy collection build --force } function publish-collection { # build the collection - ansible-galaxy collection publish --token $(cat apikey) + build-collection + ansible-galaxy collection publish -v --token $(cat apikey) $(ls -1 nokia-srlinux-*.tar.gz) } # ----------------------------------------------------------------------------- From be9fea53c81ad97e1c90c13e6640ea318eb84ec6 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Tue, 25 Apr 2023 16:28:34 +0300 Subject: [PATCH 5/5] added requires_ansible --- meta/runtime.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/runtime.yml b/meta/runtime.yml index 52d8885..de90beb 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,3 +1,4 @@ +requires_ansible: ">=2.11" plugin_routing: modules: srl_config: