feat: initial commit
This commit is contained in:
commit
649f66fbf1
19 changed files with 512 additions and 0 deletions
37
.gitlab/deployment.yaml
Normal file
37
.gitlab/deployment.yaml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
|
||||
# deploy container on kubernetes
|
||||
deployment:
|
||||
stage: "deployment"
|
||||
image:
|
||||
name: "cr.simoncor.net/siempie/ansible-deployment:latest"
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
rules:
|
||||
|
||||
# run only on push to default branch
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
- when: "never"
|
||||
|
||||
# prepare ssh
|
||||
before_script:
|
||||
|
||||
# prepare ssh
|
||||
- |
|
||||
# prepare ssh
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo "$SSH_CONFIG" > ~/.ssh/config
|
||||
echo "$SSH_DEPLOYMENT_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
# deployment commands
|
||||
script:
|
||||
|
||||
- |
|
||||
# initial kubernetes deployment
|
||||
ssh "$SSH_DEPLOYMENT_USER@mgmt01.infra.vpn.mirahsimon.us" "sudo -u simon \
|
||||
kubectl apply -f /home/simon/Documents/docs-simoncor-net/manifests"
|
||||
|
||||
# rollout deployment
|
||||
ssh "$SSH_DEPLOYMENT_USER@mgmt01.infra.vpn.mirahsimon.us" "sudo -u simon \
|
||||
kubectl rollout restart --namespace=docs-simoncor-net deployment docs-simoncor-net"
|
||||
32
.gitlab/image-build.yaml
Normal file
32
.gitlab/image-build.yaml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
|
||||
variables:
|
||||
DOCKER_DRIVER: "overlay2"
|
||||
DOCKER_HOST: "tcp://localhost:2375/"
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
|
||||
stages:
|
||||
- "build"
|
||||
|
||||
image-build:
|
||||
stage: "image-build"
|
||||
image: "docker:28.1.1"
|
||||
services:
|
||||
- name: "docker:28.1.1-dind"
|
||||
command: ["--tls=false"]
|
||||
script:
|
||||
|
||||
# login to container registry
|
||||
- "echo $CR_PASSWORD | docker login $CR_HOSTNAME -u $CR_USERNAME --password-stdin"
|
||||
|
||||
# build docs-simoncor-net image
|
||||
- "docker build -t docs-simoncor-net ."
|
||||
|
||||
# add tags to image
|
||||
- "docker image tag docs-simoncor-net cr.simoncor.net/siempie/docs-simoncor-net:latest"
|
||||
|
||||
# push image to dockerhub.
|
||||
- "docker push --all-tags cr.simoncor.net/siempie/docs-simoncor-net"
|
||||
|
||||
# logout from container registry
|
||||
- "docker logout $CR_HOSTNAME"
|
||||
12
.gitlab/linting.yaml
Normal file
12
.gitlab/linting.yaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
|
||||
# linting
|
||||
linting:
|
||||
stage: "linting"
|
||||
image:
|
||||
name: "cr.simoncor.net/siempie/ansible-deployment:latest"
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
|
||||
# start linting
|
||||
script:
|
||||
- "yamllint ."
|
||||
Loading…
Add table
Add a link
Reference in a new issue