-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
67 lines (63 loc) · 2.64 KB
/
.travis.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
language: node_js
node_js:
- 12.13.0
env:
global:
- KUBECONFIG="/etc/deploy/config"
- CI_DOCKER_IMAGE="strooped/strooped-master:${TRAVIS_COMMIT}"
- KUBE_NAMESPACE="strooped"
- CI_PROJECT_NAME="strooped-master"
- CI_KUBE_FILE="strooped-master.yml"
- STROOPED_API_HOST="https://strooped-api.lokalvert.tech"
before_install:
- openssl aes-256-cbc -K $encrypted_b2c29de587db_key -iv $encrypted_b2c29de587db_iv -in deploy_key.enc -out deploy_key -d
- eval "$(ssh-agent -s)"
- chmod 600 deploy_key
- ssh-add deploy_key
- ssh-keyscan lokalvert.tech >> ~/.ssh/known_hosts
jobs:
include:
- stage: Quality
name: ESLint
script: npm run lint:js
- script: npm run lint:styles
- stage: Test
name: Unit-test
script: npm run test:coverage
# Our cluster runs on raspberry PIs
- stage: build docker image
language: bash
os: linux
arch: arm64
script:
- echo "$DOCKER_SECRET" | docker login -u "$DOCKER_USER" --password-stdin
- docker build --build-arg STROOPED_API_HOST=$STROOPED_API_HOST -t $CI_DOCKER_IMAGE .
- docker images
- docker push $CI_DOCKER_IMAGE
if: branch = master AND type = push AND fork = false
- stage: Deploy production
language: bash
script:
- sed -e "s/{{ CI_COMMIT_SHORT_SHA }}/${TRAVIS_COMMIT}/g" -e "s/{{ CI_PROJECT_NAME }}/${CI_PROJECT_NAME}/g" -e "s/{{ KUBE_NAMESPACE }}/${KUBE_NAMESPACE}/g" kubernetes/deployment.yml > bundle/$CI_KUBE_FILE
- rsync -r --quiet $TRAVIS_BUILD_DIR/bundle/$CI_KUBE_FILE strooped-ci@lokalvert.tech:~/$CI_KUBE_FILE
- ssh strooped-ci@lokalvert.tech "KUBECONFIG=/home/strooped-ci/.kube/config kubectl apply -f ~/$CI_KUBE_FILE"
- ssh strooped-ci@lokalvert.tech KUBECONFIG=/home/strooped-ci/.kube/config kubectl rollout status -w "deployment/${CI_PROJECT_NAME}" --namespace=${KUBE_NAMESPACE}
if: branch = master AND type = push AND fork = false
cache:
directories:
- bundle/
#
#deploy:
# - provider: script
# script: rsync -r --quiet $TRAVIS_BUILD_DIR/bundle/production.yml strooped-ci@lokalvert.tech:~/production.yml
# on:
# branch: "feat/deploy-to-production"
# - provider: script
# script: ssh strooped-ci@lokalvert.tech "KUBECONFIG=/home/strooped-ci/.kube/config kubectl apply -f ~/production.yml"
# on:
# branch: "feat/deploy-to-production"
# - provider: script
# # Here is the command not escaped in quotations to allow the env-variables to be passed down
# script: ssh strooped-ci@lokalvert.tech KUBECONFIG=/home/strooped-ci/.kube/config kubectl rollout status -w "deployment/${CI_PROJECT_NAME}-app" --namespace=${KUBE_NAMESPACE}
# on:
# branch: "feat/deploy-to-production"