Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ CONFLICT! Lineage pull request for: skeleton #52

Merged
merged 68 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
744f07e
Add @jasonodoom as a default codeowner
jsf9k Mar 24, 2023
3eed760
Merge pull request #128 from cisagov/add-odoom-to-default-codeowners
jasonodoom Mar 26, 2023
8d39c8b
Use Python 3.11 for the `lint` job in the `build` workflow
mcdonnnj Apr 19, 2023
5f4b768
Merge pull request #130 from cisagov/improvement/update_python_versio…
jmorrowomni Apr 20, 2023
db5e7ff
Update pre-commit hook versions
mcdonnnj Mar 27, 2023
c9028cf
Merge pull request #129 from cisagov/maintenance/update_pre-commit_hooks
jmorrowomni Apr 20, 2023
4c595e6
Bump actions/setup-go from 3 to 4
dependabot[bot] Mar 27, 2023
847cd13
Merge pull request #127 from cisagov/dependabot/github_actions/action…
jmorrowomni Apr 20, 2023
9984792
Install/upgrade setuptools and wheel when upgrading pip
jsf9k Feb 24, 2023
7250368
Merge pull request #126 from cisagov/improvement/install-setuptools-a…
jmorrowomni Apr 20, 2023
a0bc20b
Add Go hooks to support go code for our projects
jasonodoom May 5, 2023
3628e5f
Add Staticcheck
jasonodoom May 5, 2023
668724f
Fix indentation
jasonodoom May 5, 2023
3d422b8
Fix indentation
jasonodoom May 5, 2023
5571f47
Fix indentation
jasonodoom May 5, 2023
4fd9501
Fix formatting
jasonodoom May 5, 2023
412101a
Fix formatting
jasonodoom May 5, 2023
a346fb5
Fix formatting
jasonodoom May 5, 2023
c47038b
Revert updated versions for existing hooks
jasonodoom May 5, 2023
eb52678
Fix formatting
jasonodoom May 5, 2023
f8179f1
Remove extra hook ids
jasonodoom May 5, 2023
42820e2
Replace hooks with repo based option when available
jasonodoom May 8, 2023
7f372e6
Remove the go-lint hook from the pre-commit configuration
mcdonnnj Jun 7, 2023
b823111
Update pre-commit hook versions
mcdonnnj May 31, 2023
b770fc6
Add apostrophe to Qapla
jasonodoom May 31, 2023
24a0008
detecting virtualenv installation successfully
arcsector May 17, 2023
f01965a
Whitespace change to make shfmt linter happy
jsf9k May 19, 2023
43d588f
Fix two broken links
jsf9k Apr 25, 2023
e098255
Disable caching for the setup-go Action
mcdonnnj May 31, 2023
edf1338
Bump Go from 1.19 to 1.20
mcdonnnj May 31, 2023
42f481c
Merge branch 'develop' into add-go-hooks
jmorrowomni Jun 8, 2023
bd762fe
Merge pull request #133 from cisagov/add-go-hooks
mcdonnnj Jun 8, 2023
af90040
Add @jasonodoom as a default codeowner
jsf9k Mar 24, 2023
f037c16
Use Python 3.11 for the `lint` job in the `build` workflow
mcdonnnj Apr 19, 2023
92d7a39
Update pre-commit hook versions
mcdonnnj Mar 27, 2023
e30ba2e
Bump actions/setup-go from 3 to 4
dependabot[bot] Mar 27, 2023
f3da594
Install/upgrade setuptools and wheel when upgrading pip
jsf9k Feb 24, 2023
46896a8
Add Go hooks to support go code for our projects
jasonodoom May 5, 2023
ff0ebdf
Add Staticcheck
jasonodoom May 5, 2023
f953e8e
Fix indentation
jasonodoom May 5, 2023
932b62e
Fix indentation
jasonodoom May 5, 2023
2eca0cd
Fix indentation
jasonodoom May 5, 2023
fab2344
Fix formatting
jasonodoom May 5, 2023
892673b
Fix formatting
jasonodoom May 5, 2023
0d77207
Fix formatting
jasonodoom May 5, 2023
b661316
Revert updated versions for existing hooks
jasonodoom May 5, 2023
6a40279
Fix formatting
jasonodoom May 5, 2023
b0f2bf3
Remove extra hook ids
jasonodoom May 5, 2023
a93f6d4
Replace hooks with repo based option when available
jasonodoom May 8, 2023
ec058ef
Remove the go-lint hook from the pre-commit configuration
mcdonnnj Jun 7, 2023
033e194
Update pre-commit hook versions
mcdonnnj May 31, 2023
43a4bd1
Add apostrophe to Qapla
jasonodoom May 31, 2023
7bfd06c
detecting virtualenv installation successfully
arcsector May 17, 2023
6030c9a
Whitespace change to make shfmt linter happy
jsf9k May 19, 2023
2122a39
Fix two broken links
jsf9k Apr 25, 2023
92e0e6a
Disable caching for the setup-go Action
mcdonnnj May 31, 2023
2e746e2
Bump Go from 1.19 to 1.20
mcdonnnj May 31, 2023
c07be40
Update the version of Python used in the GHA `test` job
mcdonnnj Jul 14, 2023
2a16326
Install two additional Python packages in the GHA `test` job
mcdonnnj Jul 14, 2023
8237d27
Bump python from 3.10.1-alpine to 3.11.4-alpine
dependabot[bot] Jul 14, 2023
7aeeb5e
Merge https://github.com/cisagov/skeleton-generic into lineage/skeleton
Jul 14, 2023
cf24b08
Merge branch 'develop' into lineage/skeleton
jsf9k Jul 14, 2023
8c26a61
Merge pull request #166 from cisagov/lineage/skeleton
jsf9k Jul 14, 2023
748aa6b
Merge remote-tracking branch 'skeleton-docker/develop' into lineage/s…
jsf9k Jul 17, 2023
c02e483
Migrate testing from pytest-dockerc to using python-on-whales
mcdonnnj Jul 20, 2023
a9d6c92
Merge pull request #167 from cisagov/improvement/update_testing_method
jsf9k Jul 28, 2023
44cdc25
Merge https://github.com/cisagov/skeleton-docker into lineage/skeleton
Jul 28, 2023
e82a339
Correctly merge in upstream testing changes
jsf9k Jul 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
# See https://ansible-lint.readthedocs.io/en/latest/configuring.html
# for a list of the configuration elements that can exist in this
# file.
# See https://ansible-lint.readthedocs.io/configuring/ for a list of
# the configuration elements that can exist in this file.
enable_list:
# Useful checks that one must opt-into. See here for more details:
# https://ansible-lint.readthedocs.io/en/latest/rules.html
# https://ansible-lint.readthedocs.io/rules/
- fcqn-builtins
- no-log-password
- no-same-owner
Expand Down
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# These owners will be the default owners for everything in the
# repo. Unless a later match takes precedence, these owners will be
# requested for review when someone opens a pull request.
* @dav3r @felddy @jsf9k @mcdonnnj
* @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj

# These folks own any files in the .github directory at the root of
# the repository and any of its subdirectories.
/.github/ @dav3r @felddy @jsf9k @mcdonnnj
/.github/ @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ jobs:
- id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
# We need the Go version and Go cache location for the actions/cache step,
# so the Go installation must happen before that.
- id: setup-go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.19"
# There is no expectation for actual Go code so we disable caching as
# it relies on the existence of a go.sum file.
cache: false
go-version: "1.20"
- name: Lookup Go cache directory
id: go-cache
run: |
Expand Down Expand Up @@ -113,7 +116,7 @@ jobs:
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
pip install --upgrade --requirement requirements-test.txt
- name: Set up pre-commit hook environments
run: pre-commit install-hooks
Expand Down Expand Up @@ -303,7 +306,7 @@ jobs:
- id: setup-python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- name: Cache testing environments
uses: actions/cache@v3
env:
Expand All @@ -318,7 +321,7 @@ jobs:
${{ env.BASE_CACHE_KEY }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
pip install --upgrade --requirement requirements-test.txt
- name: Download docker image artifact
uses: actions/download-artifact@v3
Expand Down
45 changes: 32 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,54 @@ repos:

# Text file hooks
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
rev: v0.34.0
hooks:
- id: markdownlint
args:
- --config=.mdl_config.yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
- repo: https://github.com/adrienverge/yamllint
rev: v1.29.0
rev: v1.32.0
hooks:
- id: yamllint
args:
- --strict

# GitHub Actions hooks
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.21.0
rev: 0.23.1
hooks:
- id: check-github-actions
- id: check-github-workflows

# pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit
rev: v3.0.2
rev: v3.3.2
hooks:
- id: validate_manifest

# Go hooks
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
# Style Checkers
- id: go-critic
# StaticCheck
- id: go-staticcheck-repo-mod
# Go Build
- id: go-build-repo-mod
# Go Mod Tidy
- id: go-mod-tidy-repo
# Go Test
- id: go-test-repo-mod
# Go Vet
- id: go-vet-repo-mod
# GoSec
- id: go-sec-repo-mod

# Shell script hooks
- repo: https://github.com/cisagov/pre-commit-shfmt
rev: v0.0.2
Expand All @@ -85,7 +104,7 @@ repos:
# Python hooks
# Run bandit on the "tests" tree with a configuration
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
rev: 1.7.5
hooks:
- id: bandit
name: bandit (tests tree)
Expand All @@ -94,13 +113,13 @@ repos:
- --config=.bandit.yml
# Run bandit on everything except the "tests" tree
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
rev: 1.7.5
hooks:
- id: bandit
name: bandit (everything else)
exclude: tests
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
Expand All @@ -114,31 +133,31 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.3.0
hooks:
- id: mypy
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.4.0
hooks:
- id: pyupgrade

# Ansible hooks
- repo: https://github.com/ansible-community/ansible-lint
rev: v5.4.0
rev: v6.17.0
hooks:
- id: ansible-lint
# files: molecule/default/playbook.yml

# Terraform hooks
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.0
rev: v1.80.0
hooks:
- id: terraform_fmt
- id: terraform_validate

# Docker hooks
- repo: https://github.com/IamTheFij/docker-pre-commit
rev: v2.1.1
rev: v3.0.1
hooks:
- id: docker-compose-check

Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--requirement requirements.txt
pre-commit
pytest
pytest-dockerc
python-on-whales
4 changes: 2 additions & 2 deletions setup-env
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ done
eval set -- "$PARAMS"

# Check to see if pyenv is installed
if [ -z "$(command -v pyenv)" ] || [ -z "$(command -v pyenv-virtualenv)" ]; then
if [ -z "$(command -v pyenv)" ] || { [ -z "$(command -v pyenv-virtualenv)" ] && [ ! -f "$(pyenv root)/plugins/pyenv-virtualenv/bin/pyenv-virtualenv" ]; }; then
echo "pyenv and pyenv-virtualenv are required."
if [[ "$OSTYPE" == "darwin"* ]]; then
cat << 'END_OF_LINE'
Expand Down Expand Up @@ -186,5 +186,5 @@ else:
END_OF_LINE
)"

# Qapla
# Qapla'
echo "Success!"
11 changes: 10 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
"""
# Third-Party Libraries
import pytest
from python_on_whales import docker

MAIN_SERVICE_NAME = "postfix"


@pytest.fixture(scope="session")
def dockerc():
"""Start up the Docker composition."""
docker.compose.up(detach=True)
yield docker
docker.compose.down()


@pytest.fixture(scope="session")
def main_container(dockerc):
"""Return the main container from the Docker composition."""
# find the container by name even if it is stopped already
return dockerc.containers(service_names=[MAIN_SERVICE_NAME], stopped=True)[0]
return dockerc.compose.ps(services=[MAIN_SERVICE_NAME], all=True)[0]


def pytest_addoption(parser):
Expand Down
7 changes: 4 additions & 3 deletions tests/container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ def test_container_count(dockerc):
"""Verify the test composition and container."""
# stopped parameter allows non-running containers in results
dav3r marked this conversation as resolved.
Show resolved Hide resolved
assert (
len(dockerc.containers(stopped=False)) == 1
len(dockerc.compose.ps(all=True)) == 1
), "Wrong number of containers were started."


def test_wait_for_ready(main_container):
"""Wait for container to be ready."""
TIMEOUT = 10
for i in range(TIMEOUT):
if READY_MESSAGE in main_container.logs().decode("utf-8"):
if READY_MESSAGE in main_container.logs():
break
time.sleep(1)
else:
Expand Down Expand Up @@ -179,5 +179,6 @@ def test_container_version_label_matches(main_container):
exec(f.read(), pkg_vars) # nosec
project_version = pkg_vars["__version__"]
assert (
main_container.labels["org.opencontainers.image.version"] == project_version
main_container.config.labels["org.opencontainers.image.version"]
== project_version
), "Dockerfile version label does not match project version"