Skip to content
Snippets Groups Projects
Commit 38161208 authored by Marco Lorini's avatar Marco Lorini
Browse files

2021-03-26 ML: CI/CD - add .gitlab-ci file to run pipeline

parent da88de3c
No related branches found
No related tags found
No related merge requests found
stages:
- build
- test
- package
- deploy
build:
stage: build
image: node:12.7-alpine
only:
- master
before_script:
- npm install -g @angular/cli@8.3.26
- npm ci
script:
- ng build
artifacts:
paths:
- dist/
expire_in: 1 hours
cache:
paths:
- node_modules/
tags:
- kubernetes
- register-front
# unit_test:
# stage: test
# image: node:latest
# only:
# - master
# before_script:
# - apt-get update
# - wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
# - apt-get install -y ./google-chrome-stable_current_amd64.deb
# - export CHROME_BIN=/usr/bin/google-chrome
# - npm install -g @angular/cli@8.3.26
# - npm ci
# script:
# - ng test
# tags:
# - kubernetes
# - register-front
# e2e_test:
# stage: test
# image: trion/ng-cli-e2e
# only:
# - master
# allow_failure: false
# before_script:
# - npm ci
# script:
# - ng e2e
# tags:
# - kubernetes
# - register-front
package:
stage: package
image: docker:latest
only:
- master
services:
- docker:dind
before_script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY/$CI_REGISTRY_IMAGE:$CI_REGISTRY_IMAGE_TAG .
- docker push $CI_REGISTRY/$CI_REGISTRY_IMAGE:$CI_REGISTRY_IMAGE_TAG
tags:
- kubernetes
- register-front
deploy:
stage: deploy
image: bitnami/kubectl:latest
only:
- master
before_script:
- echo -n $KUBE_CONFIG | base64 -d > .kube/config
script:
- kubectl --kubeconfig .kube/config --namespace $KUBE_NAMESPACE set image deployment/$KUBE_DEPLOYMENT $KUBE_CONTAINER=$CI_REGISTRY/$CI_REGISTRY_IMAGE:$CI_REGISTRY_IMAGE_TAG
tags:
- kubernetes
- register-front
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