Compare commits

...

11 commits
v0.2.4 ... main

Author SHA1 Message Date
8b3a339196 CI: fix container tag
All checks were successful
/ build (push) Successful in 17s
/ test (push) Successful in 5s
2025-03-22 01:01:32 +01:00
b01f233208 Add log messages for debugging connection to auth server
All checks were successful
/ build (push) Successful in 24s
/ test (push) Successful in 6s
2025-02-25 18:34:52 +01:00
4355e6dc42 CI: WIP
All checks were successful
/ build (push) Successful in 18s
/ test (push) Successful in 6s
2025-02-25 12:30:23 +01:00
c3ebad42d5 CI: WIP
Some checks failed
/ build (push) Failing after 9s
/ test (push) Successful in 6s
2025-02-25 04:34:19 +01:00
c5b1bdeda9 CI: WIP
Some checks failed
/ build (push) Failing after 9s
/ test (push) Successful in 5s
2025-02-25 04:31:31 +01:00
821df02758 CI: WIP
All checks were successful
/ build (push) Successful in 6s
/ test (push) Successful in 5s
2025-02-25 04:28:04 +01:00
9f7b090273 CI: WIP
Some checks failed
/ build (push) Failing after 6s
/ test (push) Successful in 6s
2025-02-25 03:12:46 +01:00
22d0a9852c CI: not use dunamai github action as it uses plain pip, not uv pip
Some checks failed
/ build (push) Failing after 6s
/ test (push) Failing after 2s
2025-02-25 03:04:14 +01:00
6f060dc2bf CI: bump uv
Some checks failed
/ build (push) Failing after 8s
/ test (push) Failing after 2s
2025-02-25 02:26:37 +01:00
f4b38e1c69 CI: use dunamai for version
Some checks failed
/ build (push) Failing after 2s
/ test (push) Failing after 1s
2025-02-25 02:20:35 +01:00
b465394766 CI: WIP 2025-02-25 01:42:49 +01:00
4 changed files with 27 additions and 29 deletions

View file

@ -19,7 +19,7 @@ jobs:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.16"
version: "0.6.9"
- name: Install
run: uv sync
@ -27,34 +27,26 @@ jobs:
- name: Run tests (API call)
run: .venv/bin/pytest -s tests/basic.py
- name: Get version with git describe
id: version
run: |
echo "version=$(git describe)" >> $GITHUB_OUTPUT
echo "$VERSION"
- name: Get version
run: echo "VERSION=$(.venv/bin/dunamai from any --style semver)" >> $GITHUB_ENV
- name: Check if the container should be built
id: builder
env:
RUN: ${{ toJSON(inputs.build || !contains(steps.version.outputs.version, '-')) }}
run: |
echo "run=$RUN" >> $GITHUB_OUTPUT
echo "Run build: $RUN"
- name: Version
run: echo $VERSION
- name: Set the version in pyproject.toml (workaround for uv not supporting dynamic version)
if: fromJSON(steps.builder.outputs.run)
env:
VERSION: ${{ steps.version.outputs.version }}
run: sed "s/0.0.0/$VERSION/" -i pyproject.toml
- name: Get distance from tag
run: echo "DISTANCE=$(.venv/bin/dunamai from any --format '{distance}')" >> $GITHUB_ENV
- name: Distance
run: echo $DISTANCE
- name: Workaround for bug of podman-login
if: fromJSON(steps.builder.outputs.run)
if: env.DISTANCE == '0'
run: |
mkdir -p $HOME/.docker
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
- name: Log in to the container registry (with another workaround)
if: fromJSON(steps.builder.outputs.run)
if: env.DISTANCE == '0'
uses: actions/podman-login@v1
with:
registry: ${{ vars.REGISTRY }}
@ -63,30 +55,30 @@ jobs:
auth_file_path: /tmp/auth.json
- name: Build the container image
if: fromJSON(steps.builder.outputs.run)
if: env.DISTANCE == '0'
uses: actions/buildah-build@v1
with:
image: oidc-fastapi-test
oci: true
labels: oidc-fastapi-test
tags: latest ${{ steps.version.outputs.version }}
tags: "latest ${{ env.VERSION }}"
containerfiles: |
./Containerfile
- name: Push the image to the registry
if: fromJSON(steps.builder.outputs.run)
if: env.DISTANCE == '0'
uses: actions/push-to-registry@v2
with:
registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
image: oidc-fastapi-test
tags: latest ${{ steps.version.outputs.version }}
tags: "latest ${{ env.VERSION }}"
- name: Build wheel
if: fromJSON(steps.builder.outputs.run)
if: env.DISTANCE == '0'
run: uv build --wheel
- name: Publish Python package (home)
if: fromJSON(steps.builder.outputs.run)
if: env.DISTANCE == '0'
env:
LOCAL_PYPI_TOKEN: ${{ secrets.LOCAL_PYPI_TOKEN }}
run: uv publish --publish-url https://code.philo.ydns.eu/api/packages/philorg/pypi --token $LOCAL_PYPI_TOKEN

View file

@ -19,7 +19,7 @@ jobs:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
version: "0.5.16"
version: "0.6.3"
- name: Install
run: uv sync

View file

@ -1,4 +1,4 @@
FROM docker.io/library/python:alpine
FROM docker.io/library/python:latest
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/

View file

@ -61,28 +61,34 @@ class Provider(AuthProviderSettings):
if self.info_url is not None:
try:
provider_info = await client.get(self.info_url)
except Exception:
except Exception as err:
logger.debug("Provider_info: cannot connect")
logger.exception(err)
raise NoPublicKey
try:
self.info = provider_info.json()
except JSONDecodeError:
logger.debug("Provider_info: cannot decode json response")
raise NoPublicKey
if "public_key" in self.info:
# For Keycloak
try:
public_key = str(self.info["public_key"])
except KeyError:
logger.debug("Provider_info: cannot get public_key")
raise NoPublicKey
elif "keys" in self.info:
# For Forgejo/Gitea
try:
public_key = str(self.info["keys"][0]["n"])
except KeyError:
logger.debug("Provider_info: cannot get key 0.n")
raise NoPublicKey
if self.public_key_url is not None:
resp = await client.get(self.public_key_url)
public_key = resp.text
if public_key is None:
logger.debug("Provider_info: cannot determine public key")
raise NoPublicKey
self.public_key = "\n".join(
["-----BEGIN PUBLIC KEY-----", public_key, "-----END PUBLIC KEY-----"]