-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
73 lines (69 loc) · 2.17 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
variables:
AWS_DEFAULT_REGION: ap-northeast-2
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
IMAGE_NAME: $CI_REGISTRY_IMAGE
DEV_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
PROD_IMAGE_TAG: $CI_REGISTRY_IMAGE:prod-latest
stages:
- code_review
- push-image
- deploy
cache:
key: '$CI_COMMIT_REF_NAME'
paths:
- .yarn/cache
code_review:
stage: code_review
image: node:16
script:
- apt-get update -qq && apt-get install -y -qq git
- yarn install --frozen-lockfile --prefer-offline
- yarn add ts-node --dev # ts-node를 설치합니다.
- |
changed_files=$(git diff --name-only --diff-filter=d $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA -- 'src/**/*.ts') # 변경됨
changed_files="${changed_files//$'\n'/ }"
echo "Changed Files: $changed_files"
echo "changed_files=$changed_files" > dotenv.report
- npx ts-node code_review.ts $changed_files # 변경됨: ts-node를 사용하여 실행
- GITLAB_API_TOKEN=$GITLAB_API_TOKEN npx ts-node code_review.ts $changed_files # 변경됨: ts-node를 사용하여 실행
artifacts:
reports:
dotenv: dotenv.report
variables:
OPENAI_API_KEY: $OPENAI_API_KEY
GITLAB_API_TOKEN: $GITLAB_API_TOKEN
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# push-image:
# stage: push-image
# image:
# name: amazon/aws-cli
# entrypoint: ['']
# services:
# - docker:dind
# before_script:
# - amazon-linux-extras install docker
# - aws --version
# - docker --version
# script:
# - |
# if [[ $CI_COMMIT_REF_NAME == "development" ]]; then
# export NODE_ENV=dev
# export IMAGE_TAG=$DEV_IMAGE_TAG
# else
# export NODE_ENV=prod
# export IMAGE_TAG=$PROD_IMAGE_TAG
# fi
# - docker pull $IMAGE_TAG || true
# - docker build
# --cache-from $IMAGE_TAG
# --build-arg NODE_ENV=$NODE_ENV
# --tag $IMAGE_TAG
# --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
# - docker push $IMAGE_TAG
# only:
# - development
# - main