Skip to content

Commit

Permalink
Fix firelens config files import (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPreston authored Aug 7, 2023
1 parent d288d52 commit 6e22aea
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 202 deletions.
10 changes: 0 additions & 10 deletions .deepsource.toml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
25 changes: 21 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ repos:
- id: check-case-conflict
- id: check-json
- id: check-yaml
exclude: ^.cicd/
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: detect-aws-credentials
args:
- "--allow-missing-credentials"
- id: detect-private-key
- id: fix-byte-order-marker

- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
hooks:
- id: pyupgrade
exclude: ^tests/
args: [ "--py38-plus", "--keep-runtime-typing" ]

- repo: https://github.com/psf/black
Expand All @@ -32,10 +36,6 @@ repos:
- id: blacken-docs
additional_dependencies: [ black ]

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
Expand All @@ -50,3 +50,20 @@ repos:
entry: .scripts/cleanup_placebo.sh
require_serial: true
files: "tests/*.json$"

# - repo: https://github.com/aws-cloudformation/cfn-lint
# rev: v0.78.1
# hooks:
# - id: cfn-lint
# files: .cicd/.*\.(json|yml|yaml)$

- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
args: [ "-t", "error" ]

- repo: https://github.com/iamthefij/docker-pre-commit
rev: master
hooks:
- id: docker-compose-check
3 changes: 1 addition & 2 deletions .scripts/import_sam_policies_template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MPL-2.0
# Copyright 2020-2021 John Mille <[email protected]>

Expand Down Expand Up @@ -62,7 +61,7 @@ def find_files(filename, search_path):
TEMPLATE_FILE = find_files("policy_templates.json", ZIP_DIR.name)[0]
DEST_FILE_PATH = path.abspath("ecs_composex/iam/sam_policies.json")
print("Found source", TEMPLATE_FILE)
with open(TEMPLATE_FILE, "r") as file_fd:
with open(TEMPLATE_FILE) as file_fd:
original_content = json.loads(file_fd.read())
print("Outputting to", DEST_FILE_PATH)
with open(DEST_FILE_PATH, "w") as file_fd:
Expand Down
1 change: 0 additions & 1 deletion NOTICES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ License files can be found here
.. _Apache 2.0 License: https://www.apache.org/licenses/LICENSE-2.0.txt
.. _BSD-2 Clause License: https://opensource.org/licenses/BSD-2-Clause
.. _MIT license: https://opensource.org/licenses/MIT

1 change: 0 additions & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ Examples and walk-through

examples/lab
examples/nginx_simple

4 changes: 2 additions & 2 deletions e2e-examples/nginx_webapp/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ services:
deploy:
resources:
limits:
cpus: 0.5
cpus: "0.5"
memory: 256MB
reservations:
cpus: 0.1
cpus: "0.1"
memory: 128MB
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def rendered_content(self):
here = path.abspath(path.dirname(__file__))
jinja_env = Environment(
loader=FileSystemLoader(here),
autoescape=True,
auto_reload=False,
)
template = jinja_env.get_template("family_fluentbit_managed_config.j2")
content = template.render(
Expand Down Expand Up @@ -238,14 +236,13 @@ def source_file_content(self) -> str:
if not self.source_file:
return ""
with open(path.abspath(self.source_file)) as config_fd:
return config_fd.read()
content = config_fd.read()
return content

def render_jinja_config_file(self):
here = path.abspath(path.dirname(__file__))
jinja_env = Environment(
loader=FileSystemLoader(here),
autoescape=True,
auto_reload=False,
)
template = jinja_env.get_template("service_fluentbit_managed_config.j2")
content = template.render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
Grace {{ grace_period | int }}
{% endif %}
{%- for service_content in services_content -%}
{{ service_content }}
{{ service_content | safe }}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%- if source_file %}
{{ source_file }}
{{ source_file | safe }}
{% endif %}
{% for firehose_destination in firelens_firehose_destinations %}
[OUTPUT]
Expand Down
4 changes: 4 additions & 0 deletions ecs_composex/specs/services.x-logging.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"DockerImageOverride": {
"type": "string",
"description": "Docker image to use instead of the AWS-fluentbit image"
},
"LogDriverBufferLimit": {
"type": "number",
"minimum": 33554432,
Expand Down
2 changes: 1 addition & 1 deletion use-cases/blog.features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
ecs.task.family: bignicefamily
resources:
reservations:
cpus: '0.25'
cpus: "0.25"
memory: 1GB
environment:
LOGLEVEL: DEBUG
Expand Down
174 changes: 0 additions & 174 deletions use-cases/cfn_macro/raw_compose.yml

This file was deleted.

0 comments on commit 6e22aea

Please sign in to comment.