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

chore: bump urllib3 from 1.26.2 to 1.26.4 #78

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 29 additions & 14 deletions .github/dependabot.yml
@@ -1,16 +1,31 @@
version: 2
updates:
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
pull-request-branch-name:
separator: "-"
open-pull-requests-limit: 99
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
pull-request-branch-name:
separator: "-"
open-pull-requests-limit: 99
- package-ecosystem: pip
directory: '/'
schedule:
interval: 'daily'
pull-request-branch-name:
separator: '-'
open-pull-requests-limit: 99
target-branch: 'develop'
commit-message:
prefix: 'chore'
- package-ecosystem: 'docker'
directory: '/'
schedule:
interval: 'daily'
pull-request-branch-name:
separator: '-'
open-pull-requests-limit: 99
commit-message:
prefix: 'chore'
target-branch: 'develop'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
commit-message:
prefix: 'chore'
pull-request-branch-name:
separator: '-'
target-branch: 'develop'
5 changes: 5 additions & 0 deletions .github/herald_rule_label_pr_breaking.json
@@ -0,0 +1,5 @@
{
"action": "label",
"eventJsonPath": "$..[?(@.body.match(/BREAKING.*?/))].body",
"labels": "breaking"
}
5 changes: 5 additions & 0 deletions .github/herald_rule_label_pr_bug.json
@@ -0,0 +1,5 @@
{
"action": "label",
"eventJsonPath": "$..[?(@.title.match(/^fix.*?/))].title",
"labels": "bug"
}
5 changes: 5 additions & 0 deletions .github/herald_rule_label_pr_documentation.json
@@ -0,0 +1,5 @@
{
"action": "label",
"eventJsonPath": "$..[?(@.title.match(/^docs.*?/))].title",
"labels": "documentation"
}
5 changes: 5 additions & 0 deletions .github/herald_rule_label_pr_enhancement.json
@@ -0,0 +1,5 @@
{
"action": "label",
"eventJsonPath": "$..[?(@.title.match(/^feat.*?/))].title",
"labels": "enhancement"
}
54 changes: 54 additions & 0 deletions .github/workflows/auto-release.yaml
@@ -0,0 +1,54 @@
name: 'Create Release'

on:
push:
branches: ['main']

jobs:
create_release:
runs-on: 'ubuntu-18.04'
name: 'Create Release'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v2'
with:
fetch-depth: 0
- name: 'Get Latest Tag'
id: 'previoustag'
uses: 'WyriHaximus/github-action-get-previous-tag@v1.0.1'
- name: 'Bump version and push tag'
id: 'tag_version'
uses: 'mathieudutour/github-tag-action@v5.2'
with:
github_token: '${{ secrets.PAT_REPO_ONLY }}'
release_branches: 'main'
default_bump: 'patch'
- name: 'Generate incremental changelog'
uses: 'charmixer/auto-changelog-action@v1.2'
with:
token: '${{ secrets.GITHUB_TOKEN }}'
release_branch: 'main'
since_tag: '${{ steps.previoustag.outputs.tag }}'
output: 'release.md'
- name: 'Read incremental changelog'
id: 'changelog'
uses: 'juliangruber/read-file-action@v1'
with:
path: './release.md'
- name: 'Create a GitHub release'
uses: 'actions/create-release@v1'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
tag_name: '${{ steps.tag_version.outputs.new_tag }}'
release_name: '${{ steps.tag_version.outputs.new_tag }}'
body: '${{ steps.changelog.outputs.content }}'
- name: 'Generate changelog'
uses: 'charmixer/auto-changelog-action@v1.2'
with:
token: '${{ secrets.GITHUB_TOKEN }}'
release_branch: 'main'
- uses: 'stefanzweifel/git-auto-commit-action@v4'
with:
commit_message: 'chore: Generating CHANGELOG.md for ${{ steps.tag_version.outputs.new_tag }}'
file_pattern: 'CHANGELOG.md'
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,70 @@
name: 'CI'

on:
push:
branches: ['**']

env:
CONTAINER_NAME: 'handbrake-job-creator'

jobs:
lint:
runs-on: 'ubuntu-20.04'
name: 'Python Lint'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.9'
- name: 'Install dependencies'
run: |
echo "Installing CI requirements"
pip install --upgrade --user pip flake8
echo "Installing project requirements"
pip install -r requirements.txt
- name: 'Flake8 :allthethings:'
run: 'python -m flake8'
test:
runs-on: 'ubuntu-20.04'
name: 'Python Tests'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.9'
- name: 'Install dependencies'
run: |
echo "Installing CI requirements"
pip install --upgrade --user pip pytest coverage
echo "Installing project requirements"
pip install -r requirements.txt
- name: 'Run tests'
run: 'python -m coverage run --branch --source=app -m pytest'
- name: 'Display coverage report'
run: 'python -m coverage report --fail-under 80 -m'
container_build:
needs: ['lint', 'test']
name: 'Build and Push Docker Container'
runs-on: 'ubuntu-20.04'
steps:
- uses: 'actions/checkout@v2'
- name: 'Build the Docker image'
run: 'docker build . -t chrisjohnson00/${CONTAINER_NAME}:${GITHUB_REF##*/}'
- name: 'Login to docker hub'
run: 'docker login --username=chrisjohnson00 --password=${{ secrets.DOCKER_HUB_PASSWORD }}'
- name: 'Push the Docker image'
run: 'docker push chrisjohnson00/${CONTAINER_NAME}:${GITHUB_REF##*/}'
actionslint:
name: 'Actions Yaml Lint'
runs-on: 'ubuntu-20.04'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v2'
- name: 'Actions Yaml Lint'
uses: 'karancode/yamllint-github-action@v2.0.0'
with:
yamllint_file_or_dir: '.github/workflows'
yamllint_comment: 'true'
yamllint_config_datapath: '{"extends":"default","rules":{"line-length":{"max":360,"level":"warning"},"quoted-strings":{"quote-type":"single","required":true,"level":"error"},"truthy":{"check-keys":false},"document-start":{"present":false}}}'
env:
GITHUB_ACCESS_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
42 changes: 42 additions & 0 deletions .github/workflows/pr_checks.yaml
@@ -0,0 +1,42 @@
name: 'PR Standards Check'
on:
pull_request:
types:
- 'opened'
- 'edited'
- 'reopened'
- 'synchronize'

jobs:
check-pr-title:
name: 'PR Title'
runs-on: 'ubuntu-18.04'
steps:
- uses: 'actions/checkout@v2'
- name: 'Install Dependencies'
run: |
npm install @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional'], rules: { 'subject-case': [2, 'always', ['sentence-case','lower-case', 'start-case']], 'header-max-length': [2, 'always', 120], 'body-max-line-length': [0, 'always', 120] }};" > commitlint.config.js
- uses: 'JulienKode/pull-request-name-linter-action@v0.2.0'
check-pr-commits:
name: 'PR Commit Messages'
runs-on: 'ubuntu-18.04'
steps:
- uses: 'actions/checkout@v2'
with:
fetch-depth: 0
- name: 'Configure commit lint'
run: |
echo "module.exports = {extends: ['@commitlint/config-conventional'], rules: { 'subject-case': [2, 'always', ['sentence-case','lower-case', 'start-case']], 'header-max-length': [2, 'always', 120], 'body-max-line-length': [0, 'always', 120] }};" > commitlint.config.js
- uses: 'wagoid/commitlint-github-action@v3.0.6'
apply-labels:
name: 'PR Labels'
runs-on: 'ubuntu-18.04'
steps:
- uses: 'actions/checkout@v2'
- name: 'Apply Herald rules'
uses: 'gagoar/use-herald-action@v2.3.0'
with:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
rulesLocation: '.github/herald_rule_*.json'
base: 'main'
21 changes: 21 additions & 0 deletions .github/workflows/push_latest.yaml
@@ -0,0 +1,21 @@
name: 'Push Latest Tag'

on:
push:
tags:
- 'v**'

env:
CONTAINER_NAME: 'handbrake-job-creator'

jobs:
push_latest:
runs-on: 'ubuntu-18.04'
steps:
- uses: 'actions/checkout@v2'
- name: 'Build the Docker image'
run: 'docker build . -t chrisjohnson00/${CONTAINER_NAME}:latest'
- name: 'Login to docker hub'
run: 'docker login --username=chrisjohnson00 --password=${{ secrets.DOCKER_HUB_PASSWORD }}'
- name: 'Push the Docker image'
run: 'docker push chrisjohnson00/${CONTAINER_NAME}:latest'
20 changes: 20 additions & 0 deletions .github/workflows/push_release_container.yaml
@@ -0,0 +1,20 @@
name: 'Push release version tag'

on:
push:
tags: ['**']

env:
CONTAINER_NAME: 'handbrake-job-creator'

jobs:
build_container:
runs-on: 'ubuntu-18.04'
steps:
- uses: 'actions/checkout@v2'
- name: 'Build the Docker image'
run: 'docker build . -t chrisjohnson00/${CONTAINER_NAME}:${GITHUB_REF##*/}'
- name: 'Login to docker hub'
run: 'docker login --username=chrisjohnson00 --password=${{ secrets.DOCKER_HUB_PASSWORD }}'
- name: 'Push the Docker image'
run: 'docker push chrisjohnson00/${CONTAINER_NAME}:${GITHUB_REF##*/}'
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

22 changes: 10 additions & 12 deletions app.py
Expand Up @@ -21,7 +21,6 @@ def main():
directory = get_watch_path()
move_path = get_move_path()
namespace = get_namespace()
encoding_profile = get_encoding_profile()
file_discovered_metrics = Gauge('handbrake_job_creator_files_in_process', 'Job Creator Found A File',
labelnames=["type", "quality"])
files_to_process_metrics = Gauge('handbrake_job_creator_files_to_process', 'Job Creator Found Some Files',
Expand Down Expand Up @@ -62,15 +61,15 @@ def main():
batch_v1 = client.BatchV1Api()
if job_exists(batch_v1, generate_job_name(file), namespace):
print("INFO: Done with {} did not create any new job".format(filename), flush=True)
# @TODO remove the file from encoding_queue!
else:
output_filename = filename
# (with 1080p in the name), it will rename it to 720p
find_value = get_file_name_needle()
replace_value = get_file_name_replace_value()
if find_value and replace_value:
output_filename = filename.replace(find_value, replace_value)
job = create_job_object(generate_job_name(file), filename, output_filename, encoding_profile,
file_size)
job = create_job_object(generate_job_name(file), filename, output_filename, file_size)
create_job(batch_v1, job, namespace)
# @TODO move the file back if the create_job call fails
print("INFO: Done with {}".format(filename), flush=True)
Expand All @@ -94,11 +93,11 @@ def get_container_version():


def get_watch_path():
return "/watch"
return get_config("WATCH_PATH")


def get_move_path():
return "/move"
return get_config("MOVE_PATH")


def get_nfs_server():
Expand Down Expand Up @@ -129,10 +128,6 @@ def get_namespace():
return get_config("JOB_NAMESPACE") # expected as an env value only


def get_encoding_profile():
return get_config("JOB_PROFILE") # expected as an env value only


def get_quality_level():
quality = get_config("QUALITY") # expected as an env value only
if quality not in ['720p', '1080p', '4k']:
Expand Down Expand Up @@ -168,14 +163,13 @@ def get_config(key, config_path=CONFIG_PATH):
return data['Value'].decode("utf-8")


def create_job_object(job_name, input_filename, output_filename, encoding_profile, file_size):
def create_job_object(job_name, input_filename, output_filename, file_size):
# Configureate Pod template container
container = client.V1Container(
name=job_name,
image="chrisjohnson00/handbrakecli:{}".format(get_container_version()),
image_pull_policy=get_job_container_pull_policy(),
command=["./wrapper.sh", "{}".format(input_filename), "{}".format(output_filename),
"{}".format(encoding_profile)],
command=["python3", "/wrapper.py", "{}".format(input_filename), "{}".format(output_filename)],
volume_mounts=[
client.V1VolumeMount(
mount_path="/input",
Expand All @@ -194,6 +188,10 @@ def create_job_object(job_name, input_filename, output_filename, encoding_profil
client.V1EnvVar(
name="JOB_TYPE",
value=get_job_type()
),
client.V1EnvVar(
name="CONSUL_HTTP_ADDR",
value=get_config('CONSUL_HTTP_ADDR')
)
]
)
Expand Down
7 changes: 7 additions & 0 deletions app/tests/test_utils.py
Expand Up @@ -13,3 +13,10 @@ def test_cleanup_job_suffix_period():
expected_result = "thepantypiatapolarizationhdtv1080p"
result = cleanup_job_suffix(input_with_period_character)
assert result == expected_result


def test_cleanup_job_suffix_underscore():
input_with_bad_character = "The_Panty_Piata_Polarization_HDTV-1080p"
expected_result = "thepantypiatapolarizationhdtv1080p"
result = cleanup_job_suffix(input_with_bad_character)
assert result == expected_result