-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
65 lines (60 loc) · 1.45 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
stages:
- build
- test
- create_image
- deploy
variables:
MVN_IMAGE: maven:3.9.8-amazoncorretto-17-al2023
SECURE_FILES_DOWNLOAD_PATH: "./"
build:
stage: build
image: $MVN_IMAGE
script:
- echo "Maven compilee started"
- mvn compile
only:
- main
test:
stage: test
image: $MVN_IMAGE
script:
- echo "Testeando código de nuevo"
- mvn test
only:
- main
create_image:
stage: create_image
image: docker:stable
services:
- docker:dind
- name: docker:dind
alias: thedockerhost
variables:
DOCKER_HOST: tcp://thedockerhost:2375/
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
script:
- echo "$JUANKEYS" > juankeys.pem
- chmod 600 juankeys.pem
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t juancruzmarzetti/proyinte:latest .
- docker push juancruzmarzetti/proyinte:latest
- rm juankeys.pem
only:
- main
deploy:
stage: deploy
image: python:3.9
before_script:
- echo "$JUANKEYS" > juankeys.pem
- chmod 600 juankeys.pem
- pip install ansible
- mkdir ~/.ssh
- touch ~/.ssh/config
- curl -s https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer | sh
- echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script:
- ansible-playbook -i hosts.ini playbook.yaml --key-file "juankeys.pem"
- rm juankeys.pem
only:
- main