forked from techno-tim/techno-tim.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
73 lines (67 loc) · 1.89 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
stages:
- test
- docker
- deploy
- flushcache
variables:
KUBECONFIG: .kube/config
JEKYLL_ENV: production
GIT_STRATEGY: clone
GIT_DEPTH: 0
cache: &global_cache
key: $CI_PROJECT_NAME
paths:
- vendor/ruby
policy: pull-push
build:
image: ruby:3.2.2
stage: test
artifacts:
paths:
- _site
expire_in: 1 week
cache:
<<: *global_cache
retry: 2
script:
- gem install bundler
- bundle config set --local path 'vendor/ruby'
- bundle install
- JEKYLL_ENV=production bundle exec jekyll b
docker_image_build_release:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
cache: []
stage: docker
retry: 2
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
deploy:
image:
name: bitnami/kubectl@sha256:6410882b254fde82200c364b606b0cbb9b0fb802fede69011a33b9d28066b459 #1.25.9
entrypoint: [""]
cache: []
stage: deploy
retry: 2
before_script:
- sed -ie "s/deploy-date-value/$(date)/g" kubernetes/deployment.yaml
- sed -ie "s|registry-value|$CI_REGISTRY_IMAGE|g" kubernetes/deployment.yaml
- mkdir -p .kube/ && touch .kube/config
- echo ${KUBERNETES_EXTERNAL_CLUSTER} | base64 -d -i > ${KUBECONFIG}
script:
- kubectl apply -f kubernetes
flushcache:
image: alpine/curl
cache: []
artifacts: {}
stage: flushcache
retry: 2
script:
- sleep 60
- |
curl --fail --output "/dev/null" --silent --show-error -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
--data '{"purge_everything":true}'