Add dependency update documentation

Add vendorind and dependency update documentation with
vendoring process of ARO-RP.

Signed-off-by: Petr Kotas <pkotas@redhat.com>
This commit is contained in:
Petr Kotas 2021-03-10 16:05:48 +01:00
Родитель 32f40244fd
Коммит 48dd5d4217
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9A2182A6A306C71D
1 изменённых файлов: 62 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,62 @@
# Updating dependencies
To update golang dependencies one has to choose between two options:
1) update the whole dependency tree
2) update or add what is currently required
## Update the whole dependency tree
Done when the need to catch upstream dependencies arises, it can be done by
calling
```bash
make vendor
```
in root folder, which calls `hack/update-go-module-dependencies.sh`.
The reason for calling script instead of directly calling:
```bash
go get -u ./...
go mod tidy
go mod vendor
```
is that packages modified in this script do not fully support modules and
semantic versioning via tags. Therefore the proper version is parsed from the version
branch and fixed using replace directive. Otherwise it will upgrade every time
the command is started.
When upgrading to a never version of OpenShift, this script have to be updated to
reflect the proper release.
## Update only required dependencies
When adding new dependencies or updating old ones, based on the requirement of
the PR, one can simply call
```bash
go get <module>@<release> OR
go get -u <module>@<release>
go mod tidy
go mod vendor
```
---
**NOTE** vendoring is required as ARO mirrors all dependencies locally for the CI reliability
and reproducibility.
**NOTE** that when running `go mod vendor` only modules that are used in the
source code will be vendored in.
**NOTE** when updating a package modified in `hack/update-go-module-dependencies.sh`
changes have to be made there also. Otherwise next run of `make vendor` will
overwrite new changes.
More information on working with modules: https://blog.golang.org/using-go-modules