-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
50 lines (41 loc) · 1.43 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
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
IMAGE_CURRENT: ${CI_REGISTRY_IMAGE}/rqm:$CI_COMMIT_SHORT_SHA
IMAGE_LATEST: ${CI_REGISTRY_IMAGE}/rqm:latest
stages:
- build
- stage
build rqm image:
stage: build
image: docker:stable
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker pull $IMAGE_LATEST || true
- docker build --cache-from $IMAGE_LATEST --tag $IMAGE_CURRENT --tag $IMAGE_LATEST route-quality-maps
- docker push $IMAGE_CURRENT
- docker push $IMAGE_LATEST
deploy rqm:
stage: stage
image:
name: bitnami/git:latest
before_script:
- mkdir -p ~/.bin
- curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s -- ~/.bin
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- git clone [email protected]:openbeta/devops/rqm-argocd.git
- cd rqm-argocd
- ~/.bin/kustomize edit set image $IMAGE_CURRENT
- git config --global user.name $GITLAB_USER_NAME
- git config --global user.email $GITLAB_USER_EMAIL
- git commit -am "Update version to $CI_COMMIT_SHORT_SHA"
- git push