forked from Yureien/YABin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
43 lines (39 loc) · 1.13 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
stages:
- build
- release
- deploy
include:
- project: 'infrastructure/ci-scripts'
file: 'build-docker-image.yml'
- project: 'infrastructure/ci-scripts'
file: 'release-docker-image.yml'
- project: 'infrastructure/ci-scripts'
file: 'deploy-kustomize.yml'
build:
extends: .build_image
only:
- main
release:
extends: .release_image
script:
- docker pull "$DOCKER_IMAGE_SOURCE_TAG"
- docker tag "$DOCKER_IMAGE_SOURCE_TAG" "$DOCKER_IMAGE_TARGET_TAG"
- docker push "$DOCKER_IMAGE_TARGET_TAG"
- docker login --username yureien --password "$DOCKERHUB_PASSWORD" docker.io
- docker tag "$DOCKER_IMAGE_SOURCE_TAG" index.docker.io/yureien/yabin:$CI_COMMIT_SHORT_SHA
- docker push index.docker.io/yureien/yabin:$CI_COMMIT_SHORT_SHA
- docker tag index.docker.io/yureien/yabin:$CI_COMMIT_SHORT_SHA index.docker.io/yureien/yabin:latest
- docker push index.docker.io/yureien/yabin:latest
only:
- main
environment:
name: prod
deploy:
extends: .deploy_kustomize
variables:
KUSTOMIZE_OVERLAY: k8s
KUBERNETES_NAMESPACE: default
only:
- main
environment:
name: prod