Skip to content

Commit 6a4aee9

Browse files
Sébastien RollandFaeris95
authored andcommitted
Initial commit
0 parents  commit 6a4aee9

130 files changed

Lines changed: 8650 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
__pycache__/
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
*.so
6+
*.DS_Store
7+
.git/
8+
.gitignore
9+
.venv
10+
.vscode

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
IMAGE_NAME: ${{ github.repository }}
9+
10+
11+
jobs:
12+
ruff_lint:
13+
name: Ruff Lint
14+
runs-on: ubuntu-latest
15+
16+
continue-on-error: ${{ github.ref != 'refs/heads/main' && !(github.event_name == 'pull_request' && github.base_ref == 'main') }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Run Ruff
22+
uses: astral-sh/ruff-action@v3
23+
with:
24+
version: "0.14.2"
25+
args: "check --config pyproject.toml qazpt"
26+
27+
pip_audit:
28+
name: pip-audit
29+
runs-on: ubuntu-latest
30+
31+
continue-on-error: ${{ github.ref != 'refs/heads/main' && !(github.event_name == 'pull_request' && github.base_ref == 'main') }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: "3.14"
40+
41+
- name: Run pip-audit
42+
uses: pypa/gh-action-pip-audit@v1.1.0
43+
with:
44+
inputs: .
45+
46+
build_and_push:
47+
name: Build and Push Docker Image
48+
runs-on: ubuntu-latest
49+
needs: [ruff_lint, pip_audit]
50+
51+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
52+
permissions:
53+
contents: read
54+
packages: write
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
60+
- name: Set up QEMU
61+
uses: docker/setup-qemu-action@v3
62+
with:
63+
platforms: arm64
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Log in to GitHub Container Registry
69+
uses: docker/login-action@v3
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Extract Docker metadata
76+
id: meta
77+
uses: docker/metadata-action@v5
78+
with:
79+
images: ghcr.io/${{ env.IMAGE_NAME }}
80+
tags: |
81+
type=semver,pattern={{version}}
82+
type=raw,value=latest
83+
type=sha
84+
85+
- name: Build and push Docker image
86+
uses: docker/build-push-action@v6
87+
with:
88+
context: .
89+
push: true
90+
platforms: linux/amd64,linux/arm64
91+
tags: ${{ steps.meta.outputs.tags }}
92+
labels: ${{ steps.meta.outputs.labels }}
93+
cache-from: type=gha
94+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
__pycache__
2+
**/.DS_Store
3+
.venv/
4+
.env
5+
.env.*
6+
*.egg-info/
7+
dist/
8+
build/
9+
.ruff_cache/
10+
.pytest_cache/
11+
.idea/
12+
.vscode/

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.14.2
4+
hooks:
5+
- id: ruff-check
6+
args: [--config, pyproject.toml, qazpt]
7+
always_run: true
8+
pass_filenames: false
9+
10+
- repo: https://github.com/pypa/pip-audit
11+
rev: v2.7.3
12+
hooks:
13+
- id: pip-audit
14+
args: ["."]
15+
always_run: true
16+
pass_filenames: false

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.14

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing to QAZPT
2+
3+
Thank you for your interest in contributing to QAZPT!
4+
5+
## Getting started
6+
7+
1. Fork the repository and clone your fork.
8+
2. Install the development dependencies:
9+
10+
```sh
11+
uv sync --group dev
12+
pre-commit install
13+
```
14+
15+
3. Create a branch for your change:
16+
17+
```sh
18+
git checkout -b my-feature
19+
```
20+
21+
## Development workflow
22+
23+
- **Linting:** `ruff check --config pyproject.toml qazpt`
24+
- **Formatting:** `ruff format qazpt`
25+
- **Dependency audit:** `pip-audit .`
26+
- **Pre-commit hooks:** both checks run automatically on every commit once you have run `pre-commit install`.
27+
28+
## Submitting changes
29+
30+
1. Make sure pre-commit passes locally (`pre-commit run --all-files`).
31+
2. Push your branch and open a pull request against `main`.
32+
3. Describe what the change does and why. Include steps to reproduce if you are fixing a bug.
33+
34+
## Reporting issues
35+
36+
Open an issue on GitHub. Include:
37+
38+
- The QAZPT version (`qazpt --version` or the git commit hash).
39+
- The command you ran and the full error output.
40+
- Any relevant context about your EntraID environment (without sensitive data).
41+
42+
## License
43+
44+
By contributing you agree that your contributions will be licensed under the [Apache 2.0 License](LICENSE).

Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
FROM python:3.14-slim AS base
2+
3+
ARG AZURE_CLI_VERSION=2.77.0
4+
5+
ENV PYTHONDONTWRITEBYTECODE=1 \
6+
PYTHONUNBUFFERED=1 \
7+
UV_NO_CACHE=1 \
8+
DEBIAN_FRONTEND=noninteractive \
9+
UV_TOOL_BIN_DIR=/usr/local/bin \
10+
UV_TOOL_DIR=/usr/local/share/uv/tools \
11+
AZ_DIST=bookworm
12+
13+
RUN apt-get update \
14+
&& apt-get install -y --no-install-recommends \
15+
curl ca-certificates gnupg jq \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Install Azure CLI from the official Microsoft apt repository.
19+
# The Microsoft GPG key is verified by gpg before being trusted.
20+
RUN curl -sLS https://packages.microsoft.com/keys/microsoft.asc \
21+
| gpg --dearmor \
22+
| install -o root -g root -m 644 /dev/stdin /etc/apt/trusted.gpg.d/microsoft.gpg \
23+
&& printf 'deb [arch=%s signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ %s main\n' \
24+
"$(dpkg --print-architecture)" "${AZ_DIST}" \
25+
> /etc/apt/sources.list.d/azure-cli.list \
26+
&& apt-get update \
27+
&& apt-get install -y --no-install-recommends "azure-cli=${AZURE_CLI_VERSION}-1~${AZ_DIST}" \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# Install uv from the official pinned image — integrity guaranteed by Docker
31+
# content-addressable storage, no curl | bash.
32+
COPY --from=ghcr.io/astral-sh/uv:0.11.2 /uv /uvx /usr/local/bin/
33+
34+
RUN useradd -m -U qazptuser
35+
36+
WORKDIR /app
37+
38+
# Copy packaging files first for better layer caching
39+
COPY --chown=qazptuser:qazptuser pyproject.toml README.md ./
40+
41+
# Copy sources
42+
COPY --chown=qazptuser:qazptuser qazpt ./qazpt
43+
44+
COPY --chown=qazptuser:qazptuser entrypoint.sh /usr/local/bin/
45+
RUN chmod +x /usr/local/bin/entrypoint.sh
46+
47+
# Install the app & its deps
48+
RUN uv tool install .
49+
50+
WORKDIR /home/qazptuser
51+
52+
RUN rm -rf /app
53+
54+
USER qazptuser
55+
56+
57+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

0 commit comments

Comments
 (0)