2020-12-22 17:55:45 +00:00
|
|
|
image: node:14
|
2020-06-09 15:49:41 +00:00
|
|
|
|
|
|
|
stages:
|
2020-12-22 17:55:45 +00:00
|
|
|
- prepare
|
2020-06-09 15:49:41 +00:00
|
|
|
- build
|
2020-06-20 08:02:03 +00:00
|
|
|
- test
|
2020-10-03 20:28:19 +00:00
|
|
|
- packaging
|
2020-08-05 17:55:51 +00:00
|
|
|
- deploy
|
2020-06-09 15:49:41 +00:00
|
|
|
|
|
|
|
cache:
|
2020-12-22 16:41:54 +00:00
|
|
|
key: ${CI_COMMIT_REF_SLUG}
|
2020-06-09 15:49:41 +00:00
|
|
|
paths:
|
2020-12-22 16:41:54 +00:00
|
|
|
- .npm/
|
2020-12-22 17:55:45 +00:00
|
|
|
- node_modules/
|
2020-06-29 19:54:04 +00:00
|
|
|
|
2020-06-29 19:20:14 +00:00
|
|
|
include:
|
2020-08-05 17:55:51 +00:00
|
|
|
- template: Code-Quality.gitlab-ci.yml
|
2020-06-09 15:49:41 +00:00
|
|
|
|
2020-06-29 19:54:04 +00:00
|
|
|
variables:
|
|
|
|
SAST_DISABLE_DIND: "true"
|
|
|
|
|
2020-12-22 17:55:45 +00:00
|
|
|
Node_dependencies:
|
|
|
|
stage: prepare
|
|
|
|
script:
|
|
|
|
- npm ci --cache .npm --prefer-offline
|
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Minimize:
|
2020-06-20 08:02:03 +00:00
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- npm run build
|
|
|
|
artifacts:
|
|
|
|
expire_in: 7 days
|
|
|
|
paths:
|
|
|
|
- build/
|
2020-12-22 17:55:45 +00:00
|
|
|
needs: ["Node_dependencies"]
|
2020-06-20 08:02:03 +00:00
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Frontend_Tests:
|
2020-06-09 15:49:41 +00:00
|
|
|
stage: test
|
|
|
|
script:
|
2020-12-18 18:55:47 +00:00
|
|
|
- npm run test
|
2020-06-09 19:54:52 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
junit:
|
|
|
|
- ./junit.xml
|
2020-12-22 17:55:45 +00:00
|
|
|
needs: ["Node_dependencies"]
|
2020-06-09 15:49:41 +00:00
|
|
|
|
2020-11-12 09:32:46 +00:00
|
|
|
code_quality:
|
|
|
|
tags:
|
|
|
|
- dind
|
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Debian_Server:
|
2020-10-03 20:28:19 +00:00
|
|
|
stage: packaging
|
|
|
|
image: debian
|
|
|
|
script:
|
2020-11-13 22:52:38 +00:00
|
|
|
- vers=$(grep -Po '"version":.*?[^\\]",' package.json | grep -Po '[0-9]+\.[0-9]+\.[0-9]+') # parse the version out of package .json
|
2020-10-03 20:28:19 +00:00
|
|
|
- cd deb
|
|
|
|
- mkdir -p "./OpenMediaCenter/var/www/openmediacenter/videos/"
|
|
|
|
- mkdir -p "./OpenMediaCenter/tmp/"
|
|
|
|
- cp -r ../build/* ./OpenMediaCenter/var/www/openmediacenter/
|
|
|
|
- cp -r ../api ./OpenMediaCenter/var/www/openmediacenter/
|
|
|
|
- cp ../database.sql ./OpenMediaCenter/tmp/openmediacenter.sql
|
2020-11-13 22:52:38 +00:00
|
|
|
- 'echo "Version: ${vers}" >> ./OpenMediaCenter/DEBIAN/control'
|
2020-10-03 20:28:19 +00:00
|
|
|
- chmod -R 0775 *
|
|
|
|
- dpkg-deb --build OpenMediaCenter
|
2020-11-13 22:52:38 +00:00
|
|
|
- mv OpenMediaCenter.deb OpenMediaCenter-${vers}_amd64.deb
|
2020-10-03 20:28:19 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2020-11-13 22:52:38 +00:00
|
|
|
- deb/OpenMediaCenter-*.deb
|
2020-12-18 19:19:32 +00:00
|
|
|
needs: ["Minimize"]
|
2020-10-03 20:28:19 +00:00
|
|
|
|
2020-12-18 18:55:47 +00:00
|
|
|
Test_Server:
|
2020-08-05 17:55:51 +00:00
|
|
|
stage: deploy
|
|
|
|
image: luki42/alpineopenssh:latest
|
|
|
|
needs:
|
2020-12-18 19:19:32 +00:00
|
|
|
- Frontend_Tests
|
|
|
|
- Debian_Server
|
2020-08-05 17:55:51 +00:00
|
|
|
only:
|
|
|
|
- master
|
|
|
|
script:
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
2020-10-22 17:36:29 +00:00
|
|
|
- scp deb/OpenMediaCenter-*.deb root@192.168.0.42:/tmp/
|
2020-10-22 18:06:37 +00:00
|
|
|
- ssh root@192.168.0.42 "DEBIAN_FRONTEND=noninteractive apt-get --reinstall -y -qq install /tmp/OpenMediaCenter-*.deb && rm /tmp/OpenMediaCenter-*.deb"
|
2020-10-27 11:48:26 +00:00
|
|
|
allow_failure: true
|
2020-08-05 17:55:51 +00:00
|
|
|
|