mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
docs: add remaining docs back with some additions/improvements
This commit is contained in:
parent
f147295418
commit
0bd75fd1bb
12 changed files with 538 additions and 1 deletions
73
docs/usage.md
Normal file
73
docs/usage.md
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# Usage
|
||||
|
||||
## Usage (with flake-parts)
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
...
|
||||
inputs.nix-gitlab-ci.url = "gitlab:TECHNOFAB/nix-gitlab-ci/<version>?dir=lib"; # recommendation: pin to the latest release/version
|
||||
|
||||
outputs = {...}: flake-parts.lib.mkFlake {...} {
|
||||
imports = [
|
||||
inputs.nix-gitlab-ci.flakeModule
|
||||
];
|
||||
...
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
ci = {
|
||||
config = {
|
||||
# configure Nix-GitLab-CI here, see docs for options
|
||||
};
|
||||
pipelines."default" = {
|
||||
stages = ["test"];
|
||||
jobs = {
|
||||
"test" = {
|
||||
stage = "test";
|
||||
nix.deps = [pkgs.unixtools.ping];
|
||||
script = [
|
||||
"ping -c 5 8.8.8.8"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
# runs on a merge request for example
|
||||
pipelines."merge_request_event" = {
|
||||
stages = ["some_stage"];
|
||||
jobs = { ... };
|
||||
};
|
||||
};
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now either use this in your .gitlab-ci.yml or setup Soonix to auto generate this
|
||||
file for you with the right version (see the [docs][docs-soonix] for more).
|
||||
|
||||
```yaml
|
||||
# .gitlab-ci.yml
|
||||
include:
|
||||
- component: gitlab.com/TECHNOFAB/nix-gitlab-ci/nix-gitlab-ci@<version> # recommendation: pin to the latest release/version (don't use "main" etc.)
|
||||
inputs:
|
||||
version: <version> # docker image tag, use the same version as a above
|
||||
```
|
||||
|
||||
## Usage (directly)
|
||||
|
||||
```nix
|
||||
let
|
||||
cilib = inputs.nix-gitlab-ci.lib {inherit pkgs;};
|
||||
in
|
||||
cilib.mkCI {
|
||||
config = ...;
|
||||
pipelines."default" = ...;
|
||||
};
|
||||
# exposes `soonix` for the soonix hook and `packages` which contain the configs, jobs etc.
|
||||
```
|
||||
|
||||
______________________________________________________________________
|
||||
|
||||
Since V2 multiple pipelines are supported.
|
||||
See [Multiple Pipelines](./multi_pipeline.md) for more.
|
||||
Loading…
Add table
Add a link
Reference in a new issue