Public Access
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
065a38b357 |
@@ -2,36 +2,6 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.53.3] - 2026-09-19
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- *(ci)* Check out API-created dep branch via remote-tracking ref
|
||||
|
||||
## [0.53.2] - 2026-09-19
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- *(ci)* Create dep-PR branches via POST /branches
|
||||
|
||||
## [0.53.1] - 2026-09-19
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- *(ci)* Handle list-shaped ref response in create_dependency_pr
|
||||
|
||||
## [0.53.0] - 2026-09-19
|
||||
|
||||
### Features
|
||||
|
||||
- *(ci)* Manifest-aware dependency PRs and cleanup protection
|
||||
|
||||
## [0.52.0] - 2026-09-19
|
||||
|
||||
### Features
|
||||
|
||||
- *(ci)* Verify producer container artifact before opening dependency PR
|
||||
|
||||
## [0.51.12] - 2026-09-19
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -16,12 +16,12 @@ quality badges.
|
||||
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/src/branch/master/LICENSE)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/wiki)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/releases)
|
||||
[](https://www.python.org/downloads/)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/wiki)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/releases)
|
||||
[](https://www.python.org/downloads/)
|
||||
|
||||
## Why devx?
|
||||
|
||||
@@ -87,7 +87,7 @@ extra index and list devx in your dependencies:
|
||||
```toml
|
||||
[project]
|
||||
dependencies = [
|
||||
"devx>=0.53.3",
|
||||
"devx>=0.51.12",
|
||||
]
|
||||
|
||||
[tool.pip]
|
||||
@@ -101,8 +101,8 @@ pip install -e .
|
||||
```
|
||||
|
||||
> **Note:** If your project requires a specific devx version, pin it in
|
||||
> `dependencies` (for example, `"devx==0.53.3"`) or use a version constraint
|
||||
> (for example, `"devx>=0.53.3,<0.54"`).
|
||||
> `dependencies` (for example, `"devx==0.51.12"`) or use a version constraint
|
||||
> (for example, `"devx>=0.51.12,<0.52"`).
|
||||
|
||||
### Optional extras
|
||||
|
||||
|
||||
+8
-8
@@ -12,12 +12,12 @@ project to be reusable across all oblachno-oss repositories.
|
||||
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/src/branch/master/LICENSE)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/wiki)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/releases)
|
||||
[](https://www.python.org/downloads/)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/wiki)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/actions)
|
||||
[](https://git.oblachno.oblachno.fyi/oblachno-oss/devx/releases)
|
||||
[](https://www.python.org/downloads/)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -74,14 +74,14 @@ Add devx to your `pyproject.toml` dependencies and configure the registry:
|
||||
```toml
|
||||
[project]
|
||||
dependencies = [
|
||||
"devx>=0.53.3",
|
||||
"devx>=0.51.12",
|
||||
]
|
||||
|
||||
[tool.pip]
|
||||
extra-index-url = "https://git.oblachno.oblachno.fyi/api/packages/oblachno-oss/pypi/simple"
|
||||
```
|
||||
|
||||
Pin a specific version if needed: `"devx==0.53.3"` or `"devx>=0.53.3,<0.54"`.
|
||||
Pin a specific version if needed: `"devx==0.51.12"` or `"devx>=0.51.12,<0.52"`.
|
||||
|
||||
### Optional extras
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# DEVX-168: Fix create_dependency_pr master-ref parsing
|
||||
|
||||
## Problem
|
||||
|
||||
`devx.ci.create_dependency_pr` crashes with
|
||||
`AttributeError: 'list' object has no attribute 'get'` when creating the
|
||||
dependency branch. Gitea's `GET /repos/{o}/{r}/git/refs/heads/master`
|
||||
returns a JSON **array** of matching refs, not a single object. Observed
|
||||
in production when sso-bridge v0.4.1's post-merge dep-PR step ran.
|
||||
|
||||
## Approach
|
||||
|
||||
REQ-1: Normalize the ref response — if it is a list, select the entry
|
||||
whose `ref` field equals `refs/heads/master` or fall back to the first
|
||||
entry; proceed to extract `object.sha` as before. An empty or absent
|
||||
SHA still fails closed.
|
||||
|
||||
## Test Plan
|
||||
|
||||
- Unit test: list-shaped response resolves SHA and creates the PR.
|
||||
- Unit test: empty list fails with the master-SHA error message.
|
||||
|
||||
## Deploy Plan
|
||||
|
||||
devx releases as a version tag; sso-bridge/infra pin bumps pick it up via
|
||||
their normal dep-PR flow.
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
Revert the commit; dep-PR creation stays broken on Gitea (status quo).
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [x] REQ-1: list-shaped ref response is handled; SHA extraction works;
|
||||
empty list still errors. Covered by unit tests at 100% coverage.
|
||||
@@ -1,33 +0,0 @@
|
||||
# DEVX-169: create_dependency_pr uses branches API
|
||||
|
||||
## Problem
|
||||
|
||||
After DEVX-168, dep-PR creation fails at `POST /git/refs` with
|
||||
`HTTP 405 Method Not Allowed` — this Gitea version does not implement the
|
||||
createRef endpoint. Observed creating the sso_bridge 0.4.1 infra
|
||||
dependency PR.
|
||||
|
||||
## Approach
|
||||
|
||||
REQ-1: Create the dependency branch via `POST /branches` with
|
||||
`new_branch_name`/`old_branch_name` (from master). An already-exists
|
||||
error is tolerated; other API errors fail closed.
|
||||
|
||||
## Test Plan
|
||||
|
||||
- Branch creation calls `POST /branches` with the expected payload.
|
||||
- 422 already-exists is tolerated and the PR is still created.
|
||||
- Other API errors abort with a branch-creation failure.
|
||||
|
||||
## Deploy Plan
|
||||
|
||||
devx release tag; producers pick it up via pin bumps.
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
Revert; dep-PR creation stays broken (status quo).
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [x] REQ-1: branch creation uses the branches API; already-exists
|
||||
tolerated; failures surface. Covered by unit tests at 100% coverage.
|
||||
@@ -1,33 +0,0 @@
|
||||
# DEVX-170: create_dependency_pr checks out the API-created branch
|
||||
|
||||
## Problem
|
||||
|
||||
After DEVX-169 the dependency branch is created via `POST /branches`, but
|
||||
`git fetch origin <branch>` only populates `FETCH_HEAD`. The follow-up
|
||||
`git checkout <branch>` fails silently (`check=False`), commits land on
|
||||
the wrong ref, and `git push origin <branch>` fails with
|
||||
`src refspec does not match any`. Observed creating the sso_bridge 0.4.1
|
||||
infra dependency PR.
|
||||
|
||||
## Approach
|
||||
|
||||
REQ-1: Fetch the API-created branch into `refs/remotes/origin/<branch>`
|
||||
and force-create the local branch with `git checkout -B <branch>
|
||||
origin/<branch>`, both with `check=True` so failures surface.
|
||||
|
||||
## Test Plan
|
||||
|
||||
- Unit test asserts the fetch refspec and `checkout -B` invocations.
|
||||
|
||||
## Deploy Plan
|
||||
|
||||
devx release tag; producers pick it up via pin bumps.
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
Revert; dep-PR creation stays broken (status quo).
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [x] REQ-1: the clone checks out the API-created branch so commit and
|
||||
push target `deps/<pkg>-<version>`; covered by unit tests.
|
||||
@@ -48,12 +48,12 @@ Add devx to your `pyproject.toml`:
|
||||
```toml
|
||||
[project]
|
||||
dependencies = [
|
||||
"devx>=0.53.3",
|
||||
"devx>=0.51.12",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"devx>=0.53.3",
|
||||
"devx>=0.51.12",
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@ create_dependency_pr, auto_merge, release, publish), developer tooling
|
||||
molecule testing helpers for Ansible projects.
|
||||
"""
|
||||
|
||||
__version__ = "0.53.3"
|
||||
__version__ = "0.51.12"
|
||||
|
||||
@@ -344,34 +344,20 @@ def cli(
|
||||
|
||||
# Create branch via API
|
||||
try:
|
||||
# Implements: REQ-1 — Gitea lacks POST /git/refs; create the branch
|
||||
# from master via the branches API.
|
||||
client._request(
|
||||
"POST",
|
||||
"/branches",
|
||||
json={"new_branch_name": branch_name, "old_branch_name": base_branch},
|
||||
)
|
||||
master_ref = client._request("GET", "/git/refs/heads/master").json()
|
||||
master_sha = master_ref.get("object", {}).get("sha", "")
|
||||
if not master_sha:
|
||||
raise click.ClickException("Could not get master SHA")
|
||||
client._request("POST", "/git/refs", json={"ref": f"refs/heads/{branch_name}", "sha": master_sha})
|
||||
except APIError as e:
|
||||
if "already exists" in str(e).lower():
|
||||
click.echo(f"[dep-pr] Branch {branch_name} already exists")
|
||||
else:
|
||||
raise click.ClickException(_("Failed to create branch: {error}", error=str(e))) from None
|
||||
|
||||
# Check out the API-created branch inside the target clone. A plain
|
||||
# fetch only populates FETCH_HEAD — fetch into the remote-tracking ref
|
||||
# and force-create the local branch from it.
|
||||
subprocess.run( # nosec B603 B607
|
||||
["git", "fetch", "origin", f"{branch_name}:refs/remotes/origin/{branch_name}"],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
cwd=workdir,
|
||||
)
|
||||
subprocess.run( # nosec B603 B607
|
||||
["git", "checkout", "-B", branch_name, f"origin/{branch_name}"],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
cwd=workdir,
|
||||
)
|
||||
# Check out the API-created branch inside the target clone.
|
||||
subprocess.run(["git", "fetch", "origin", f"{branch_name}"], check=False, capture_output=True, cwd=workdir) # nosec B603 B607
|
||||
subprocess.run(["git", "checkout", branch_name], check=False, capture_output=True, cwd=workdir) # nosec B603 B607
|
||||
|
||||
if manifest_path:
|
||||
fields = {
|
||||
|
||||
@@ -460,124 +460,3 @@ class TestCliManifestMode:
|
||||
assert result.exit_code == 0
|
||||
args = mock_digest.call_args[0]
|
||||
assert args[1:4] == ("oblachno", "sso-bridge", "0.2.4")
|
||||
|
||||
|
||||
class TestBranchCreation:
|
||||
"""Branch creation uses the branches API (Gitea lacks POST /git/refs)."""
|
||||
|
||||
def _invoke(self) -> object:
|
||||
runner = CliRunner()
|
||||
return runner.invoke(
|
||||
cli,
|
||||
[
|
||||
"--package",
|
||||
"sso_bridge",
|
||||
"--new-version",
|
||||
"0.9.1",
|
||||
"--source-repo",
|
||||
"oblachno/sso-bridge",
|
||||
"--manifest",
|
||||
"deploy/m.json",
|
||||
],
|
||||
)
|
||||
|
||||
def _client(self, mock_client_cls: MagicMock) -> MagicMock:
|
||||
client = mock_client_cls.return_value
|
||||
client.create_pr.return_value = {"number": 1}
|
||||
return client
|
||||
|
||||
@patch("devx.ci.create_dependency_pr.create_vikunja_task", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.update_manifest", return_value=True)
|
||||
@patch("devx.ci.create_dependency_pr.read_manifest_version", return_value="0.9.0")
|
||||
@patch("devx.ci.create_dependency_pr.find_existing_pr", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.GiteaClient")
|
||||
@patch("devx.ci.create_dependency_pr.get_ci_token", return_value="tok")
|
||||
def test_creates_branch_via_branches_api(
|
||||
self,
|
||||
_token: MagicMock,
|
||||
mock_client_cls: MagicMock,
|
||||
_find: MagicMock,
|
||||
_read: MagicMock,
|
||||
_update: MagicMock,
|
||||
_task: MagicMock,
|
||||
) -> None:
|
||||
client = self._client(mock_client_cls)
|
||||
result = self._invoke()
|
||||
assert result.exit_code == 0
|
||||
assert "Created PR" in result.output
|
||||
post = client._request.call_args
|
||||
assert post.args[:2] == ("POST", "/branches")
|
||||
assert post.kwargs["json"] == {
|
||||
"new_branch_name": "deps/sso_bridge-0.9.1",
|
||||
"old_branch_name": "master",
|
||||
}
|
||||
|
||||
@patch("devx.ci.create_dependency_pr.create_vikunja_task", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.update_manifest", return_value=True)
|
||||
@patch("devx.ci.create_dependency_pr.read_manifest_version", return_value="0.9.0")
|
||||
@patch("devx.ci.create_dependency_pr.find_existing_pr", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.GiteaClient")
|
||||
@patch("devx.ci.create_dependency_pr.get_ci_token", return_value="tok")
|
||||
def test_existing_branch_tolerated(
|
||||
self,
|
||||
_token: MagicMock,
|
||||
mock_client_cls: MagicMock,
|
||||
_find: MagicMock,
|
||||
_read: MagicMock,
|
||||
_update: MagicMock,
|
||||
_task: MagicMock,
|
||||
) -> None:
|
||||
from devx.exceptions import APIError
|
||||
|
||||
client = self._client(mock_client_cls)
|
||||
client._request.side_effect = APIError(422, "branch already exists")
|
||||
result = self._invoke()
|
||||
assert result.exit_code == 0
|
||||
assert "already exists" in result.output.lower()
|
||||
|
||||
@patch("devx.ci.create_dependency_pr.create_vikunja_task", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.update_manifest", return_value=True)
|
||||
@patch("devx.ci.create_dependency_pr.read_manifest_version", return_value="0.9.0")
|
||||
@patch("devx.ci.create_dependency_pr.find_existing_pr", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.GiteaClient")
|
||||
@patch("devx.ci.create_dependency_pr.get_ci_token", return_value="tok")
|
||||
def test_branch_api_error_fails(
|
||||
self,
|
||||
_token: MagicMock,
|
||||
mock_client_cls: MagicMock,
|
||||
_find: MagicMock,
|
||||
_read: MagicMock,
|
||||
_update: MagicMock,
|
||||
_task: MagicMock,
|
||||
) -> None:
|
||||
from devx.exceptions import APIError
|
||||
|
||||
client = self._client(mock_client_cls)
|
||||
client._request.side_effect = APIError(500, "boom")
|
||||
result = self._invoke()
|
||||
assert result.exit_code != 0
|
||||
assert "Failed to create branch" in result.output
|
||||
|
||||
@patch("devx.ci.create_dependency_pr.create_vikunja_task", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.update_manifest", return_value=True)
|
||||
@patch("devx.ci.create_dependency_pr.read_manifest_version", return_value="0.9.0")
|
||||
@patch("devx.ci.create_dependency_pr.find_existing_pr", return_value=None)
|
||||
@patch("devx.ci.create_dependency_pr.GiteaClient")
|
||||
@patch("devx.ci.create_dependency_pr.get_ci_token", return_value="tok")
|
||||
def test_checks_out_remote_tracking_branch(
|
||||
self,
|
||||
_token: MagicMock,
|
||||
mock_client_cls: MagicMock,
|
||||
_find: MagicMock,
|
||||
_read: MagicMock,
|
||||
_update: MagicMock,
|
||||
_task: MagicMock,
|
||||
) -> None:
|
||||
import subprocess
|
||||
|
||||
self._client(mock_client_cls)
|
||||
result = self._invoke()
|
||||
assert result.exit_code == 0
|
||||
calls = [c.args[0] for c in subprocess.run.call_args_list]
|
||||
assert ["git", "fetch", "origin", "deps/sso_bridge-0.9.1:refs/remotes/origin/deps/sso_bridge-0.9.1"] in calls
|
||||
assert ["git", "checkout", "-B", "deps/sso_bridge-0.9.1", "origin/deps/sso_bridge-0.9.1"] in calls
|
||||
|
||||
Reference in New Issue
Block a user