Skip to content

Commit

Permalink
Merge pull request #412 from arista-eosplus/develop
Browse files Browse the repository at this point in the history
release
  • Loading branch information
dlobato authored Jul 2, 2024
2 parents f079163 + 1f5d433 commit 6896da9
Show file tree
Hide file tree
Showing 62 changed files with 638 additions and 226 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: pre-commit

on:
push:
branches:
- main
- develop
pull_request:

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
127 changes: 127 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Install dunamai
run: >-
python3 -m
pip install
dunamai
--user
- name: Build a binary wheel and a source tarball
run: DYNAMIC_VERSION=$(dunamai from git --no-metadata) python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ztpserver
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/') }}
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/ztpserver

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
13 changes: 9 additions & 4 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Pylint

on: [push]
on:
push:
branches:
- main
- develop
pull_request:

jobs:
build:
Expand All @@ -9,16 +14,16 @@ jobs:
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
pip install .
pip install -r requirements-node.txt
- name: Analysing the code with pylint
run: |
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/unittest-node-py2.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Unittest Node py2

on: [push]
on:
push:
branches:
- main
- develop
pull_request:

jobs:
build:
Expand All @@ -12,7 +17,7 @@ jobs:
env:
USER: root
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/unittest-node.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Unittest Node

on: [push]
on:
push:
branches:
- main
- develop
pull_request:

jobs:
build:
Expand All @@ -9,9 +14,9 @@ jobs:
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/unittest-server.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Unittest server

on: [push]
on:
push:
branches:
- main
- develop
pull_request:

jobs:
build:
Expand All @@ -9,9 +14,9 @@ jobs:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 24.4.2
hooks:
- id: black
args: ["-l", "100"]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
Expand Down
2 changes: 0 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[MASTER]
init-hook="from pylint.config import find_pylintrc;import os, sys; sys.path.append(os.path.dirname(find_pylintrc()))"
[BASIC]
method-rgx=[a-z_][a-z0-9_]{2,50}$

Expand Down
31 changes: 31 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
jobs:
pre_build:
- cd docs && make actionlinks

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
## 1.1.0

See http://ztpserver.readthedocs.org/en/v1.1.0/ReleaseNotes1.1.html

6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Arista EOS+ ZTPServer provides a community based implementation of a bootstrap s

Contributing Code
=================
Arista EOS+ ZTPServer provides all of its source available to anyone on Github at github.com/arista-eosplus/ztpserver. The project is freely available to anyone to fork and use in their own implementations. The Arista EOS+ community gladly accepts pull requests that add new features, enhance existing features or fix bugs.
Arista EOS+ ZTPServer provides all of its source available to anyone on Github at github.com/arista-eosplus/ztpserver. The project is freely available to anyone to fork and use in their own implementations. The Arista EOS+ community gladly accepts pull requests that add new features, enhance existing features or fix bugs.

All contributed code should be done using pull requests. Once a pull request is initiated, a member of the Arista EOS+ community will review the code and either accept it as is or provide feedback on things to change.
All contributed code should be done using pull requests. Once a pull request is initiated, a member of the Arista EOS+ community will review the code and either accept it as is or provide feedback on things to change.

As a procedural note, all pull requests that add new features and/or enhance the operation of ZTPServer are expected to have corresponding test cases with them. Pull requests will be not accepted without them.

Expand All @@ -16,7 +16,7 @@ Another available way to contribute to this project is to provide requests for f

Bugs
====
If you happen to find a bug with ZTPServer, please open an issue and flag it as a bug. In the issue description please provide details about what you were trying to do, any errors and/or tracebacks and any other information necessary to replicate the bug.
If you happen to find a bug with ZTPServer, please open an issue and flag it as a bug. In the issue description please provide details about what you were trying to do, any errors and/or tracebacks and any other information necessary to replicate the bug.

Contact
=======
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ $ sudo easy_install PyYaml
$ sudo make install
$ ztps
``````
``````
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ install:
$(PYTHON) setup.py install

sdist: clean ztpserver.spec
$(PYTHON) setup.py sdist
DYNAMIC_VERSION=$$(dunamai from git --no-metadata) $(PYTHON) setup.py sdist

sdist-dev: clean ztpserver.spec
DEV_VERSION_HASH=$$(git rev-parse --short HEAD) $(PYTHON) setup.py sdist
DYNAMIC_VERSION=$$(dunamai from git) $(PYTHON) setup.py sdist

docker_dev: sdist
@docker build -t ${IMG} .
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
0.0.0 #uses dynamic version with: dunamai from git --no-metadata
9 changes: 8 additions & 1 deletion actions/install_image
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def main(attributes):
version: EOS version of new image file
downgrade: Boolean - Should EOS images be downgraded to match?
(Default: True)
image_name_from_url: Boolean - Should EOS images be named from URL?
(Default: False)
Special_attributes:
NODE: API object - see documentation for details
Expand All @@ -90,6 +92,7 @@ def main(attributes):

node = attributes.get("NODE")
url = attributes.get("url")
image_name_from_url = attributes.get("image_name_from_url", False)

if not url:
raise RuntimeError("Missing attribute('url')")
Expand All @@ -113,7 +116,11 @@ def main(attributes):
return

# In all other cases, copy the image
image = "EOS-{}.swi".format(version)
if image_name_from_url:
image = url.rsplit("/", 1)[-1]
else:
image = "EOS-{}.swi".format(version)

try:
node.retrieve_url(url, "{}/{}".format(node.flash(), image))
except Exception as exc:
Expand Down
1 change: 0 additions & 1 deletion conf/bootstrap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
# ...
#
# See documentation for the detailed list of possible values.

Loading

0 comments on commit 6896da9

Please sign in to comment.