forked from CERT-Polska/ursadb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
41 lines (35 loc) · 1.15 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
image: certpl/docker-ci-base
services:
- docker:dind
stages:
- build
- deploy
before_script:
- echo "Start job $CI_BUILD_NAME" at `date +%Y-%m-%d-%H-%M-%S`
- echo "CI_PIPELINE_ID $CI_PIPELINE_ID"
- docker login -u "$DOCKER_REGISTRY_LOGIN" -p "$DOCKER_REGISTRY_PASSWORD" "$DOCKER_REGISTRY"
build_ursadb:
stage: build
script:
- docker build -t "$DOCKER_REGISTRY/ursadb:$CI_PIPELINE_ID" .
- docker tag "$DOCKER_REGISTRY/ursadb:$CI_PIPELINE_ID" "$DOCKER_REGISTRY/ursadb:latest"
- docker tag "$DOCKER_REGISTRY/ursadb:$CI_PIPELINE_ID" "$DOCKER_REGISTRY/ursadb:build-$CI_COMMIT_SHA"
- docker push "$DOCKER_REGISTRY/ursadb:$CI_PIPELINE_ID"
- docker push "$DOCKER_REGISTRY/ursadb:build-$CI_COMMIT_SHA"
- docker push "$DOCKER_REGISTRY/ursadb:latest"
deploy_ursadb:
stage: deploy
when: manual
only:
- master
environment:
name: prod
script:
- eval $(ssh-agent -s)
- echo "$GIT_DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$VCS_SSH_KEYS" >> ~/.ssh/known_hosts
- git clone "$VCS_DEPLOY_REPO_URL"
- cd "$VCS_DEPLOY_REPO_NAME"
- sh deploy_ursadb.sh