Skip to content

Commit fecfc1a

Browse files
authored
Merge pull request #77 from cisagov/lineage/skeleton
⚠️ CONFLICT! Lineage pull request for: skeleton
2 parents f4a0261 + e336abd commit fecfc1a

File tree

8 files changed

+77
-42
lines changed

8 files changed

+77
-42
lines changed

.ansible-lint

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
# See https://ansible-lint.readthedocs.io/en/latest/configuring.html
3-
# for a list of the configuration elements that can exist in this
4-
# file.
2+
# See https://ansible-lint.readthedocs.io/configuring/ for a list of
3+
# the configuration elements that can exist in this file.
54
enable_list:
65
# Useful checks that one must opt-into. See here for more details:
7-
# https://ansible-lint.readthedocs.io/en/latest/rules.html
6+
# https://ansible-lint.readthedocs.io/rules/
87
- fcqn-builtins
98
- no-log-password
109
- no-same-owner

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# These owners will be the default owners for everything in the
44
# repo. Unless a later match takes precedence, these owners will be
55
# requested for review when someone opens a pull request.
6-
* @dav3r @jsf9k @mcdonnnj
6+
* @dav3r @jasonodoom @jsf9k @mcdonnnj
77

88
# These folks own any files in the .github directory at the root of
99
# the repository and any of its subdirectories.
10-
/.github/ @dav3r @felddy @jsf9k @mcdonnnj
10+
/.github/ @dav3r @felddy @jasonodoom @jsf9k @mcdonnnj

.github/workflows/build.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ jobs:
4747
- id: setup-python
4848
uses: actions/setup-python@v4
4949
with:
50-
python-version: "3.10"
50+
python-version: "3.11"
5151
# We need the Go version and Go cache location for the actions/cache step,
5252
# so the Go installation must happen before that.
5353
- id: setup-go
54-
uses: actions/setup-go@v3
54+
uses: actions/setup-go@v4
5555
with:
56-
go-version: "1.19"
56+
# There is no expectation for actual Go code so we disable caching as
57+
# it relies on the existence of a go.sum file.
58+
cache: false
59+
go-version: "1.20"
5760
- name: Lookup Go cache directory
5861
id: go-cache
5962
run: |
@@ -113,7 +116,7 @@ jobs:
113116
run: go install ${PACKAGE_URL}@${PACKAGE_VERSION}
114117
- name: Install dependencies
115118
run: |
116-
python -m pip install --upgrade pip
119+
python -m pip install --upgrade pip setuptools wheel
117120
pip install --upgrade --requirement requirements-test.txt
118121
- name: Set up pre-commit hook environments
119122
run: pre-commit install-hooks
@@ -303,7 +306,7 @@ jobs:
303306
- id: setup-python
304307
uses: actions/setup-python@v4
305308
with:
306-
python-version: "3.10"
309+
python-version: "3.11"
307310
- name: Cache testing environments
308311
uses: actions/cache@v3
309312
env:
@@ -318,7 +321,7 @@ jobs:
318321
${{ env.BASE_CACHE_KEY }}
319322
- name: Install dependencies
320323
run: |
321-
python -m pip install --upgrade pip
324+
python -m pip install --upgrade pip setuptools wheel
322325
pip install --upgrade --requirement requirements-test.txt
323326
- name: Download docker image artifact
324327
uses: actions/download-artifact@v3

.pre-commit-config.yaml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,54 @@ repos:
3131

3232
# Text file hooks
3333
- repo: https://github.com/igorshubovych/markdownlint-cli
34-
rev: v0.33.0
34+
rev: v0.34.0
3535
hooks:
3636
- id: markdownlint
3737
args:
3838
- --config=.mdl_config.yaml
3939
- repo: https://github.com/pre-commit/mirrors-prettier
40-
rev: v3.0.0-alpha.4
40+
rev: v3.0.0-alpha.9-for-vscode
4141
hooks:
4242
- id: prettier
4343
- repo: https://github.com/adrienverge/yamllint
44-
rev: v1.29.0
44+
rev: v1.32.0
4545
hooks:
4646
- id: yamllint
4747
args:
4848
- --strict
4949

5050
# GitHub Actions hooks
5151
- repo: https://github.com/python-jsonschema/check-jsonschema
52-
rev: 0.21.0
52+
rev: 0.23.1
5353
hooks:
5454
- id: check-github-actions
5555
- id: check-github-workflows
5656

5757
# pre-commit hooks
5858
- repo: https://github.com/pre-commit/pre-commit
59-
rev: v3.0.2
59+
rev: v3.3.2
6060
hooks:
6161
- id: validate_manifest
6262

63+
# Go hooks
64+
- repo: https://github.com/TekWizely/pre-commit-golang
65+
rev: v1.0.0-rc.1
66+
hooks:
67+
# Style Checkers
68+
- id: go-critic
69+
# StaticCheck
70+
- id: go-staticcheck-repo-mod
71+
# Go Build
72+
- id: go-build-repo-mod
73+
# Go Mod Tidy
74+
- id: go-mod-tidy-repo
75+
# Go Test
76+
- id: go-test-repo-mod
77+
# Go Vet
78+
- id: go-vet-repo-mod
79+
# GoSec
80+
- id: go-sec-repo-mod
81+
6382
# Shell script hooks
6483
- repo: https://github.com/cisagov/pre-commit-shfmt
6584
rev: v0.0.2
@@ -83,7 +102,7 @@ repos:
83102
# Python hooks
84103
# Run bandit on the "tests" tree with a configuration
85104
- repo: https://github.com/PyCQA/bandit
86-
rev: 1.7.4
105+
rev: 1.7.5
87106
hooks:
88107
- id: bandit
89108
name: bandit (tests tree)
@@ -92,13 +111,13 @@ repos:
92111
- --config=.bandit.yml
93112
# Run bandit on everything except the "tests" tree
94113
- repo: https://github.com/PyCQA/bandit
95-
rev: 1.7.4
114+
rev: 1.7.5
96115
hooks:
97116
- id: bandit
98117
name: bandit (everything else)
99118
exclude: tests
100119
- repo: https://github.com/psf/black
101-
rev: 22.12.0
120+
rev: 23.3.0
102121
hooks:
103122
- id: black
104123
- repo: https://github.com/PyCQA/flake8
@@ -112,34 +131,34 @@ repos:
112131
hooks:
113132
- id: isort
114133
- repo: https://github.com/pre-commit/mirrors-mypy
115-
rev: v0.991
134+
rev: v1.3.0
116135
hooks:
117136
- id: mypy
118137
additional_dependencies:
119138
- types-pytz
120139
- types-PyYAML
121140
- repo: https://github.com/asottile/pyupgrade
122-
rev: v3.3.1
141+
rev: v3.4.0
123142
hooks:
124143
- id: pyupgrade
125144

126145
# Ansible hooks
127146
- repo: https://github.com/ansible-community/ansible-lint
128-
rev: v5.4.0
147+
rev: v6.17.0
129148
hooks:
130149
- id: ansible-lint
131150
# files: molecule/default/playbook.yml
132151

133152
# Terraform hooks
134153
- repo: https://github.com/antonbabenko/pre-commit-terraform
135-
rev: v1.77.0
154+
rev: v1.80.0
136155
hooks:
137156
- id: terraform_fmt
138157
- id: terraform_validate
139158

140159
# Docker hooks
141160
- repo: https://github.com/IamTheFij/docker-pre-commit
142-
rev: v2.1.1
161+
rev: v3.0.1
143162
hooks:
144163
- id: docker-compose-check
145164

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
--requirement requirements.txt
22
pre-commit
33
pytest
4-
pytest-dockerc
4+
python-on-whales

setup-env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ done
6565
eval set -- "$PARAMS"
6666

6767
# Check to see if pyenv is installed
68-
if [ -z "$(command -v pyenv)" ] || [ -z "$(command -v pyenv-virtualenv)" ]; then
68+
if [ -z "$(command -v pyenv)" ] || { [ -z "$(command -v pyenv-virtualenv)" ] && [ ! -f "$(pyenv root)/plugins/pyenv-virtualenv/bin/pyenv-virtualenv" ]; }; then
6969
echo "pyenv and pyenv-virtualenv are required."
7070
if [[ "$OSTYPE" == "darwin"* ]]; then
7171
cat << 'END_OF_LINE'
@@ -189,5 +189,5 @@ else:
189189
END_OF_LINE
190190
)"
191191

192-
# Qapla
192+
# Qapla'
193193
echo "Success!"

tests/conftest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@
44
"""
55
# Third-Party Libraries
66
import pytest
7+
from python_on_whales import docker
78

89
MAIN_SERVICE_NAME = "saver"
910

1011

12+
@pytest.fixture(scope="session")
13+
def dockerc():
14+
"""Start up the Docker composition."""
15+
docker.compose.up(detach=True)
16+
yield docker
17+
docker.compose.down()
18+
19+
1120
@pytest.fixture(scope="session")
1221
def main_container(dockerc):
1322
"""Return the main container from the Docker composition."""
1423
# find the container by name even if it is stopped already
15-
return dockerc.containers(service_names=[MAIN_SERVICE_NAME], stopped=True)[0]
24+
return dockerc.compose.ps(services=[MAIN_SERVICE_NAME], all=True)[0]
1625

1726

1827
# See #60
@@ -23,7 +32,7 @@ def main_container(dockerc):
2332
# The version container should just output the version of its underlying contents.
2433
# """
2534
# # find the container by name even if it is stopped already
26-
# return dockerc.containers(service_names=[VERSION_SERVICE_NAME], stopped=True)[0]
35+
# return dockerc.compose.ps(services=[VERSION_SERVICE_NAME], all=True)[0]
2736

2837

2938
def pytest_addoption(parser):

tests/container_test.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def test_container_count(dockerc):
88
"""Verify the test composition and container."""
99
# stopped parameter allows non-running containers in results
1010
assert (
11-
len(dockerc.containers(stopped=True)) == 2
11+
len(dockerc.compose.ps(all=True)) == 2
1212
), "Wrong number of containers were started."
1313

1414

@@ -17,7 +17,7 @@ def test_container_count(dockerc):
1717
# """Wait for container to be ready."""
1818
# TIMEOUT = 10
1919
# for i in range(TIMEOUT):
20-
# if READY_MESSAGE in main_container.logs().decode("utf-8"):
20+
# if READY_MESSAGE in main_container.logs():
2121
# break
2222
# time.sleep(1)
2323
# else:
@@ -28,19 +28,22 @@ def test_container_count(dockerc):
2828

2929

3030
# See #60
31-
# def test_wait_for_exits(main_container, version_container):
31+
# def test_wait_for_exits(dockerc, main_container, version_container):
3232
# """Wait for containers to exit."""
33-
# assert main_container.wait() == 0, "Container service (main) did not exit cleanly"
3433
# assert (
35-
# version_container.wait() == 0
34+
# dockerc.wait(main_container.id) == 0
35+
# ), "Container service (main) did not exit cleanly"
36+
# assert (
37+
# dockerc.wait(version_container.id) == 0
3638
# ), "Container service (version) did not exit cleanly"
3739

3840

3941
# See #60
40-
# def test_output(main_container):
42+
# def test_output(dockerc, main_container):
4143
# """Verify the container had the correct output."""
42-
# main_container.wait() # make sure container exited if running test isolated
43-
# log_output = main_container.logs().decode("utf-8")
44+
# # make sure container exited if running test isolated
45+
# dockerc.wait(main_container.id)
46+
# log_output = main_container.logs()
4447
# assert SECRET_QUOTE in log_output, "Secret not found in log output."
4548

4649

@@ -60,10 +63,11 @@ def test_container_count(dockerc):
6063

6164

6265
# See #60
63-
# def test_log_version(version_container):
66+
# def test_log_version(dockerc, version_container):
6467
# """Verify the container outputs the correct version to the logs."""
65-
# version_container.wait() # make sure container exited if running test isolated
66-
# log_output = version_container.logs().decode("utf-8").strip()
68+
# # make sure container exited if running test isolated
69+
# dockerc.wait(version_container.id)
70+
# log_output = version_container.logs().strip()
6771
# pkg_vars = {}
6872
# with open(VERSION_FILE) as f:
6973
# exec(f.read(), pkg_vars) # nosec
@@ -81,5 +85,6 @@ def test_container_count(dockerc):
8185
# exec(f.read(), pkg_vars) # nosec
8286
# project_version = pkg_vars["__version__"]
8387
# assert (
84-
# version_container.labels["org.opencontainers.image.version"] == project_version
88+
# version_container.config.labels["org.opencontainers.image.version"]
89+
# == project_version
8590
# ), "Dockerfile version label does not match project version"

0 commit comments

Comments
 (0)