Metadata-Version: 2.4
Name: gazix
Version: 2.0.0
Summary: Programs to manipulate the GitLab-CI API for the project alya
Project-URL: Homepage, https://alya.gitlab.bsc.es/alya/ci-cd/gazix
Project-URL: Bug Tracker, https://alya.gitlab.bsc.es/alya/ci-cd/gazix/issues
Author-email: Damien Dosimont <damien.dosimont@gmail.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# gazix

## Trigger A Trusted Taskmaster Order

Use `--input key:value` for declared pipeline inputs. It cannot be mixed with
`--var`; the legacy variable mode remains available for Alya/Alamak-to-Squidient
triggers. `--token-trigger-env` and `--token-wait-env` resolve separate trigger
and read credentials without placing their values in process arguments.
`trigger --wait` returns 0 only for pipeline success, 1 for a failed/cancelled/
skipped/manual pipeline and 2 when the result cannot be confirmed. A successful
asynchronous trigger means creation only, not completion of the requested order.

## Published Package Checks

The PyPI and TestPyPI installation jobs retry installing the exact uploaded
version instead of assuming it is available after a fixed sleep. Only the
selected index is used, with isolated pip configuration, no cache, no dependency
installation and a forced wheel reinstall. Attempts are limited to 20 with
15-second delays, a 60-second subprocess timeout and a five-minute total budget.
If the release remains unavailable, the job fails with its version and index.
Raw pip output is suppressed to avoid exposing environment-specific details.
Uploads are never retried by this helper; publication failures still block the
test stage. Existing master/MR job selection and publication approvals remain
unchanged.

## Bounded Waiting

`trigger` and `trigger-squidient` limit `--wait` to one week by default.
Use `--wait-timeout SECONDS` to choose 1 second to 7 days. The deadline also
applies to read retries and `--unstable` mode; expiration returns 2 without
cancelling or retriggering the remote pipeline. Retry counts remain 3 (normal)
and 5 (unstable). Mutating POST requests are never retried automatically.

HTTP requests use a 30-second budget; artifact downloads use 10 minutes and
1 GiB including redirects. Budgets use a monotonic clock, are checked between
stream reads, and shorten connection timeouts. These are cooperative budgets:
they do not forcibly interrupt in-flight I/O. Socket timeouts are at most
30 seconds, but are not an absolute deadline for a slowly trickling response.
Failed downloads preserve the previous destination and remove partial files.
The now-unused shell-command helper has been removed rather than retaining
unbounded subprocess waiting behind an obsolete API.

## Coverage Artifacts

`trigger-squidient --cobertura --wait` reads the artifact ZIP in a private
temporary directory and publishes only regular `reports/xml/**/*.xml` files.
It never invokes a shell or extracts other report content into the workspace.
Absolute/traversing paths, links, special files, duplicate paths and linked
workspace destinations are refused. Limits are 100,000 members per archive,
512 MiB for the nested compressed report, 4 GiB after decompression and 256 MiB
of coverage XML. Validation failures leave existing workspace files unchanged.

## Merge Request Authorization

Gazix 2.0 removes the obsolete procedural Python API. Mutation command
constructors only parse arguments; invoke `run()` to execute them.
`kill` now requires `--MR` in addition to `--pipeline`. Both `kill` and
`kill-old` verify project identity, MR membership, pipeline source and ref.
Only MR pipelines on the MR source branch or its canonical head/merge ref are
eligible; default, master/main, trigger, schedule and child pipelines are refused.
`kill-old` validates all candidates before cancelling any, and preserves current
and newer pipelines. `draft --pipeline` validates the target before changing the
title and cancelling it. Comments may arrive after an MR has closed or merged.

Use `--token-env VARIABLE_NAME` to avoid placing API tokens in command arguments.
Only trusted callers should receive credentials capable of these operations.

Gazix is a python framework that facilitates the interaction with the GitLab API.

## Comment on a merge request

```sh
gazix comment --gitlab "$CI_API_V4_URL" \
  --project 20 --MR 483 \
  --token-env SQUIDIENT_WRITE_API_TOKEN --message-env MR_COMMENT
```

Set the credential and Markdown body in the named environment variables in the
trusted calling pipeline. The API URL defaults to GitLab's predefined
`CI_API_V4_URL` when `--gitlab` is omitted; outside CI, pass an explicit HTTPS API
URL with `--gitlab`. Alternatively, `--token` and `--message` accept direct values,
but environment variables avoid exposing their contents in process arguments.
The body is sent as JSON, preserving multiline Markdown, Unicode and
shell metacharacters without executing them.

The command requires positive numeric project and merge-request identifiers and
an HTTPS API URL ending in `/api/v4`. It refuses redirects, does not use proxies
from the environment, and returns a nonzero status on API or transport errors.
Neither the token nor the comment body is printed, including on failures. A
failed POST is not retried automatically because it may already have created
the note before the connection was interrupted.

Authorization of target projects and selection of a trusted API URL remain the
calling service's responsibility. Taskmaster provides that policy for CI callers.
