From 04193bf3f31040f5937f9e2c995af956b7ecff82 Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 11 Sep 2023 11:41:29 -0600 Subject: [PATCH 1/5] Upgrade to 0.4.2, update CI --- .github/workflows/publish-image.yaml | 9 +++++---- .pre-commit-config.yaml | 2 +- kbatch/setup.cfg | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-image.yaml b/.github/workflows/publish-image.yaml index 59e6fd4..5767cb8 100644 --- a/.github/workflows/publish-image.yaml +++ b/.github/workflows/publish-image.yaml @@ -22,10 +22,11 @@ jobs: - name: Get the version id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + run: | + echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -33,12 +34,12 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v4 with: context: kbatch-proxy file: kbatch-proxy/docker/production/Dockerfile diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e87e5a..f07f1a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ repos: hooks: - id: black language_version: python3 -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://github.com/pycqa/flake8 rev: 3.9.2 hooks: - id: flake8 diff --git a/kbatch/setup.cfg b/kbatch/setup.cfg index 56789e5..97541a9 100644 --- a/kbatch/setup.cfg +++ b/kbatch/setup.cfg @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [metadata] name = kbatch -version = 0.4.1 +version = 0.4.2 description = Submit batch jobs to Kubernetes. long_description = file: README.md long_description_content_type = text/markdown From df7d9192c9c64460508a782241353cb10ce42ae9 Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 11 Sep 2023 11:56:40 -0600 Subject: [PATCH 2/5] Pin pydantic < 2.0 --- docs/source/conf.py | 2 +- kbatch-proxy/requirements.txt | 2 +- kbatch-proxy/setup.cfg | 2 +- kbatch/kbatch/__init__.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index e23af5f..b420892 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -22,7 +22,7 @@ author = "Tom Augspurger" # The full version, including alpha/beta/rc tags -release = "0.4.1" +release = "0.4.2" # -- General configuration --------------------------------------------------- diff --git a/kbatch-proxy/requirements.txt b/kbatch-proxy/requirements.txt index 62c748a..249a85e 100644 --- a/kbatch-proxy/requirements.txt +++ b/kbatch-proxy/requirements.txt @@ -6,4 +6,4 @@ gunicorn==20.1.0 jupyterhub escapism rich -pydantic[dotenv] \ No newline at end of file +pydantic[dotenv]<2.0.0 \ No newline at end of file diff --git a/kbatch-proxy/setup.cfg b/kbatch-proxy/setup.cfg index c4f65cc..62c2e44 100644 --- a/kbatch-proxy/setup.cfg +++ b/kbatch-proxy/setup.cfg @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [metadata] name = kbatch-proxy -version = 0.4.1 +version = 0.4.2 description = Proxy batch job requests to kubernetes. long_description = file: README.md long_description_content_type = text/markdown diff --git a/kbatch/kbatch/__init__.py b/kbatch/kbatch/__init__.py index cf54de4..8a9a13c 100644 --- a/kbatch/kbatch/__init__.py +++ b/kbatch/kbatch/__init__.py @@ -14,7 +14,7 @@ from ._backend import make_job, make_cronjob -__version__ = "0.4.1" +__version__ = "0.4.2" __all__ = [ "__version__", From b178c4c8b8af8fc56786954dcbd4a0c9f1c78ab0 Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 11 Sep 2023 11:58:35 -0600 Subject: [PATCH 3/5] Pin pydantic < 2.0 in kbatch-proxy --- kbatch-proxy/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kbatch-proxy/setup.cfg b/kbatch-proxy/setup.cfg index 62c2e44..936a2ec 100644 --- a/kbatch-proxy/setup.cfg +++ b/kbatch-proxy/setup.cfg @@ -20,7 +20,7 @@ install_requires = httpx jupyterhub kubernetes - pydantic[dotenv] + pydantic[dotenv]<2.0.0 [options.extras_require] all = From 980c0259921d436db2bff50bf8ca32563085860f Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 11 Sep 2023 12:04:05 -0600 Subject: [PATCH 4/5] Fix mypy issue --- kbatch-proxy/kbatch_proxy/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kbatch-proxy/kbatch_proxy/main.py b/kbatch-proxy/kbatch_proxy/main.py index 0e7df16..50bf8ba 100644 --- a/kbatch-proxy/kbatch_proxy/main.py +++ b/kbatch-proxy/kbatch_proxy/main.py @@ -132,7 +132,7 @@ async def get_current_user(request: Request) -> User: user = None if user: - return User(**user, api_token=token, authenticated=True) + return User(**user, api_token=token) else: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, From 9cce26f0ccbf076bc785b2a7245300a5f713c407 Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 11 Sep 2023 12:08:51 -0600 Subject: [PATCH 5/5] Fix more mypy issues --- kbatch/kbatch/_backend.py | 2 +- kbatch/kbatch/_core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kbatch/kbatch/_backend.py b/kbatch/kbatch/_backend.py index 049291e..f25db8e 100644 --- a/kbatch/kbatch/_backend.py +++ b/kbatch/kbatch/_backend.py @@ -162,7 +162,7 @@ def _make_job_spec( return V1JobSpec(template=template, backoff_limit=0, ttl_seconds_after_finished=300) -def _make_job_name(name: str, schedule: str = None): +def _make_job_name(name: str, schedule: Union[str, None] = None): generate_name = name if not name.endswith("-"): generate_name = name + "-" diff --git a/kbatch/kbatch/_core.py b/kbatch/kbatch/_core.py index 6c94b32..da69b7e 100644 --- a/kbatch/kbatch/_core.py +++ b/kbatch/kbatch/_core.py @@ -82,7 +82,7 @@ def _request_action( token: Optional[str], method: str, model: Union[V1Job, V1CronJob], - resource_name: str = None, + resource_name: Union[str, None] = None, json_data: Optional[dict] = None, ): client = httpx.Client(follow_redirects=True)