depdelta-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- depdelta_cli-0.1.0/.dockerignore +7 -0
- depdelta_cli-0.1.0/.github/workflows/ci.yml +41 -0
- depdelta_cli-0.1.0/.github/workflows/release.yml +72 -0
- depdelta_cli-0.1.0/.gitignore +8 -0
- depdelta_cli-0.1.0/Dockerfile +18 -0
- depdelta_cli-0.1.0/LICENSE +21 -0
- depdelta_cli-0.1.0/Makefile +14 -0
- depdelta_cli-0.1.0/PKG-INFO +166 -0
- depdelta_cli-0.1.0/README.md +145 -0
- depdelta_cli-0.1.0/pyproject.toml +69 -0
- depdelta_cli-0.1.0/src/depdelta_cli/__init__.py +3 -0
- depdelta_cli-0.1.0/src/depdelta_cli/__main__.py +3 -0
- depdelta_cli-0.1.0/src/depdelta_cli/api.py +142 -0
- depdelta_cli-0.1.0/src/depdelta_cli/check.py +48 -0
- depdelta_cli-0.1.0/src/depdelta_cli/env.py +116 -0
- depdelta_cli-0.1.0/src/depdelta_cli/gerrit.py +40 -0
- depdelta_cli-0.1.0/src/depdelta_cli/git.py +110 -0
- depdelta_cli-0.1.0/src/depdelta_cli/gitlab.py +74 -0
- depdelta_cli-0.1.0/src/depdelta_cli/main.py +184 -0
- depdelta_cli-0.1.0/src/depdelta_cli/manifests.py +94 -0
- depdelta_cli-0.1.0/src/depdelta_cli/usage.py +391 -0
- depdelta_cli-0.1.0/src/depdelta_cli/web.py +68 -0
- depdelta_cli-0.1.0/tests/conftest.py +59 -0
- depdelta_cli-0.1.0/tests/helpers.py +67 -0
- depdelta_cli-0.1.0/tests/test_api.py +162 -0
- depdelta_cli-0.1.0/tests/test_check.py +49 -0
- depdelta_cli-0.1.0/tests/test_env.py +102 -0
- depdelta_cli-0.1.0/tests/test_gerrit.py +62 -0
- depdelta_cli-0.1.0/tests/test_git.py +119 -0
- depdelta_cli-0.1.0/tests/test_gitlab.py +90 -0
- depdelta_cli-0.1.0/tests/test_main.py +258 -0
- depdelta_cli-0.1.0/tests/test_manifests.py +44 -0
- depdelta_cli-0.1.0/tests/test_usage.py +310 -0
- depdelta_cli-0.1.0/tests/test_web.py +110 -0
- depdelta_cli-0.1.0/uv.lock +283 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
quality:
|
|
13
|
+
name: Lint, types & tests (Python ${{ matrix.python }})
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
python: ["3.11", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v7
|
|
20
|
+
- uses: astral-sh/setup-uv@v10.3.2
|
|
21
|
+
- name: Sync dependencies
|
|
22
|
+
run: uv sync --frozen --python ${{ matrix.python }}
|
|
23
|
+
- name: Ruff lint
|
|
24
|
+
run: uv run ruff check .
|
|
25
|
+
- name: Ruff format check
|
|
26
|
+
run: uv run ruff format --check .
|
|
27
|
+
- name: Type check (pyright)
|
|
28
|
+
run: uv run pyright
|
|
29
|
+
- name: Tests (100% coverage)
|
|
30
|
+
run: uv run pytest
|
|
31
|
+
|
|
32
|
+
image:
|
|
33
|
+
name: Docker image builds
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
needs: quality
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v7
|
|
38
|
+
- name: Build
|
|
39
|
+
run: docker build -t depdelta-cli:ci .
|
|
40
|
+
- name: Smoke test
|
|
41
|
+
run: docker run --rm depdelta-cli:ci depdelta --version
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# On a version tag (v0.1.0): the package to PyPI (trusted publishing, no
|
|
2
|
+
# token) and the image to ghcr.io/mbobiosio/depdelta-cli.
|
|
3
|
+
name: Release
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
check:
|
|
14
|
+
name: Tag matches the version
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
|
+
- name: Compare
|
|
19
|
+
run: |
|
|
20
|
+
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml | head -1)
|
|
21
|
+
test "v$VERSION" = "$GITHUB_REF_NAME" \
|
|
22
|
+
|| { echo "Tag $GITHUB_REF_NAME but pyproject says $VERSION"; exit 1; }
|
|
23
|
+
|
|
24
|
+
pypi:
|
|
25
|
+
name: PyPI
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
needs: check
|
|
28
|
+
environment:
|
|
29
|
+
name: pypi
|
|
30
|
+
url: https://pypi.org/p/depdelta-cli
|
|
31
|
+
permissions:
|
|
32
|
+
id-token: write
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v7
|
|
35
|
+
- uses: astral-sh/setup-uv@v10.3.2
|
|
36
|
+
- name: Build
|
|
37
|
+
run: uv build
|
|
38
|
+
- name: Publish
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
40
|
+
|
|
41
|
+
image:
|
|
42
|
+
name: GHCR image
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
needs: check
|
|
45
|
+
permissions:
|
|
46
|
+
contents: read
|
|
47
|
+
packages: write
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v7
|
|
50
|
+
- uses: docker/setup-buildx-action@v4
|
|
51
|
+
- uses: docker/login-action@v4
|
|
52
|
+
with:
|
|
53
|
+
registry: ghcr.io
|
|
54
|
+
username: ${{ github.actor }}
|
|
55
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
- id: meta
|
|
57
|
+
uses: docker/metadata-action@v6
|
|
58
|
+
with:
|
|
59
|
+
images: ghcr.io/mbobiosio/depdelta-cli
|
|
60
|
+
tags: |
|
|
61
|
+
type=semver,pattern={{version}}
|
|
62
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
63
|
+
type=raw,value=latest
|
|
64
|
+
labels: |
|
|
65
|
+
org.opencontainers.image.licenses=MIT
|
|
66
|
+
- uses: docker/build-push-action@v7
|
|
67
|
+
with:
|
|
68
|
+
context: .
|
|
69
|
+
platforms: linux/amd64,linux/arm64
|
|
70
|
+
push: true
|
|
71
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
72
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
FROM python:3.13-slim
|
|
2
|
+
|
|
3
|
+
RUN apt-get update \
|
|
4
|
+
&& apt-get install -y --no-install-recommends git ca-certificates \
|
|
5
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
6
|
+
|
|
7
|
+
WORKDIR /opt/depdelta-cli
|
|
8
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
9
|
+
COPY src ./src
|
|
10
|
+
RUN pip install --no-cache-dir . && rm -rf /opt/depdelta-cli
|
|
11
|
+
|
|
12
|
+
# CI mounts the checkout here (GitLab and Jenkins run in their own workdir).
|
|
13
|
+
WORKDIR /workspace
|
|
14
|
+
# The checkout belongs to another user inside CI containers.
|
|
15
|
+
RUN git config --system --add safe.directory '*'
|
|
16
|
+
|
|
17
|
+
ENTRYPOINT []
|
|
18
|
+
CMD ["depdelta"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mbuodile Obiosio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: depdelta-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: DepDelta for CI: review a change's dependency updates on Gerrit or GitLab.
|
|
5
|
+
Project-URL: Homepage, https://depdelta.com
|
|
6
|
+
Project-URL: Source, https://github.com/mbobiosio/depdelta-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/mbobiosio/depdelta-cli/issues
|
|
8
|
+
Author: Mbuodile Obiosio
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: breaking-changes,ci,dependencies,gerrit,gitlab,renovate
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# depdelta-cli
|
|
23
|
+
|
|
24
|
+
DepDelta for CI on Gerrit and GitLab: the GitHub App's dependency review,
|
|
25
|
+
posted on the change.
|
|
26
|
+
|
|
27
|
+
On every change that touches a manifest or lockfile, `depdelta`:
|
|
28
|
+
|
|
29
|
+
1. sends the changed manifests and lockfiles (both ends) to DepDelta. Source
|
|
30
|
+
code is never sent;
|
|
31
|
+
2. gets back each update's verdict and, for npm and Maven, the declarations
|
|
32
|
+
it removes or changes;
|
|
33
|
+
3. looks for those declarations in the checkout, and sends only the hits
|
|
34
|
+
(path, line, symbol);
|
|
35
|
+
4. posts the review: a Gerrit change message (no vote), or one GitLab merge
|
|
36
|
+
request note that later pipelines edit in place.
|
|
37
|
+
|
|
38
|
+
Nine ecosystems: npm, PyPI, Maven, Composer, Cargo, RubyGems, pub.dev,
|
|
39
|
+
NuGet and Go. Needs Python 3.11+ and git, nothing else.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
docker pull ghcr.io/mbobiosio/depdelta-cli:latest
|
|
43
|
+
# or
|
|
44
|
+
pip install depdelta-cli
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API key
|
|
48
|
+
|
|
49
|
+
Make one in DepDelta → Settings → API keys for CI, and store it in your CI's
|
|
50
|
+
secrets as `DEPDELTA_API_KEY`. Each key gets 240 reviews an hour, waiting
|
|
51
|
+
on release notes included.
|
|
52
|
+
|
|
53
|
+
## Jenkins with Gerrit Trigger
|
|
54
|
+
|
|
55
|
+
The job runs on `patchset-created`. Gerrit Trigger sets `GERRIT_PROJECT`,
|
|
56
|
+
`GERRIT_CHANGE_NUMBER`, `GERRIT_PATCHSET_REVISION` and `GERRIT_CHANGE_URL`.
|
|
57
|
+
The review is posted with a Gerrit account's HTTP password: a service
|
|
58
|
+
account works best.
|
|
59
|
+
|
|
60
|
+
The checkout needs the patch set's parent: don't clone with depth 1 (or let
|
|
61
|
+
`depdelta` fetch it; it does when the parent is missing).
|
|
62
|
+
|
|
63
|
+
```groovy
|
|
64
|
+
pipeline {
|
|
65
|
+
agent { docker { image 'ghcr.io/mbobiosio/depdelta-cli:latest' } }
|
|
66
|
+
stages {
|
|
67
|
+
stage('DepDelta') {
|
|
68
|
+
steps {
|
|
69
|
+
withCredentials([
|
|
70
|
+
string(credentialsId: 'depdelta-api-key', variable: 'DEPDELTA_API_KEY'),
|
|
71
|
+
usernamePassword(credentialsId: 'gerrit-http',
|
|
72
|
+
usernameVariable: 'GERRIT_HTTP_USER',
|
|
73
|
+
passwordVariable: 'GERRIT_HTTP_PASSWORD'),
|
|
74
|
+
]) {
|
|
75
|
+
// A DepDelta outage shouldn't fail the build.
|
|
76
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
|
|
77
|
+
sh 'depdelta'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Without Docker: `pip install depdelta-cli` on the agent, then the same
|
|
87
|
+
`sh 'depdelta'`.
|
|
88
|
+
|
|
89
|
+
`DEPDELTA_GERRIT_URL` overrides Gerrit's address when `GERRIT_CHANGE_URL`
|
|
90
|
+
isn't the REST root (a proxy, a different host name for agents).
|
|
91
|
+
|
|
92
|
+
Messages carry the tag `autogenerated:depdelta`, so Gerrit folds older patch
|
|
93
|
+
sets' reviews away, and notify only the change owner.
|
|
94
|
+
|
|
95
|
+
## GitLab CI
|
|
96
|
+
|
|
97
|
+
Runs in merge request pipelines. `CI_JOB_TOKEN` can't write notes: give the
|
|
98
|
+
job a project access token with the `api` scope (Reporter role is enough) as
|
|
99
|
+
`GITLAB_TOKEN`.
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
depdelta:
|
|
103
|
+
image: ghcr.io/mbobiosio/depdelta-cli:latest
|
|
104
|
+
rules:
|
|
105
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
106
|
+
changes:
|
|
107
|
+
- "**/package.json"
|
|
108
|
+
- "**/package-lock.json"
|
|
109
|
+
- "**/pom.xml"
|
|
110
|
+
- "**/requirements*.txt"
|
|
111
|
+
- "**/pyproject.toml"
|
|
112
|
+
- "**/*.lock"
|
|
113
|
+
- "**/go.mod"
|
|
114
|
+
variables:
|
|
115
|
+
GIT_DEPTH: 0
|
|
116
|
+
script:
|
|
117
|
+
- depdelta
|
|
118
|
+
allow_failure: true
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Uses link to the files at the merge request's head commit.
|
|
122
|
+
|
|
123
|
+
## Options
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
depdelta [--repo .] [--base REV --head REV] [--print]
|
|
127
|
+
[--format markdown|text] [--wait 300]
|
|
128
|
+
[--fail-on never|breaking|review|unknown|safe]
|
|
129
|
+
[--api-url URL]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- `--print` prints the review instead of posting it. With `--base` and
|
|
133
|
+
`--head` (outside CI) it always prints:
|
|
134
|
+
`depdelta --base origin/main --head HEAD`.
|
|
135
|
+
- `--wait` is how long to wait for DepDelta to read release notes it hasn't
|
|
136
|
+
seen yet. After that the review posts as it stands, saying what is still
|
|
137
|
+
being read.
|
|
138
|
+
- `--fail-on breaking` exits 1 when an update is breaking, to fail the job.
|
|
139
|
+
|
|
140
|
+
Exit status: 0 posted (or nothing to review), 1 the `--fail-on` verdict was
|
|
141
|
+
met, 2 it couldn't review or post.
|
|
142
|
+
|
|
143
|
+
## Privacy
|
|
144
|
+
|
|
145
|
+
Only the changed manifests and lockfiles leave CI, plus, for updates with
|
|
146
|
+
removed or changed APIs, the path, line and symbol of each use found. The
|
|
147
|
+
source code stays in CI. Gerrit and GitLab credentials are sent only to your
|
|
148
|
+
Gerrit or GitLab.
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
uv sync
|
|
154
|
+
make check format test
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`src/depdelta_cli/usage.py` is copied from depdelta-api
|
|
158
|
+
(`app/updates/utils/usage.py`), and `manifests.py` follows its manifest
|
|
159
|
+
names: change them there first, then here.
|
|
160
|
+
|
|
161
|
+
Releases: bump `version` in `pyproject.toml`, then tag `v<version>` and
|
|
162
|
+
push the tag. GitHub Actions publishes to PyPI and GHCR.
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# depdelta-cli
|
|
2
|
+
|
|
3
|
+
DepDelta for CI on Gerrit and GitLab: the GitHub App's dependency review,
|
|
4
|
+
posted on the change.
|
|
5
|
+
|
|
6
|
+
On every change that touches a manifest or lockfile, `depdelta`:
|
|
7
|
+
|
|
8
|
+
1. sends the changed manifests and lockfiles (both ends) to DepDelta. Source
|
|
9
|
+
code is never sent;
|
|
10
|
+
2. gets back each update's verdict and, for npm and Maven, the declarations
|
|
11
|
+
it removes or changes;
|
|
12
|
+
3. looks for those declarations in the checkout, and sends only the hits
|
|
13
|
+
(path, line, symbol);
|
|
14
|
+
4. posts the review: a Gerrit change message (no vote), or one GitLab merge
|
|
15
|
+
request note that later pipelines edit in place.
|
|
16
|
+
|
|
17
|
+
Nine ecosystems: npm, PyPI, Maven, Composer, Cargo, RubyGems, pub.dev,
|
|
18
|
+
NuGet and Go. Needs Python 3.11+ and git, nothing else.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
docker pull ghcr.io/mbobiosio/depdelta-cli:latest
|
|
22
|
+
# or
|
|
23
|
+
pip install depdelta-cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API key
|
|
27
|
+
|
|
28
|
+
Make one in DepDelta → Settings → API keys for CI, and store it in your CI's
|
|
29
|
+
secrets as `DEPDELTA_API_KEY`. Each key gets 240 reviews an hour, waiting
|
|
30
|
+
on release notes included.
|
|
31
|
+
|
|
32
|
+
## Jenkins with Gerrit Trigger
|
|
33
|
+
|
|
34
|
+
The job runs on `patchset-created`. Gerrit Trigger sets `GERRIT_PROJECT`,
|
|
35
|
+
`GERRIT_CHANGE_NUMBER`, `GERRIT_PATCHSET_REVISION` and `GERRIT_CHANGE_URL`.
|
|
36
|
+
The review is posted with a Gerrit account's HTTP password: a service
|
|
37
|
+
account works best.
|
|
38
|
+
|
|
39
|
+
The checkout needs the patch set's parent: don't clone with depth 1 (or let
|
|
40
|
+
`depdelta` fetch it; it does when the parent is missing).
|
|
41
|
+
|
|
42
|
+
```groovy
|
|
43
|
+
pipeline {
|
|
44
|
+
agent { docker { image 'ghcr.io/mbobiosio/depdelta-cli:latest' } }
|
|
45
|
+
stages {
|
|
46
|
+
stage('DepDelta') {
|
|
47
|
+
steps {
|
|
48
|
+
withCredentials([
|
|
49
|
+
string(credentialsId: 'depdelta-api-key', variable: 'DEPDELTA_API_KEY'),
|
|
50
|
+
usernamePassword(credentialsId: 'gerrit-http',
|
|
51
|
+
usernameVariable: 'GERRIT_HTTP_USER',
|
|
52
|
+
passwordVariable: 'GERRIT_HTTP_PASSWORD'),
|
|
53
|
+
]) {
|
|
54
|
+
// A DepDelta outage shouldn't fail the build.
|
|
55
|
+
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
|
|
56
|
+
sh 'depdelta'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Without Docker: `pip install depdelta-cli` on the agent, then the same
|
|
66
|
+
`sh 'depdelta'`.
|
|
67
|
+
|
|
68
|
+
`DEPDELTA_GERRIT_URL` overrides Gerrit's address when `GERRIT_CHANGE_URL`
|
|
69
|
+
isn't the REST root (a proxy, a different host name for agents).
|
|
70
|
+
|
|
71
|
+
Messages carry the tag `autogenerated:depdelta`, so Gerrit folds older patch
|
|
72
|
+
sets' reviews away, and notify only the change owner.
|
|
73
|
+
|
|
74
|
+
## GitLab CI
|
|
75
|
+
|
|
76
|
+
Runs in merge request pipelines. `CI_JOB_TOKEN` can't write notes: give the
|
|
77
|
+
job a project access token with the `api` scope (Reporter role is enough) as
|
|
78
|
+
`GITLAB_TOKEN`.
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
depdelta:
|
|
82
|
+
image: ghcr.io/mbobiosio/depdelta-cli:latest
|
|
83
|
+
rules:
|
|
84
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
85
|
+
changes:
|
|
86
|
+
- "**/package.json"
|
|
87
|
+
- "**/package-lock.json"
|
|
88
|
+
- "**/pom.xml"
|
|
89
|
+
- "**/requirements*.txt"
|
|
90
|
+
- "**/pyproject.toml"
|
|
91
|
+
- "**/*.lock"
|
|
92
|
+
- "**/go.mod"
|
|
93
|
+
variables:
|
|
94
|
+
GIT_DEPTH: 0
|
|
95
|
+
script:
|
|
96
|
+
- depdelta
|
|
97
|
+
allow_failure: true
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Uses link to the files at the merge request's head commit.
|
|
101
|
+
|
|
102
|
+
## Options
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
depdelta [--repo .] [--base REV --head REV] [--print]
|
|
106
|
+
[--format markdown|text] [--wait 300]
|
|
107
|
+
[--fail-on never|breaking|review|unknown|safe]
|
|
108
|
+
[--api-url URL]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- `--print` prints the review instead of posting it. With `--base` and
|
|
112
|
+
`--head` (outside CI) it always prints:
|
|
113
|
+
`depdelta --base origin/main --head HEAD`.
|
|
114
|
+
- `--wait` is how long to wait for DepDelta to read release notes it hasn't
|
|
115
|
+
seen yet. After that the review posts as it stands, saying what is still
|
|
116
|
+
being read.
|
|
117
|
+
- `--fail-on breaking` exits 1 when an update is breaking, to fail the job.
|
|
118
|
+
|
|
119
|
+
Exit status: 0 posted (or nothing to review), 1 the `--fail-on` verdict was
|
|
120
|
+
met, 2 it couldn't review or post.
|
|
121
|
+
|
|
122
|
+
## Privacy
|
|
123
|
+
|
|
124
|
+
Only the changed manifests and lockfiles leave CI, plus, for updates with
|
|
125
|
+
removed or changed APIs, the path, line and symbol of each use found. The
|
|
126
|
+
source code stays in CI. Gerrit and GitLab credentials are sent only to your
|
|
127
|
+
Gerrit or GitLab.
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
uv sync
|
|
133
|
+
make check format test
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`src/depdelta_cli/usage.py` is copied from depdelta-api
|
|
137
|
+
(`app/updates/utils/usage.py`), and `manifests.py` follows its manifest
|
|
138
|
+
names: change them there first, then here.
|
|
139
|
+
|
|
140
|
+
Releases: bump `version` in `pyproject.toml`, then tag `v<version>` and
|
|
141
|
+
push the tag. GitHub Actions publishes to PyPI and GHCR.
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "depdelta-cli"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "DepDelta for CI: review a change's dependency updates on Gerrit or GitLab."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [{ name = "Mbuodile Obiosio" }]
|
|
9
|
+
requires-python = ">=3.11"
|
|
10
|
+
dependencies = []
|
|
11
|
+
keywords = ["dependencies", "gerrit", "gitlab", "ci", "renovate", "breaking-changes"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Software Development :: Build Tools",
|
|
19
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://depdelta.com"
|
|
24
|
+
Source = "https://github.com/mbobiosio/depdelta-cli"
|
|
25
|
+
Issues = "https://github.com/mbobiosio/depdelta-cli/issues"
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
depdelta = "depdelta_cli.main:main"
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["hatchling>=1.27.0"]
|
|
32
|
+
build-backend = "hatchling.build"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.wheel]
|
|
35
|
+
packages = ["src/depdelta_cli"]
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
"pyright>=1.1.414",
|
|
40
|
+
"pytest>=9.1.1",
|
|
41
|
+
"pytest-cov>=7.1.0",
|
|
42
|
+
"ruff>=0.16.10",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[tool.pyright]
|
|
46
|
+
include = ["src"]
|
|
47
|
+
pythonVersion = "3.11"
|
|
48
|
+
venvPath = "."
|
|
49
|
+
venv = ".venv"
|
|
50
|
+
typeCheckingMode = "standard"
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
54
|
+
pythonpath = ["tests"]
|
|
55
|
+
python_files = ["test_*.py"]
|
|
56
|
+
addopts = "--cov=depdelta_cli --cov-report=term-missing --cov-fail-under=100"
|
|
57
|
+
|
|
58
|
+
[tool.coverage.run]
|
|
59
|
+
branch = true
|
|
60
|
+
omit = ["*/depdelta_cli/__main__.py"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff]
|
|
63
|
+
line-length = 88
|
|
64
|
+
|
|
65
|
+
[tool.ruff.format]
|
|
66
|
+
quote-style = "double"
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint]
|
|
69
|
+
select = ["E", "F", "I", "B", "UP", "SIM"]
|