Commit edb363d1 authored by root's avatar root

k8s_deploy

parent cb4f85bd
Pipeline #1387 failed
stages:
- build_dev
- build_test
-
build_dev:
stage: build_dev
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
build_test:
stage: build_test
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- docker login -u "gitlab-ci-token" -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker build -t ${CI_REGISTRY_IMAGE}:${CI_PIPELINE_ID} .
......@@ -20,3 +22,19 @@ build_dev:
- dev
tags:
- buidl1-dind
deploy_to_test:
stage: deploy_to_test
image: docker:stable
script:
- wget https://storage.googleapis.com/kubernetes-release/release/v1.14.3/bin/linux/amd64/kubectl && chmod +x ./kubectl
- sed 's|_VERSION_|'"${CI_PIPELINE_ID}"'|g' Docker/manifests/app.yml.tpl > app.yml; cat app.yml
- wget https://github.com/garethr/kubeval/releases/download/0.7.3/kubeval-linux-amd64.tar.gz && tar xvf kubeval-linux-amd64.tar.gz && ./kubeval app.yml
- ./kubectl apply -f app.yml
environment:
name: ${CI_COMMIT_REF_NAME}
url: http://guru.test
only:
- test
tags:
- buidl1-dind
---
apiVersion: v1
kind: Service
metadata:
name: _PROJECT_
namespace: _NS_
labels:
app: _PROJECT_
spec:
ports:
- name: _PROJECT_
port: 80
targetPort: _PROJECT_
selector:
app: _PROJECT_
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: _PROJECT_
labels:
app: _PROJECT_
namespace: _PROJECT_
spec:
replicas: 1
revisionHistoryLimit: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: _PROJECT_
template:
metadata:
labels:
app: _PROJECT_
spec:
containers:
- name: _PROJECT_
image: _REPO_:_VERSION_
ports:
- name: _PROJECT_
containerPort: 80
imagePullSecrets:
- name: registrypullsecret
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment