Skip to content
September IT CI/DI Demo
Python Gherkin
Branch: master
Clone or download
bowlofstew Feature/security check (#12)
* This seems like a good idea

* better idea

* Added security checks
Latest commit c4c6833 Sep 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
appname
tests Feature/swagger (#10) Sep 10, 2019
.coveragerc Feature/travis python versions (#3) Sep 10, 2019
.editorconfig Initial TravisCI Work (#1) Sep 7, 2019
.gitattributes
.gitignore
.pre-commit-config.yaml Feature/security check (#12) Sep 11, 2019
.secrets.baseline Pre-commit secrets example (#8) Sep 10, 2019
.terraform-version Feature/build (#2) Sep 10, 2019
.travis.yml updates (#11) Sep 10, 2019
Pipfile
Pipfile.lock
README.md
codecov.yml
poetry.lock
pyproject.toml Feature/swagger (#10) Sep 10, 2019
pytest.ini

README.md

Mozilla IT Offsite

Build Status

codecov

Objectives

To present a methodology for continuous integration (CI) and continuous deploymentment (CD) that can be leveraged as a group.

Up and Running

Prerequisites

Development

  1. Clone the code from Github, git clone .
  2. Change directory to the code, cd .
  3. Open a terminal and execute the command, pipenv shell.
  4. Synchronize your pipenv with changes as they are commited with, pipenv sync.
  5. Synchronize your poetry packages (development and production) with the command, poetry update.
  6. Install the git hooks, pre-commit install.
  7. Cut a branch using a git flow or alternative branching strategy and do work.
  8. Push changes up to Github.
  9. Observe the status of the related continuous integration on your job.
  10. Upon completion of the work and a successful build, submit a pull request (PR).

Pre-commit Hooks

A variety of pre-commit hooks are installed as part of the development workflow. These may be seen in .pre-commit-config.yaml.

Secrets Check Hook

There is a secrets check in place to prevent from accident check-in of AWS or other credentials into version control. As a test, you may execute this command and attempt to commit this code:

cat >> credentials <<EOF

[commit-test]
aws_access_key_id = AKIA1111111111111111 # pragma: allowlist secret
aws_secret_access_key = 1111111111111111111111111111111111111111 # pragma: allowlist secret
EOF

Next as a test, execute the command, git add credentials and then make an attempt to git commit -m 'adding a secret'. You will now see this as part of the hook:

Detect secrets...........................................................Failed

Test Execution

Test Driven Devoplement (TDD) and Behavior Drive Development (BDD) tests can be ran with the command, pytest --cov=./. This not only runs the tests but also creates a coverage report for the code that you have written. If you do not wish to have a coverage report then merely omit the argument.

Code Quality

Code quality is measured using CodeCov. This tool tracks code quality over a variety of projections. There is a badge in the header of this README file that will take you to the hosted site to observe code quality metrics.

Continuous Integration (CI)

This code base utilizes Travis CI for it's CI process. There is a build status badge placed at the top of this README file to indicate the status of this projects build on the master branch.

Adding An Encrypted CI Secret

Secrets can be added to the CI build job with the following command line expression:

`travis encrypt --add ENVAR_KEY=ENVAR_VALUE`

Running The Application

You can run the application with the command, python appname/colors.py.

Leveraging the Swagger

You may use the Swagger by making a request to http://localhost:5000/apidocs/.

Deployment

  1. Install the correct version of Terraform with the command, tfenv install.

References

  1. Terraform Documentation
  2. TravisCI Documentation
  3. Pipenv Documentation
  4. Poetry Documentation
  5. CodeCov Example Repository
  6. CodeCov Documentation

Author(s)

Stewart Henderson

You can’t perform that action at this time.