Commit Graph

48 Commits

Author SHA1 Message Date
Sergiy Markin b1ca8d08aa Airflow stable 2.8.2
This PS bumps up Airflow version to the latest
2.8.2 and also bumps up openstack dependences to
Antelope 2023.1

Change-Id: I1ab801527dacb7c667caf1d459d71f9df522cef6
2024-02-26 21:23:10 +00:00
Sergiy Markin 5470976d4a Airflow stable 2.8.1
Change-Id: I5e78501487e0e1cd3ec1be657f96b80ce951637c
2024-02-23 19:57:08 +00:00
Sergiy Markin eb96649b61 Airflow stable 2.6.2
This PS updates python modules and code to match Airflow 2.6.2

- bionic py36 gates  were removed
- python code corrected to match new modules versions
- selection of python modules versions was performed based on
  airflow-2.6.2 constraints
- a new pegleg validation gate was created based on airskiff deploy
  pipeline from treasuremap v1.9

Change-Id: Icc96deb0b745eaab7a19d83b00aad909dcd28c25
2023-08-30 16:07:28 +00:00
Sergiy Markin 0f2ab241f9 Restored ubuntu_bionic image build
This PS restores image build for ubuntu_bionic and adds appropriate
gates to keep it tested by appropriate functional and integrational
tests.

Change-Id: Id31d97ced8732d823937fb1f218e7ad8760d735c
2023-06-07 21:02:28 +00:00
Sergiy Markin c052d40277 Pegleg focal upgrade
This PS delivers focal version of Pegleg image and has the following updates:
- removed release-notes-jobs-python3 gate job because of incompartibility with Sphinx from current requirements
- added focal gate node and switched gates to use it
- added bindep.txt file into project root
- added bindep role into gate jobs
- added ubuntu_focal dockerfile for building focal pegleg image
- switched tox profiles to py38
- uplifted references to shipyard_client, promenade and deckhand projects
- resolved required dependencies conflicts by weakening constraints in Pipfile
- updated tox profile update-requirements for generate requirements.txt and test-requirements.txt
- generated new Pipfile.lock, requirements.txt and test-requirements.txt from Pipfile
- switched tox profiles to use requirements.txt and test-requirements.txt instead of pipenv because of upstream zuul nodes Pypi mirrorring issue
- updated reference to seaworthy site certificates in treasuremap repo
- fixed unit tests issues caused by pytest/mock updates and new openssl version
- fixed focal docker image publishing issue
- added multiprocessing into coverage tests running process
- made unit and coveraget tests more verbosive

Change-Id: I5c4c519dc725cfb8c7b4e14756347c9336028aff
2023-05-02 15:05:45 +00:00
Ruslan Aliev 770cf4256e Uplift k8s, promenade and shipyard dependencies
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Change-Id: I185cfa259c9351f8e25f223f60d9a01b331f66b6
2022-09-29 16:19:14 -05:00
Sean Eagan 4cd2ee6dab Uplift promenade
Also fix a python dependency failure [0].

[0]: https://review.opendev.org/c/skyline/skyline-apiserver/+/808195

Depends-On: https://review.opendev.org/c/airship/promenade/+/812039

Change-Id: I5aa508bce18de011956ef1b649c2ed17e376be68
2021-10-06 15:26:54 -05:00
Alexander Hughes 766e53dfb4 Update safety check for Python dependencies
This patch:
1. Updates the `tox -e safety` command to run the Safety tool [0]
   against both the Pegleg requirements.txt and the
   doc/requirements.txt file used only when `tox -e docs` is run.
2. Updates doc/requirements.txt with pinned dependencies so that
   Safety can check those dependencies.

At the time of this patch it is expected for the non-voting Safety
gate to fail, because the Promenade version used by Pegleg requires
an insecure version of kubernetes, 3.0.0.  This version of Kubernetes
is impacted by [1] due to the urllib version being used.

[0] https://pypi.org/project/safety/
[1] https://nvd.nist.gov/vuln/detail/CVE-2018-20060

Change-Id: I64fb4b1ae7c2814ad0ae11222bf8be531d4f40a5
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-06-25 19:38:01 +00:00
Ian H. Pittwood 3d1b2d9be0 Revert tox to Xenial supported version
Change-Id: Ifa388bb9359c0220d08842e4a0571b926f0a6fb9
2019-08-16 10:53:30 -05:00
Ian H. Pittwood 0e46d134c1 Implement Pipenv dependency management
Pipenv is a tool that brings better package dependency management to
python. It can automatically create and manage virtualenv as well as
managing package dependencies using Pipfile and Pipfile.lock. Adding
this dependency manager into Airship projects will decrease package
version conflicts between projects and help increase security through
hash validation of packages and vulnerability scans.

Changes:
- Imports requirements.txt type files into Pipfile
- Pipenv dependency management in tox
- Switches Safety package for "pipenv check", an implementation of
Safety
- Adds `-e` flag on VCS dependencies to resolve good versions on all
packages
- Unpins or loosens pins on "dev"-type packages

Pipenv Docs: https://docs.pipenv.org/en/latest/

Helpful Pipenv Guide: https://realpython.com/pipenv-guide/

Change-Id: I47e7e7b440d76103b4984499e6ffce4482a59353
2019-08-12 09:10:42 -05:00
Ian H. Pittwood 4480ab5574 Restructure usage of test fixtures
Pytest includes a fixture that can be used to generate temporary
directories. Previously Pegleg had implemented a hombrewed version of a
temporary directory fixture. This change removes the homebrewed version
and replaces it with the tmpdir fixture.

Implement tmpdir fixture in tests

Upgrade all testing packages to use the latest features

Removes unused imports and organizes import lists

Removes mock package requirement and uses unittest.mock, included in
python >3.3

Implements a slightly cleaner method to get proxy info

Change-Id: If66e1cfba858d5fb8948529deb8fb2d32345f630
2019-07-29 11:37:36 -05:00
Alexander Hughes 1c8d92ef6b Standardize Pegleg code with YAPF
This patch addresses inconsistent code style and enforces it with a
gate for future submissions.

Separate work will be done in the future to address several of the
PEP8 ignores for docstrings, and attempt to bring the tests directory
to PEP8 compliance.

This patch:
1. Updates .style.yapf to set the knobs desired for YAPF.
2. Updates tox.ini to allow one of the knobs to work.
3. Removes unused code from several __init__.py files.
4. Updates the YAPF version in test-requirements.txt to latest (this
   is needed for several knobs to work).
5. Stylistic changes to the python codebase in Pegleg.
6. Updates to tox.ini to run YAPF during PEP8 check.

Change-Id: Ieaa0fdef2b601d01c875d64b840986e54df73abf
2019-07-25 17:28:18 +00:00
Ian H Pittwood c88843f091 Move safety checks to new Zuul job
Moves safety checks from pep8 linting to a new Zuul job. This allows
voting to be disabled on the job when the safety check database is down.

Changes basepython to python3 for safety job.

Change-Id: I29af8af244d45fbbe008c5efc341c1407c809539
2019-07-22 08:59:00 -05:00
Ian H. Pittwood b22a10ed97 Upgrade Sphinx package
Sphinx 2.1.0 has a bug [0] that causes whitespace to be excluded in
outputted docs. This change updates Sphinx to peg any version >2.1.0.

Safety dependency vulnerability checks now will also cover the doc
requirements.txt.

[0] https://github.com/sphinx-doc/sphinx/issues/6440

Change-Id: Ic4e69862781e35c8597c7eab67a270ba3da26a0d
2019-07-10 12:39:03 -05:00
HUGHES, ALEXANDER (ah8742) d888b3e138 Add support for globally encrypted secrets
This patchset adds support for globally encrypted secrets.
Documents with a "site" layer will be encrypted/decrypted with the
standard PEGLEG_PASSPHRASE and PEGLEG_SALT environment variables.

If any secrets exist for the site with a schema of "global_passphrase"
or "global_salt" their values will be captured and used to decrypt
any secrets that do not belong to "site" layer.  If the global keys
do not exist, Pegleg will default to using site keys.

Expected usage:
1. Set site passphrase/salt environment variables
2. Select a global passphrase and salt
3. Use Pegleg's "wrap" command to wrap and encrypt the global keys
4. Encrypt or wrap documents with "global" layer
5. Provide Pegleg path to decrypt

In the case of (4) and (5) Pegleg will determine the correct keys
to use automatically

Change-Id: I5de6d63573619b346fe011628ae21e053e0711f6
2019-07-02 13:54:04 -05:00
Ian H. Pittwood 122e746df5 Adds Safety dependency vulnerability checks
This change adds dependency vulnerability checks into tox. These checks
are performed by the Safety package which checks requirements files
against a vulnerability database for any issues. If any vulnerabilities
are found, tox will fail its pep8 env.

Safety: https://pyup.io/safety/

Safety Repo: https://github.com/pyupio/safety

Safety Default Vulnerability DB: https://github.com/pyupio/safety-db

Change-Id: I70a10ecb01836373888bd87aa27953515accd4c4
2019-06-03 12:40:49 -05:00
Zuul c40ecd1ce9 Merge "Add py37 to tox" 2019-05-08 21:56:44 +00:00
Zuul 177486d8e6 Merge "zuul: Remove redundant airship-pegleg-tox-py36 job." 2019-05-08 18:58:35 +00:00
Alexander Hughes b309b18f71 Add py37 to tox
This change depends on https://review.opendev.org/#/c/640645/
The changes in 640645 streamline the zuul jobs.

The changes in this patchset build off that, and adds py37 to tox
venv to ensure developers can perform the same tests that Zuul does
which includes both py36 and py37.

Change-Id: I07ad7524e007c02457bd738240e379b852179622
2019-05-08 09:08:56 -05:00
Alexander Hughes 7483c87e7d Increase coverage threshold of tox tests to 87%
Currently tox coverage has a threshold of 85%, but unit tests are covering
88.44% of pegleg.  Increase threshold from 85% to 87%.

Change-Id: Iee86b54763ea64bf0956a9928afbb35898460ac3
2019-04-08 10:24:06 -05:00
Felipe Monteiro 6c1b6e65b8 zuul: Remove redundant airship-pegleg-tox-py36 job.
The openstack-python36-jobs template already exists; thus there
is no need for airship-pegleg-tox-py36. Since airship-pegleg-tox-py36
installs cfssl as a prerequisite for unit tests, move the install-cfssl.sh
command to tox.ini prior to unit test execution, allowing for the
airship-pegleg-tox-py36 Zuul job and its associated playbook to be
removed.

Change-Id: I66de957a1a57ef246476c1a81954cd0f822cb8be
2019-03-26 20:38:14 +00:00
Felipe Monteiro ca614beac7 trivial: fix yapf/pep8 interaction failing on logical operator
This adds a custom yapf config file with
split_before_logical_operator knob set to false so that
pep8 doesn't complain when:

    if (save_location and save_location != os.path.sep and
            save_location.endswith(os.path.sep)):

is wrongly converted to:

    if (save_location and save_location != os.path.sep
            and save_location.endswith(os.path.sep)):

This keeps the and on the first line as in the first example.

Change-Id: Ibf2813c3c969fd5f1cfd14936f3fecc9100283f7
2019-03-25 05:07:59 +00:00
Alexander Hughes 81720cd0c8 Update tox coverage to 85 percent
Previously tox coverage was set to 84 percent, it was updated to 86 percent
in https://review.openstack.org/#/c/634593/ this new threshold is too high
and causing failures with tox tests.

Change-Id: Ic741c55d2b5a555ec636320612a334672f1e0e7c
2019-03-05 10:00:49 -06:00
Tin Lam aa241081c9 Fix exception handling and add tests
Per [0], fernet decrypt can never throw an InvalidSignature exception as that
is re-raised as InvalidToken. This patch set corrects the handling of the
exception, and added additional unit tests for coverage.

[0] https://cryptography.io/en/latest/fernet/#cryptography.fernet.Fernet.decrypt

Co-Authored-By: Drew Walters <drewwalters96@gmail.com>
Change-Id: Ic5ee7ef451a5657519c5397fc4b903b5adcb1d18
Signed-off-by: Tin Lam <tin@irrational.io>
2019-02-22 16:14:25 -06:00
Tin Lam e6af6ae87e Fix a tox mismatch
This is patch set adds in a trivial fix for a mismatch between a comment
and the actual hacking rule that is being enabled.

Change-Id: I7b1b6146f0cc0222d050e9aabd42a965af63730f
Signed-off-by: Tin Lam <tin@irrational.io>
2019-02-02 20:30:48 +00:00
Felipe Monteiro 2a8d2638b3 pki: Port Promenade's PKI catalog into Pegleg
This patch set implements the PKICatalog [0] requirements
as well as PeglegManagedDocument [1] generation requirements
outlined in the spec [2].

Included in this patch set:

* New CLI entry point called "pegleg site secrets generate-pki"
* PeglegManagedDocument generation logic in
  engine.cache.managed_document
* Refactored PKICatalog logic in engine.cache.pki_catalog derived
  from the Promenade PKI implementation [3], responsible for
  generating certificates, CAs, and keypairs
* Refactored PKIGenerator logic in engine.cache.pki_generator
  derived from Promenade Generator implementation [4],
  responsible for reading in pegleg/PKICatalog/v1 documents (as
  well as promenade/PKICatalog/v1 documents for backwards
  compatibility) and generating required secrets and storing
  them into the paths specified under [0]
* Unit tests for all of the above [5]
* Example pki-catalog.yaml document under pegleg/site_yamls
* Validation schema for pki-catalog.yaml (TODO: implement
  validation logic here: [6])
* Updates to CLI documentation and inclusion of PKICatalog
  and PeglegManagedDocument documentation
* Documentation updates with PKI information [7]

TODO (in follow-up patch sets):

* Expand on overview documentation to include new Pegleg
  responsibilities
* Allow the original repository (not the copied one) to
  be the destination where the secrets are written to
* Finish up cert expiry/revocation logic

[0] https://airship-specs.readthedocs.io/en/latest/specs/approved/pegleg-secrets.html#document-generation
[1] https://airship-specs.readthedocs.io/en/latest/specs/approved/pegleg-secrets.html#peglegmanageddocument
[2] https://airship-specs.readthedocs.io/en/latest/specs/approved/pegleg-secrets.html
[3] https://github.com/openstack/airship-promenade/blob/master/promenade/pki.py
[4] https://github.com/openstack/airship-promenade/blob/master/promenade/generator.py
[5] https://review.openstack.org/#/c/611739/
[6] https://review.openstack.org/#/c/608159/
[7] https://review.openstack.org/#/c/611738/

Change-Id: I3010d04cac6d22c656d144f0dafeaa5e19a13068
2019-01-15 13:29:21 -06:00
Tin Lam 1a325a400b Add hacking extension
This patch set adds hacking rule to pegleg and fixes outstanding non-
docstring related violations.

Change-Id: I5bb5e78c211f24cf95669124bfcf9603bea8bf15
Signed-off-by: Tin Lam <tin@irrational.io>
2019-01-01 00:18:03 -06:00
Tin Lam dc1d36ba1b Add releasenotes
This patch set adds releasenotes (reno) to the airship-pegleg repository.

Change-Id: I1ed98460f40eb851ca53f8a5b68ab17f8272a2e2
Signed-off-by: Tin Lam <tin@irrational.io>
2018-11-28 02:48:40 -06:00
Tin Lam a3da86e311 Flake8 fix
This removes all PEP8 ignores and places in default settings for flake8.

Change-Id: I3c4df02dea959dfe58f44e7c0e0ac58078a81abc
Signed-off-by: Tin Lam <tin@irrational.io>
2018-11-13 14:50:42 -06:00
Tin Lam 152b42bc3b Consolidate linter jobs
Consolidating all the linting to a single job rather than having a one-off
just to lint for trailing whitespaces. As most of this projects are python,
this should already be covered by PEP8, but will be scanning for yamls with
trailing whitespaces.

Change-Id: Iee33a69ff234d21c08217faa33a19e11dfef0ad9
Signed-off-by: Tin Lam <tin@irrational.io>
2018-11-12 02:30:20 -06:00
Tin Lam 253b15cc33 Remove py35 support
As the default Docker image support for Pegleg is using py36 as a base
image, this patch set simply removes the support for py35. This allows
us to use py36 features such as secrets and f-strings without needing to
cope with backward compatibility.

Change-Id: Ic156ca67d2a0fe6fdc74c2c9da253a1cb8a3f456
Signed-off-by: Tin Lam <tin@irrational.io>
2018-11-07 13:04:34 -06:00
Tin Lam 178c058474 Add coverage job
This patch set adds in a python coverage job for pegleg using pytest.

Change-Id: Ice0332cc454f488e0372d5ab03e8b0a37db9efd1
Signed-off-by: Tin Lam <tin@irrational.io>
2018-11-06 20:59:01 -06:00
Ahmad Mahmoudi eb0deeb9e5 Pegleg encryption of site secrets
Added secret encryption/decryption to pegleg cli.

Change-Id: I95b993748d99fc4398eee1d1c59e74f382497f74
2018-10-30 16:53:51 +00:00
Felipe Monteiro ec34ed056f Allow tox to support regexes for unit tests
This patch set adds a shell wrapper script to allow
tox to be used to run a subset of unit tests via regexes:

To run all unit tests, execute::

  $ tox -epy35

To run unit tests using a regex, execute::

  $ tox -epy35 -- <regex>

Change-Id: I2ba1e18226d686cb549a075e020ba02e24204829
2018-10-22 10:18:05 -04:00
Felipe Monteiro 893ea9f4bb Standardize Pegleg directory structure
This patch set standardizes the Pegleg directory
structure because of the following reasons:

1) src/bin/pegleg is not necessary and only makes
building (e.g. documentation building) and running
of tox targets unnecessarily difficult.
2) src/bin/pegleg is a Java-like standard that
bears no relevance to Python.

Change-Id: I37d39d3d6186b92f8fbfe234221c9e44da48cf10
2018-09-23 10:33:40 -04:00
Felipe Monteiro adb23bc2a6 docs: Add developer overview guide
This patch set introduces a developer overview documentation
page to Pegleg to help developers onboard.

Change-Id: Ia453d76f024db39c6bdd97a44bfe1db1c25193f9
2018-09-13 18:28:58 -06:00
Andreas Jaeger 09d8546582 Add venv tox environment
Some OpenStack CI jobs need the venv tox environment to run, add it.

Change-Id: Ie2f9bc0725dad8650c1dd7052c886a5379432202
2018-08-24 21:32:52 +02:00
Tin Lam 537026b1d5 chore(py3): update tox targets
This patch set updates the various tox targets to use python 3 first
per Stein goal outlined in [0].

[0] https://governance.openstack.org/tc/goals/stein/python3-first.html

Change-Id: I7c6e2283ffaab74b72fe9aa3be2e040c3e338f22
Signed-off-by: Tin Lam <tin@irrational.io>
2018-08-19 07:03:57 +00:00
Felipe Monteiro 20dcaa45ae Add git and branch revision support to pegleg
* Add support for URLs and directories including git clone support
* Add support for http://, https://, and ssh:// git cloning
* Add support for cloning behind proxy
* Add support for checking out references of cloned repos
* Add support for checking out references of local repos
* Add support for Pegleg Git exceptions

This patch set also adds support for including Pegleg
source code in documentation and adds exceptions
documentation.

Change-Id: I417a62c815f97a70f3abc432cc342707e8ce1f54
2018-07-20 01:14:13 +01:00
Vu Cong Tuan 5e1fa7cd37 Add py36 testenv
Python 3.6 is installed by default in Ubuntu 18.04 LTS.
Therefore, according to Transition Plan [1],
it'll be handy to have py36 testenv.

For more details, please check Python2 Deprecation Timeline [2]
and Python3-first Goal - Completion Criteria [3].

[1] https://wiki.ubuntu.com/Python/Python36Transition
[2] https://governance.openstack.org/tc/resolutions/20180529-python2-deprecation-timeline.html
[3] https://review.openstack.org/#/c/575933/8/goals/stein/python3-first.rst@42

Change-Id: Ie8b7a9e205f0276b20b86a4dffd51bcaccb67842
2018-06-28 13:15:01 +07:00
Roman Gorshunov d9722326e9 Unifying proxy variables for tox and docker build
This patch adds proxy-related variables to tox and 'docker build'
commands.

Change-Id: Ie749d6da8643abdb78c3d58e2ea2c1f2964bf186
2018-06-22 14:48:59 +02:00
Zuul c7dc0e71dc Merge "Rename docs to doc to align with OpenStack standard" 2018-06-10 01:24:15 +00:00
Felipe Monteiro 5bef5c2c0e trivial: Print list of Deckhand errors during rendering
This patchset updates pegleg.engine.deckhand to also log the
errors associated with an exception object following a rendering
failure to aid with troubleshooting.

Change-Id: I9ca46e4b102bd39fb7c582bb1720702892df7f9e
2018-06-07 16:37:09 -04:00
Felipe Monteiro f5fc46c7af Rename docs to doc to align with OpenStack standard
This patchset updates docs to doc to align with OpenStack
standard. Follow-up patchset will be needed to publish
documentation to OpenStack [0].

[0] https://docs.openstack.org/doc-contrib-guide/project-guides.html

Change-Id: I90e5f9129207901402e26ed9488ec6e065568fe1
2018-06-06 09:25:14 -04:00
Felipe Monteiro cf907430db [trivial] Rename tox jobs for zuul
This patchset renames the tox.ini jobs:

* lint => pep8

to comply with OpenStack standards [0]. This is needed so that [1]
works seamlessly (it will enable py35 and cover jobs for Pegleg).

[0] e.g. 04469a5181/tox.ini (L119)
[1] I174d5df008f6e000da1a3878afe75919312ea7aa

Change-Id: Ic3a5f2391e129cae32f60c0fb17197169df1b4c6
2018-05-31 17:03:26 +01:00
Felipe Monteiro f4e0164466 Add top-level lint/fmt tox jobs
This is to add a top-level lint/fmt job to Pegleg so that tox -e lint
is executed in CICD. lint is included under envlist to accomplish this.
fmt is excluded from envlist as it doesn't need to be executed in CICD
but is included nonetheless for convenience.

Also fixes some typos.

Change-Id: I76165704b32653c98e506ddde71c8240d5f28492
2018-04-30 14:34:14 +00:00
Felipe Monteiro eb8c4a2b17 Add tox target for running unit tests and Makefile alias
This is to add a tox target for running unit tests in
src/bin/pegleg and to add an alias to the Makefile in root
directory.

Change-Id: Ia138c57e8d732f6dbf19f00e452b0eac1a1aa9cb
2018-04-03 21:31:56 +01:00
Krysta 7145bc25e1 CLI documentation for Pegleg
Change-Id: I1087e4ed6645faf197e3352d2981939c9e4f1ef4
2018-03-19 16:18:00 -05:00