Skip to content
Snippets Groups Projects
Verified Commit 2f94a87b authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Add kubernetes CI/CD

parent 99aaf237
No related branches found
No related tags found
No related merge requests found
Pipeline #20977 passed
image: kroniak/ssh-client
# image: kroniak/ssh-client
stages:
- build
- deploy
home:
variables:
CI_REGISTRY_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAME}
KUBECONFIG_VAR_NAME: KUBECONFIG
# home:
# stage: deploy
# before_script:
# - eval $(ssh-agent -s)
# - echo "$SSH" | tr -d '\r' | ssh-add -
# - mkdir -p ~/.ssh/socket
# - chmod 700 ~/.ssh
# - cp .magic_ssh_config ~/.ssh/config
# script:
# # AFS magic incoming
# - ssh mikewashere@centaur.sch.bme.hu cp /afs/sch.bme.hu/home/mikewashere/.system/mikewashere.keytab /tmp/mikewashere.keytab
# - ssh mikewashere@centaur.sch.bme.hu kinit -k -t /tmp/mikewashere.keytab mikewashere
# - ssh mikewashere@centaur.sch.bme.hu rm /tmp/mikewashere.keytab
# - ssh mikewashere@centaur.sch.bme.hu aklog sch.bme.hu -k SCH.BME.HU
# - ssh mikewashere@centaur.sch.bme.hu mkdir -p /home/mikewashere/public_html/linux
# # actual work
# - scp -r $PWD/* mikewashere@centaur.sch.bme.hu:/home/mikewashere/public_html/linux/
# - ssh mikewashere@centaur.sch.bme.hu env sh -c 'echo lolwut; cd public_html/linux; bash cirun.sh'
# only:
# refs:
# - master
container:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
script:
- |
/kaniko/executor --context ${CI_PROJECT_DIR} \
--dockerfile ${CI_PROJECT_DIR}/Dockerfile \
--destination ${CI_REGISTRY_IMAGE}:latest
only:
- master
except:
- tags
kubernetes:
stage: deploy
image:
name: harbor.sch.bme.hu/kszk/kube-tools:latest
entrypoint: [""]
before_script:
- eval $(ssh-agent -s)
- echo "$SSH" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh/socket
- chmod 700 ~/.ssh
- cp .magic_ssh_config ~/.ssh/config
- chmod 600 ${!KUBECONFIG_VAR_NAME}
- export KUBECONFIG=${!KUBECONFIG_VAR_NAME}
script:
# AFS magic incoming
- ssh mikewashere@centaur.sch.bme.hu cp /afs/sch.bme.hu/home/mikewashere/.system/mikewashere.keytab /tmp/mikewashere.keytab
- ssh mikewashere@centaur.sch.bme.hu kinit -k -t /tmp/mikewashere.keytab mikewashere
- ssh mikewashere@centaur.sch.bme.hu rm /tmp/mikewashere.keytab
- ssh mikewashere@centaur.sch.bme.hu aklog sch.bme.hu -k SCH.BME.HU
- ssh mikewashere@centaur.sch.bme.hu mkdir -p /home/mikewashere/public_html/linux
# actual work
- scp -r $PWD/* mikewashere@centaur.sch.bme.hu:/home/mikewashere/public_html/linux/
- ssh mikewashere@centaur.sch.bme.hu env sh -c 'echo lolwut; cd public_html/linux; bash cirun.sh'
- kubectl rollout restart deployment linux-presentation
only:
refs:
- master
except:
- tags
FROM nginx:1.21.6
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY . /usr/share/nginx/html
server {
listen 80;
listen [::]:80;
server_name localhost;
root /usr/share/nginx/html;
location / {
index index.html index.htm;
# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache';
if_modified_since off;
expires off;
etag off;
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment