Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand All @@ -29,7 +29,7 @@ jobs:
disable_mypy: true
generate-matrixes:
name: Generate matrixes for future use in pipelines
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
image-matrix: ${{ steps.set-image-outputs.outputs.image-matrix }}
test-matrix: ${{ steps.set-testing-outputs.outputs.test-matrix }}
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
name: Test
needs: [generate-matrixes]
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.generate-matrixes.outputs.test-matrix) }}
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
if: "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'Bump version: 2') }}"
permissions:
contents: write
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
git_tag: ${{ steps.bump-version.outputs.git_tag }}
steps:
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
matrix: ${{ fromJSON(needs.generate-matrixes.outputs.image-matrix) }}
if: "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'Bump version: 2') }}"
environment: "${{ needs.bump-version.outputs.git_tag }}"
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
name: Finalize the release
needs: [bump-version, distribute]
if: "${{ github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'Bump version: 2') }}"
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
jobs:
update:
name: Update
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout the repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
repos:
- repo: https://github.com/seisollc/goat
rev: 1e3960fdbbf766697463c21324bcbceb2f0175a6 # frozen: v2026.06.05
rev: 56e181352059375e2788a67a2661c339b15cf22d # frozen: v2026.09.02
hooks:
- id: seiso-lint
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
version: 2

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.11"

Expand Down
473 changes: 280 additions & 193 deletions Pipfile.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/Dockerfile.azure-cli
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ RUN apt-get update \
&& AZURE_SUPPORTED_DISTS="$(curl --silent https://packages.microsoft.com/repos/azure-cli/dists/ | grep -v '\.\.' | grep -o 'href=".*">' | sed 's/href="//;s/\/">//')" \
&& if grep -q "^${UBUNTU_RELEASE}$" <<< "${AZURE_SUPPORTED_DISTS}"; then CLI_REPO="${UBUNTU_RELEASE}"; else CLI_REPO="jammy"; fi \
&& echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $CLI_REPO main" | \
tee /etc/apt/sources.list.d/azure-cli.list
tee /etc/apt/sources.list.d/azure-cli.list

RUN apt-get update \
&& apt-get -y install --no-install-recommends azure-cli=${AZURE_CLI_VERSION} \
&& rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/debconf/*-old
Expand Down
20 changes: 10 additions & 10 deletions easy_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,33 @@ packages:
environments:
- none
name: cloudformation
version: 2.35.11
version: 2.37.4
version_argument: --version
azure-cli:
aliases:
- az
version: 2.87.0-1~noble
version: 2.90.0-1~jammy
version_argument: version
checkov:
version: 3.3.2
version: 3.3.20
version_argument: --version
consul-template:
helper:
- all
version: v0.42.0
version: v0.43.0
version_argument: --version
envconsul:
helper:
- all
version: v0.13.4
version: v0.14.0
version_argument: --version
fluent-bit:
helper:
- all
version: v5.0.8
version: v5.1.2
version_argument: --version
kics:
version: v2.1.20
version: v2.1.0
version_argument: version
opentofu:
aliases:
Expand All @@ -108,21 +108,21 @@ packages:
env_vars:
- TF_DATA_DIR
security: *id004
version: v1.12.3
version: v1.12.6
version_argument: version
terraform:
file_extensions: *id003
monitor:
env_vars:
- TF_DATA_DIR
security: *id004
version: 1.15.7
version: 1.16.4
version_argument: version
terratag:
helper:
- terraform
- opentofu
version: v0.7.6
version: v0.7.7
tfenv:
allow_filter:
- match: exec
Expand Down
4 changes: 2 additions & 2 deletions easy_infra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def parse_config(*, config_file: Path) -> dict:
OSError,
) as err:
LOG.error(
f"The config file {config_file} was unable to be loaded due to the following exception: {str(err)}",
f"The config file {config_file} was unable to be loaded due to the following exception: {err!s}",
)
# Raise if info or debug level logging
if LOG.getEffectiveLevel() <= 20:
raise err
raise
sys.exit(1)

return config
Expand Down
3 changes: 1 addition & 2 deletions easy_infra/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import copy
import json
from pathlib import Path
from typing import Union

import git

Expand Down Expand Up @@ -73,7 +72,7 @@
PYTHON_PACKAGES = {"checkov"}
HASHICORP_PROJECTS = {"terraform"}

CONTEXT: dict[str, dict[str, Union[str, dict[str, Union[str, bool]]]]] = {}
CONTEXT: dict[str, dict[str, str | dict[str, str | bool]]] = {}
CONTEXT["buildargs_base"] = {"COMMIT_HASH": COMMIT_HASH}
if (
f"v{__version__}" in REPO.tags
Expand Down
51 changes: 26 additions & 25 deletions easy_infra/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
from logging import DEBUG, basicConfig, getLogger
from pathlib import Path
from typing import Optional, Pattern
from re import Pattern

import docker
import requests
Expand Down Expand Up @@ -51,7 +51,7 @@ def render_jinja2(
template_file: Path,
config: dict,
output_file: Path,
output_mode: Optional[int] = None,
output_mode: int | None = None,
) -> None:
"""Render the functions file"""
folder = str(template_file.parent)
Expand All @@ -72,7 +72,7 @@ def process_container(*, container: docker.models.containers.Container) -> None:
container.remove()
status_code = response["StatusCode"]
logs = response["logs"]
if not status_code == 0:
if status_code != 0:
LOG.error(
f"Received a non-zero status code from docker ({status_code}); additional details: {logs}",
)
Expand Down Expand Up @@ -186,15 +186,19 @@ def opinionated_docker_run(
auto_remove: bool = False,
tty: bool = False,
detach: bool = True,
environment: dict = {},
environment: dict | None = None,
user: str = "",
volumes: dict | list = {},
volumes: dict | list | None = None,
working_dir: str = "/iac/",
expected_exit: int = 0,
check_logs: Pattern[str] | None = None,
network_mode: str | None = None,
) -> None:
"""Perform an opinionated docker run"""
if environment is None:
environment = {}
if volumes is None:
volumes = {}
if auto_remove and check_logs:
LOG.error(f"auto_remove cannot be {auto_remove} when check_logs is specified")
sys.exit(1)
Expand Down Expand Up @@ -270,15 +274,15 @@ def get_github_actions_matrix(

github_matrix: dict[str, list[dict[str, str]]] = {}
github_matrix["include"] = []
for tool, environments in tools_and_environments.items():
for tool, environments in tools_and_environments.items(): # noqa: PLR1704
job: dict[str, str] = {"tool": tool, "environment": "none"}
if testing:
for user in users:
for user in users: # noqa: PLR1704
job["user"] = user
github_matrix["include"].append(copy.copy(job))
else:
github_matrix["include"].append(job)
for environment in environments["environments"]:
for environment in environments["environments"]: # noqa: PLR1704
job: dict[str, str] = {"tool": tool, "environment": environment}
if testing:
for user in users:
Expand Down Expand Up @@ -363,7 +367,7 @@ def gather_tools_and_environments(
tools: list[str] = [tool]

image_and_tool_and_environment_tags: dict[str, dict[str, list[str]]] = {}
for tool in tools:
for tool in tools: # noqa: PLR1704
if environment == "none":
environments: list[str] = []
elif environment == "all":
Expand Down Expand Up @@ -639,10 +643,10 @@ def log_image_build(*, build_kwargs: dict) -> None:
# Defaults for the optional items
pull = False
cache_from = ""
for key in build_kwargs:
for key in build_kwargs: # noqa: PLC0206
match key:
case "buildargs":
buildargs = str()
buildargs = ""
for arg in build_kwargs[key]:
buildargs += f"--build-arg {arg}={build_kwargs[key][arg]} "
case "dockerfile":
Expand All @@ -667,7 +671,7 @@ def log_image_build(*, build_kwargs: dict) -> None:
case "target":
target = f"--target {build_kwargs[key]}"
case "cache_from":
cache_from = str()
cache_from = ""
for image_and_tag in build_kwargs[key]:
cache_from += f"--cache-from {image_and_tag} "

Expand Down Expand Up @@ -809,12 +813,11 @@ def build_and_tag(
if (
"tool" in constants.CONFIG["packages"][package]
and "name" in constants.CONFIG["packages"][package]["tool"]
):
if tool == constants.CONFIG["packages"][package]["tool"]["name"]:
custom_tool_name = True
dockerfile_tool: str = f"Dockerfile.{package}"
dockerfrag_tool: str = f"Dockerfrag.{package}"
break
) and tool == constants.CONFIG["packages"][package]["tool"]["name"]:
custom_tool_name = True
dockerfile_tool: str = f"Dockerfile.{package}"
dockerfrag_tool: str = f"Dockerfrag.{package}"
break
else:
LOG.error(f"Unable to identify the tool {tool} in the config")
sys.exit(1)
Expand All @@ -832,9 +835,7 @@ def build_and_tag(

# Use the package from the earlier loop if the tool name is custom
key = package if custom_tool_name else tool
if "security" in constants.CONFIG["packages"][key]:
for security_tool in constants.CONFIG["packages"][key]["security"]:
security_tools.append(security_tool)
security_tools.extend(constants.CONFIG["packages"][key].get("security", []))

# Load in the security tool dockerfiles/frags
config["dockerfile_security_tools"] = []
Expand Down Expand Up @@ -993,7 +994,7 @@ def build(
)

# pylint: disable=redefined-argument-from-local
for tool in tools_to_environments:
for tool in tools_to_environments: # noqa: PLR1704
tools: list[str] = [tool]
for package in constants.CONFIG["packages"]:
if (
Expand Down Expand Up @@ -1047,7 +1048,7 @@ def sbom(tool="all", environment="all", debug=False) -> None:
tools_to_environments=tools_to_environments, environment=environment
)

for tool in tools_to_environments:
for tool in tools_to_environments: # noqa: PLR1704
try:
for iteration, tag in enumerate(tags):
if (
Expand Down Expand Up @@ -1119,12 +1120,12 @@ def test(
image_and_versioned_tags: list[str] = []

# pylint: disable=redefined-argument-from-local
for tag in tags:
for tag in tags: # noqa: PLR1704
image_and_versioned_tags.append(f"{constants.IMAGE}:{tag}")

# Only test using the versioned tag
for image_and_versioned_tag in image_and_versioned_tags:
for user in users:
for user in users: # noqa: PLR1704
LOG.info(
f"Testing {image_and_versioned_tag} for platform {PLATFORM} with user {user}..."
)
Expand Down
2 changes: 1 addition & 1 deletion tests/terraform/hooks/secure_builtin_version/secure.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = "1.15.7"
required_version = "1.16.4"
}
2 changes: 1 addition & 1 deletion tests/terraform/tool/checkov/insecure.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ data "aws_ami" "ubuntu" {

filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
values = ["ubuntu/images/hvm-ssd/ubuntu-noble-24.04-amd64-server-*"]
}

filter {
Expand Down
Loading
Loading