# adnv CLI
## Installation
### From crates.io
```shell
$ cargo install adnv
```
### With Nix
```shell
$ nix profile install gitlab:adnap/tools/adnv # install
$ nix run gitlab:adnap/tools/adnv -- outdated # run once, install nothing
```
### As a container
Two images are published per release. The distroless one is the smaller of the
two; the `dslim-` one carries a shell, which GitLab CI requires of a job image:
```yaml
adnv:outdated:
image: registry.gitlab.com/adnap/tools/adnv:dslim-v1.5.1
script:
- adnv outdated
```
```shell
$ podman run --rm -v "$PWD:/work" -w /work \
registry.gitlab.com/adnap/tools/adnv:v1.5.1 adnv outdated
```
### From source
```shell
$ cargo install --git https://gitlab.com/adnap/tools/adnv.git --tag v1.5.1 # release
$ cargo install --git https://gitlab.com/adnap/tools/adnv.git --branch develop
```
## Development
```shell
$ nix develop
```
Gives the toolchain `rust-toolchain.toml` pins — the one CI uses — plus
`cargo-llvm-cov`, `convco` and `glab`. Without Nix, install that toolchain and
the `cmake`, `perl` and `pkg-config` that `aws-lc-sys` and `libgit2` need.
## Usage
### Config file
Default config file is "adnv.yml" in current path.\
The default config file can be overwritten with`ADNV_CONFIG_FILE`environment variable. It can be the path to the config file, or the path to a directory that contains a config file named "adnv.yml".\
All can be overwritten calling CLI with config : `adnv [-c/--config <CONFIG_FILE>] <COMMAND>`.
### [Run](./src/run/README.md)
### [Check](./src/check/README.md)
### [Outdated](./src/sources/outdated/README.md)
### [Update](./src/sources/update/README.md)
### Inline Hints (Common to `update` & `outdated`)
In terraform files, inner dependencies in terraform modules can also be tracked using `Inline hints`. \
A `Inline Hint` is a templated comment : \
`# @adnv source "<FORMATED_URL>" "<VERSION_CONSTRAINT>"`
where ``FORMATED_URL`` can either be :
- a helm repository : ``helm+<REPOSITORY_URL>#name=<NAME>``
- a gitlab repository : ``terraform://<REPOSITORY_URL>``
``VERSION_CONSTRAINT`` must respect semver (if helm) ou terraform versioning format (if terraform).
Outdated and Update commands will consider the Inline Hint line as instruction to process the first next line.
<i>Example</i>
```sh
module "mattermost" {
source = "gitlab.com/vigigloo/tools-k8s/mattermost"
version = "0.1.0"
chart_name = "nginx-ingress"
# @adnv source "helm+https://helm.nginx.com/stable#name=nginx-ingress" "> 0.10.0 , < 0.18.0"
chart_version = "0.16.0"
image_repository = "mattermost/mattermost-team-edition"
# @adnv source "terraform://gitlab.com/vigigloo/tf-modules/k8slimitednamespace" "2.0.0"
image_tag = "1.0.0"
}
```