diff --git a/.github/publish.yaml b/.github/publish.yaml index 794c5a0d8c..28c935fb92 100644 --- a/.github/publish.yaml +++ b/.github/publish.yaml @@ -1,5 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/tag-publish/0.8.2/c2cciutils/schema.json docker: + repository: + github: + server: ghcr.io + versions: + - version_tag + - version_branch + - rebuild images: - name: camptocamp/github-app-geo-project diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fb529b89d3..8c4410ee82 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -10,11 +10,10 @@ on: pull_request: permissions: - contents: read + contents: write env: HAS_SECRETS: ${{ secrets.HAS_SECRETS }} - PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring jobs: main: @@ -29,12 +28,6 @@ jobs: with: fetch-depth: 0 - - uses: camptocamp/initialise-gopass-summon-action@v2 - with: - ci-gpg-private-key: ${{secrets.CI_GPG_PRIVATE_KEY}} - github-gopass-ci-token: ${{secrets.GOPASS_CI_GITHUB_TOKEN}} - patterns: pypi docker - # Use Python 3.11 - uses: actions/setup-python@v5 with: diff --git a/github_app_geo_project/views/logs.py b/github_app_geo_project/views/logs.py index 16b53db52b..a32f4d5673 100644 --- a/github_app_geo_project/views/logs.py +++ b/github_app_geo_project/views/logs.py @@ -1,6 +1,7 @@ """Output view.""" import logging +import os from typing import Any import pyramid.httpexceptions @@ -18,6 +19,9 @@ @view_config(route_name="logs", renderer="github_app_geo_project:templates/logs.html") # type: ignore def logs_view(request: pyramid.request.Request) -> dict[str, Any]: """Get the logs of a job.""" + if request.is_authenticated or "TEST_USER" in os.environ: + raise pyramid.httpexceptions.HTTPForbidden() + title = f"Logs of job {request.matchdict['id']}" logs = "Element not found" has_access = True @@ -37,8 +41,7 @@ def logs_view(request: pyramid.request.Request) -> dict[str, Any]: if has_access: logs = job.log else: - request.response.status = 302 - logs = "Access Denied" + raise pyramid.httpexceptions.HTTPUnauthorized() return { "title": title, "logs": logs, @@ -51,10 +54,4 @@ def logs_view(request: pyramid.request.Request) -> dict[str, Any]: ), } else: - request.response.status = 404 - return { - "title": title, - "logs": logs, - "reload": False, - "favicon_postfix": "red", - } + raise pyramid.httpexceptions.HTTPNotFound()