Skip to content

Commit

Permalink
Merge pull request #130 from asfadmin/test
Browse files Browse the repository at this point in the history
Release v0.2.1 - attempt #2
  • Loading branch information
jtherrmann authored Jan 14, 2025
2 parents 438be78 + 2b47fa4 commit 5da9d9b
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ on:
jobs:
call-changelog-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.13.2
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.14.0
2 changes: 1 addition & 1 deletion .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
call-create-jira-issue-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.13.2
uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.14.0
secrets:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ on:
jobs:
call-labeled-pr-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.13.2
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.14.0
2 changes: 1 addition & 1 deletion .github/workflows/release-checklist-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
call-release-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.13.2
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.14.0
permissions:
pull-requests: write
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.13.2
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.14.0
with:
release_prefix: GRFN Logging
release_branch: prod
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on: push
jobs:

call-ruff-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]
uses: ASFHyP3/actions/.github/workflows/[email protected]

call-mypy-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]

cfn-lint:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
call-bump-version-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.13.2
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.14.0
with:
user: tools-bot
email: [email protected]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.1]

### Added
- Added `mypy` to static analysis workflow.

### Changed
- Replaced `flake8` with `ruff`.

Expand Down
12 changes: 6 additions & 6 deletions ems-report/src/ems_report.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import os
from datetime import datetime, timedelta
from logging import getLogger
from os import getenv
from tempfile import NamedTemporaryFile

import boto3
Expand All @@ -16,17 +16,17 @@

def setup():
log.setLevel('INFO')
config = json.loads(getenv('CONFIG'))
config = json.loads(os.environ['CONFIG'])
return config


def get_elasticsearch_connection(host):
auth = AWSRequestsAuth(
aws_access_key=getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=getenv('AWS_SECRET_ACCESS_KEY'),
aws_token=getenv('AWS_SESSION_TOKEN'),
aws_access_key=os.getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
aws_token=os.getenv('AWS_SESSION_TOKEN'),
aws_host=host,
aws_region=getenv('AWS_REGION'),
aws_region=os.getenv('AWS_REGION'),
aws_service='es',
)
es = Elasticsearch(
Expand Down
15 changes: 7 additions & 8 deletions log-parse/src/log_parse.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import csv
import json
import os
import re
from datetime import datetime
from gzip import GzipFile
from io import StringIO
from logging import getLogger
from os import getenv
from os.path import basename

import boto3
from aws_requests_auth.aws_auth import AWSRequestsAuth
Expand Down Expand Up @@ -37,17 +36,17 @@

def setup():
log.setLevel('INFO')
config = json.loads(getenv('CONFIG'))
config = json.loads(os.environ['CONFIG'])
return config


def get_elasticsearch_connection(host):
auth = AWSRequestsAuth(
aws_access_key=getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=getenv('AWS_SECRET_ACCESS_KEY'),
aws_token=getenv('AWS_SESSION_TOKEN'),
aws_access_key=os.getenv('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
aws_token=os.getenv('AWS_SESSION_TOKEN'),
aws_host=host,
aws_region=getenv('AWS_REGION'),
aws_region=os.getenv('AWS_REGION'),
aws_service='es',
)
es = Elasticsearch(
Expand Down Expand Up @@ -92,7 +91,7 @@ def get_cloudfront_records(bucket, key):
'_id': record[14],
'request_time': datetime.strptime(record[0] + record[1] + '+0000', '%Y-%m-%d%H:%M:%S%z'),
'ip_address': record[4],
'file_name': basename(record[7]),
'file_name': os.path.basename(record[7]),
'user_id': get_user_id(record[11]),
'http_status': to_number(record[8]),
'bytes_sent': to_number(record[3]),
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ convention = "google"
[tool.ruff.lint.isort]
case-sensitive = true
lines-after-imports = 2

[tool.mypy]
python_version = "3.12"
warn_redundant_casts = true
warn_unused_ignores = true
warn_unreachable = true
strict_equality = true
check_untyped_defs = true
3 changes: 3 additions & 0 deletions requirements-all.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-r requirements-ems-report.txt
-r requirements-log-parse.txt
pytest==8.3.4
ruff
mypy
types-requests

0 comments on commit 5da9d9b

Please sign in to comment.