Skip to content
Snippets Groups Projects
Commit ba81f724 authored by Georgi Todorov's avatar Georgi Todorov
Browse files

ci: add-ci-cd-for-all-services

parent 391e1aae
No related branches found
No related tags found
1 merge request!22ci: add-ci-cd-for-all-services
Pipeline #64435 canceled with stages
...@@ -59,7 +59,6 @@ stages: ...@@ -59,7 +59,6 @@ stages:
### Lint microservices ### Lint microservices
## ##
#
lint-agent: lint-agent:
image: node:18 image: node:18
extends: .distributed extends: .distributed
...@@ -77,22 +76,73 @@ lint-agent: ...@@ -77,22 +76,73 @@ lint-agent:
script: script:
- yarn nx run agent:lint --parallel=3 - yarn nx run agent:lint --parallel=3
# lint-engine: lint-attestation-manager:
# image: node:18 image: node:18
# extends: .distributed extends: .distributed
# tags: tags:
# - amd64-docker - amd64-docker
# rules: stage: lint
# - if: '$PIPELINE_TRIGGERED != "yes"' rules:
# changes: - if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# - apps/engine/* changes:
# - apps/engine/deployment/* - apps/attestation-manager/*
# - apps/engine/src/* - apps/attestation-manager/deployment/*
# - apps/engine/src/app/* - apps/attestation-manager/src/*
# - if: '$CI_COMMIT_TAG' - apps/attestation-manager/src/app/*
# stage: lint - if: '$CI_COMMIT_TAG'
# script: script:
# - yarn nx run agent:lint --parallel=3 - yarn nx run attestation-manager:lint --parallel=3
lint-connection-manager:
image: node:18
extends: .distributed
tags:
- amd64-docker
stage: lint
rules:
- if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/connection-manager/*
- apps/connection-manager/deployment/*
- apps/connection-manager/src/*
- apps/connection-manager/src/app/*
- if: '$CI_COMMIT_TAG'
script:
- yarn nx run connection-manager:lint --parallel=3
lint-gateway:
image: node:18
extends: .distributed
tags:
- amd64-docker
stage: lint
rules:
- if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/gateway/*
- apps/gateway/deployment/*
- apps/gateway/src/*
- apps/gateway/src/app/*
- if: '$CI_COMMIT_TAG'
script:
- yarn nx run gateway:lint --parallel=3
lint-proof-manager:
image: node:18
extends: .distributed
tags:
- amd64-docker
stage: lint
rules:
- if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/proof-manager/*
- apps/proof-manager/deployment/*
- apps/proof-manager/src/*
- apps/proof-manager/src/app/*
- if: '$CI_COMMIT_TAG'
script:
- yarn nx run proof-manager:lint --parallel=3
## ##
### Test microservices ### Test microservices
...@@ -115,22 +165,73 @@ test-agent: ...@@ -115,22 +165,73 @@ test-agent:
script: script:
- yarn nx run agent:test --configuration=ci --parallel=3 - yarn nx run agent:test --configuration=ci --parallel=3
# test-engine: test-attestation-manager:
# image: node:18 image: node:18
# extends: .distributed extends: .distributed
# tags: tags:
# - amd64-docker - amd64-docker
# rules: rules:
# - if: '$PIPELINE_TRIGGERED != "yes"' - if: '$PIPELINE_TRIGGERED != "yes"'
# changes: changes:
# - apps/engine/* - apps/attestation-manager/*
# - apps/engine/deployment/* - apps/attestation-manager/deployment/*
# - apps/engine/src/* - apps/attestation-manager/src/*
# - apps/engine/src/app/* - apps/attestation-manager/src/app/*
# - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
# stage: test stage: test
# script: script:
# - yarn nx run agent:test --configuration=ci --parallel=3 - yarn nx run attestation-manager:test --configuration=ci --parallel=3
test-connection-manager:
image: node:18
extends: .distributed
tags:
- amd64-docker
rules:
- if: '$PIPELINE_TRIGGERED != "yes"'
changes:
- apps/connection-manager/*
- apps/connection-manager/deployment/*
- apps/connection-manager/src/*
- apps/connection-manager/src/app/*
- if: '$CI_COMMIT_TAG'
stage: test
script:
- yarn nx run connection-manager:test --configuration=ci --parallel=3
test-gateway:
image: node:18
extends: .distributed
tags:
- amd64-docker
rules:
- if: '$PIPELINE_TRIGGERED != "yes"'
changes:
- apps/gateway/*
- apps/gateway/deployment/*
- apps/gateway/src/*
- apps/gateway/src/app/*
- if: '$CI_COMMIT_TAG'
stage: test
script:
- yarn nx run gateway:test --configuration=ci --parallel=3
test-proof-manager:
image: node:18
extends: .distributed
tags:
- amd64-docker
rules:
- if: '$PIPELINE_TRIGGERED != "yes"'
changes:
- apps/proof-manager/*
- apps/proof-manager/deployment/*
- apps/proof-manager/src/*
- apps/proof-manager/src/app/*
- if: '$CI_COMMIT_TAG'
stage: test
script:
- yarn nx run proof-manager:test --configuration=ci --parallel=3
## ##
### Bare microservice build ### Bare microservice build
...@@ -160,31 +261,111 @@ build-agent: ...@@ -160,31 +261,111 @@ build-agent:
- ./yarn.lock - ./yarn.lock
expire_in: 1 day expire_in: 1 day
# build-engine: build-attestation-manager:
# image: node:18 image: node:18
# extends: .distributed extends: .distributed
# rules: rules:
# - if: '$PIPELINE_TRIGGERED != "yes"' - if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# changes: changes:
# - apps/engine/* - apps/attestation-manager/*
# - apps/engine/deployment/* - apps/attestation-manager/deployment/*
# - apps/engine/src/* - apps/attestation-manager/src/*
# - apps/engine/src/app/* - apps/attestation-manager/src/app/*
# - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
# tags: tags:
# - amd64-docker - amd64-docker
# stage: build stage: build
# script: script:
# # parallel is a CPU core count # parallel is a CPU core count
# - yarn nx run agent:build:production --parallel=3 - yarn nx run attestation-manager:build:production --parallel=3
artifacts:
paths:
- ./dist
- ./package.json
- ./yarn.lock
expire_in: 1 day
build-connection-manager:
image: node:18
extends: .distributed
rules:
- if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/connection-manager/*
- apps/connection-manager/deployment/*
- apps/connection-manager/src/*
- apps/connection-manager/src/app/*
- if: '$CI_COMMIT_TAG'
tags:
- amd64-docker
stage: build
script:
# parallel is a CPU core count
- yarn nx run connection-manager:build:production --parallel=3
artifacts:
paths:
- ./dist
- ./package.json
- ./yarn.lock
expire_in: 1 day
build-gateway:
image: node:18
extends: .distributed
rules:
- if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/gateway/*
- apps/gateway/deployment/*
- apps/gateway/src/*
- apps/gateway/src/app/*
- if: '$CI_COMMIT_TAG'
tags:
- amd64-docker
stage: build
script:
# parallel is a CPU core count
- yarn nx run gateway:build:production --parallel=3
artifacts:
paths:
- ./dist
- ./package.json
- ./yarn.lock
expire_in: 1 day
build-proof-manager:
image: node:18
extends: .distributed
rules:
- if: '$PIPELINE_TRIGGERED != "yes" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/proof-manager/*
- apps/proof-manager/deployment/*
- apps/proof-manager/src/*
- apps/proof-manager/src/app/*
- if: '$CI_COMMIT_TAG'
tags:
- amd64-docker
stage: build
script:
# parallel is a CPU core count
- yarn nx run proof-manager:build:production --parallel=3
artifacts:
paths:
- ./dist
- ./package.json
- ./yarn.lock
expire_in: 1 day
## ##
### Docker build microservices ### Docker build microservices
## ##
docker-build-agent: docker-agent:
extends: .docker-build-agent extends: .docker-build
stage: docker stage: docker
variables:
APP: agent
rules: rules:
- if: '$PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"' - if: '$PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes: changes:
...@@ -194,25 +375,71 @@ docker-build-agent: ...@@ -194,25 +375,71 @@ docker-build-agent:
- apps/agent/src/app/* - apps/agent/src/app/*
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
# docker-build-engine: docker-attestation-manager:
# extends: .docker-build-engine extends: .docker-build
# stage: docker stage: docker
# rules: variables:
# - if: '$PIPELINE_TRIGGERED == "no"' APP: attestation-manager
# changes: rules:
# - apps/engine/* - if: '$PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# - apps/engine/deployment/* changes:
# - apps/engine/src/* - apps/attestation-manager/*
# - apps/engine/src/app/* - apps/attestation-manager/deployment/*
# - if: '$CI_COMMIT_TAG' - apps/attestation-manager/src/*
- apps/attestation-manager/src/app/*
- if: '$CI_COMMIT_TAG'
docker-connection-manager:
extends: .docker-build
stage: docker
variables:
APP: connection-manager
rules:
- if: '$PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/connection-manager/*
- apps/connection-manager/deployment/*
- apps/connection-manager/src/*
- apps/connection-manager/src/app/*
- if: '$CI_COMMIT_TAG'
docker-gateway:
extends: .docker-build
stage: docker
variables:
APP: gateway
rules:
- if: '$PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/gateway/*
- apps/gateway/deployment/*
- apps/gateway/src/*
- apps/gateway/src/app/*
- if: '$CI_COMMIT_TAG'
docker-proof-manager:
extends: .docker-build
stage: docker
variables:
APP: proof-manager
rules:
- if: '$PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/proof-manager/*
- apps/proof-manager/deployment/*
- apps/proof-manager/src/*
- apps/proof-manager/src/app/*
- if: '$CI_COMMIT_TAG'
## ##
### Push to registries ### Push to registries
## ##
google-image-agent: google-image-agent:
extends: .agent-cloud extends: .cloud
stage: registries stage: registries
variables:
APP: agent
rules: rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"' - if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes: changes:
...@@ -221,18 +448,62 @@ google-image-agent: ...@@ -221,18 +448,62 @@ google-image-agent:
- apps/agent/src/* - apps/agent/src/*
- apps/agent/src/app/* - apps/agent/src/app/*
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
google-image-attestation-manager:
extends: .cloud
stage: registries
variables:
APP: attestation-manager
rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/attestation-manager/*
- apps/attestation-manager/deployment/*
- apps/attestation-manager/src/*
- apps/attestation-manager/src/app/*
- if: '$CI_COMMIT_TAG'
# google-image-engine: google-image-connection-manager:
# extends: .engine-cloud extends: .cloud
# stage: registries stage: registries
# rules: variables:
# - if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no"' APP: connection-manager
# changes: rules:
# - apps/engine/* - if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# - apps/engine/deployment/* changes:
# - apps/engine/src/* - apps/connection-manager/*
# - apps/engine/src/app/* - apps/connection-manager/deployment/*
# - if: '$CI_COMMIT_TAG' - apps/connection-manager/src/*
- apps/connection-manager/src/app/*
- if: '$CI_COMMIT_TAG'
google-image-gateway:
extends: .cloud
stage: registries
variables:
APP: gateway
rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/gateway/*
- apps/gateway/deployment/*
- apps/gateway/src/*
- apps/gateway/src/app/*
- if: '$CI_COMMIT_TAG'
google-image-proof-manager:
extends: .cloud
stage: registries
variables:
APP: proof-manager
rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/proof-manager/*
- apps/proof-manager/deployment/*
- apps/proof-manager/src/*
- apps/proof-manager/src/app/*
- if: '$CI_COMMIT_TAG'
## ##
### Configure helm ### Configure helm
...@@ -250,17 +521,53 @@ agent: ...@@ -250,17 +521,53 @@ agent:
- apps/agent/src/app/* - apps/agent/src/app/*
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
# engine: attestation-manager:
# extends: .chart-trigger-engine extends: .chart-trigger-attestation-manager
# stage: helm stage: helm
# rules: rules:
# - if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no"' - if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# changes: changes:
# - apps/engine/* - apps/attestation-manager/*
# - apps/engine/deployment/* - apps/attestation-manager/deployment/*
# - apps/engine/src/* - apps/attestation-manager/src/*
# - apps/engine/src/app/* - apps/attestation-manager/src/app/*
# - if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
connection-manager:
extends: .chart-trigger-connection-manager
stage: helm
rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/connection-manager/*
- apps/connection-manager/deployment/*
- apps/connection-manager/src/*
- apps/connection-manager/src/app/*
- if: '$CI_COMMIT_TAG'
gateway:
extends: .chart-trigger-gateway
stage: helm
rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/gateway/*
- apps/gateway/deployment/*
- apps/gateway/src/*
- apps/gateway/src/app/*
- if: '$CI_COMMIT_TAG'
proof-manager:
extends: .chart-trigger-proof-manager
stage: helm
rules:
- if: '$CI_COMMIT_TAG == null && $PIPELINE_TRIGGERED == "no" && $CI_PIPELINE_SOURCE != "merge_request_event"'
changes:
- apps/proof-manager/*
- apps/proof-manager/deployment/*
- apps/proof-manager/src/*
- apps/proof-manager/src/app/*
- if: '$CI_COMMIT_TAG'
## ##
### Deploy automatically on Test Environment ### Deploy automatically on Test Environment
...@@ -280,19 +587,61 @@ agent-test ocm-two: ...@@ -280,19 +587,61 @@ agent-test ocm-two:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "agent" && $CI_PIPELINE_SOURCE != "merge_request_event"' - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "agent" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual when: manual
# engine-test ocm: attestation-manager-test ocm:
# stage: deploy-test stage: deploy-test
# extends: .test-engine-ocm-one extends: .test-attestation-manager-ocm-one
# rules: rules:
# - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "engine"' - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "attestation-manager" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# when: manual when: manual
# engine-test ocm-two: attestation-manager-test ocm-two:
# stage: deploy-test stage: deploy-test
# extends: .test-engine-ocm-two extends: .test-attestation-manager-ocm-two
# rules: rules:
# - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "engine"' - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "attestation-manager" && $CI_PIPELINE_SOURCE != "merge_request_event"'
# when: manual when: manual
connection-manager-test ocm:
stage: deploy-test
extends: .test-connection-manager-ocm-one
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "connection-manager" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual
connection-manager-test ocm-two:
stage: deploy-test
extends: .test-connection-manager-ocm-two
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "connection-manager" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual
gateway-test ocm:
stage: deploy-test
extends: .test-gateway-ocm-one
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "gateway" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual
gateway-test ocm-two:
stage: deploy-test
extends: .test-gateway-ocm-two
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "gateway" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual
proof-manager-test ocm:
stage: deploy-test
extends: .test-proof-manager-ocm-one
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "proof-manager" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual
proof-manager-test ocm-two:
stage: deploy-test
extends: .test-proof-manager-ocm-two
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "proof-manager" && $CI_PIPELINE_SOURCE != "merge_request_event"'
when: manual
## ##
### Deploy on prod ### Deploy on prod
...@@ -312,20 +661,61 @@ agent-prod ocm-two: ...@@ -312,20 +661,61 @@ agent-prod ocm-two:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "agent" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS' - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "agent" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual when: manual
# engine-prod ocm: attestation-manager-prod ocm:
# stage: deploy-prod stage: deploy-prod
# extends: .prod-engine-ocm-one extends: .prod-attestation-manager-ocm-one
# rules: rules:
# - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "engine"' - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "attestation-manager" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
# when: manual when: manual
# engine-prod ocm-two: attestation-manager-prod ocm-two:
# stage: deploy-prod stage: deploy-prod
# extends: .prod-engine-ocm-two extends: .prod-attestation-manager-ocm-two
# rules: rules:
# - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "engine"' - if: '$PIPELINE_TRIGGERED == "yes" && $APP == "attestation-manager" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
# when: manual when: manual
connection-manager-prod ocm:
stage: deploy-prod
extends: .prod-connection-manager-ocm-one
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "connection-manager" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual
connection-manager-prod ocm-two:
stage: deploy-prod
extends: .prod-connection-manager-ocm-two
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "connection-manager" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual
gateway-prod ocm:
stage: deploy-prod
extends: .prod-gateway-ocm-one
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "gateway" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual
gateway-prod ocm-two:
stage: deploy-prod
extends: .prod-gateway-ocm-two
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "gateway" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual
proof-manager-prod ocm:
stage: deploy-prod
extends: .prod-proof-manager-ocm-one
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "proof-manager" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual
proof-manager-prod ocm-two:
stage: deploy-prod
extends: .prod-proof-manager-ocm-two
rules:
- if: '$PIPELINE_TRIGGERED == "yes" && $APP == "proof-manager" && $CI_PIPELINE_SOURCE != "merge_request_event" && $MAIN_PROD == "yes" && $GITLAB_USER_LOGIN =~ $AUTORIZED_USERS'
when: manual
## ##
### Deploy manual on Stage Environment ### Deploy manual on Stage Environment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment