-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
36 lines (33 loc) · 1.16 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
image: docker:19.03.12
stages:
- build
- deploy
docker-build:
image: docker:19.03.12
stage: build
services:
- docker:19.03.12-dind
before_script:
- docker info
- echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
deployment:
stage: deploy
image: node:latest
variables:
PROJECT_ID: kinesis-api-portal
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
- eval $(ssh-agent -s)
- echo "$K8S_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan repo.kinesis.games >> ~/.ssh/known_hosts
- ssh-keyscan k8s.konnect.dev >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- scp deployment.yml [email protected]:/tmp/deployment-${PROJECT_ID}.yml
- ssh [email protected] "kubectl apply -f /tmp/deployment-${PROJECT_ID}.yml && kubectl rollout restart deployment ${PROJECT_ID}-web"