refactor: update ci OP#256
DEPENDENCIES
THe funcctional which is implemented in this MR dependes on that
https://code.vereign.com/gaiax/helpers/mono-helpers/-/merge_requests/6
So, if all is ok, then https://code.vereign.com/gaiax/helpers/mono-helpers/-/merge_requests/6 should be merged first and then you need to modify gitlab-ci.yml:
- remove
ref: 256-refactor-docker
- or change
256-refactor-docker
tomain
This MR uses commits from this MR !76 (closed) . So, !76 (closed) can be just closed
Description
In order to reduce size and speed up build I did several changes:
- Move build and lint into Docker
- As soon as docker caches layers, the speed of execution increased (for example in cases where you need to install yarn dependencies)
- Removed stages: lint, test, build and combined build for agent, hin-agent, dashboard all in one. In general now it works faster
This MR changes gitlab CI:
- When you commit something, it will execute
commit-lint
job and will use(project_root)/deployment/ci-cd/lint.Dockerfile
. This docker file contains only linting - When you commit something into apps folder (dashboard, agent, hin-agent) it executes appropriate flow (only agent, only hin-agent, or only dashboard): e.g.
build-all
->docker-dashboard
-> ... - build-all now contains executors: linter, tests and builders. It uses
(project_root)/deployment/ci-cd/build.Dockerfile
and produces artifacts for all applications. This artifacts can be used in next stage to create production docker images -
docker-agent
,docker-hin-agent
,docker-dashboard
uses light docker image nad copy build artifacts from previous step. Also, they install only required dependencies (nx generatePackageJson mechanism). How it works: artifact from build stage contains yarn.lock file for every application (but this artifact does not contain node_modules folder). So, for example in case preparing production docker image for dashboard - it uses very light nginx image, and installs only frontent node_modules (so, it does not contains backend dependencies)
Related issues
https://plan.vereign.com/projects/vbd/work_packages/256
Testing
No changes in the functional. All changes related to deployments. So, issuer, holder, hin-agent environments should be deployable using this branch and be functional
Checklist
-
I have updated the documentation (if necessary) -
I have added unit tests for new functionality (if applicable) -
My code follows the style guidelines of this project -
I have tested this code on my local machine before submitting this MR
Reviewers
Edited by Alexey Lunin