This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
91 lines (83 loc) · 2.3 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# .gitlab-ci.yml
image: docker:latest
stages:
- build
- deploy
- notifications
variables:
REGISTRY: "docker.io"
REGISTRY_USER: "robpco"
RELEASE_IMAGE: "nginx-uwsgi"
REGISTRY_IMAGE: "${REGISTRY}/${REGISTRY_USER}/${RELEASE_IMAGE}"
DOCKER_DRIVER: overlay2
build27:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD"
- docker build --pull --tag "${REGISTRY_IMAGE}:2.7" --tag "${REGISTRY_IMAGE}:py2.7" --tag "${REGISTRY_IMAGE}:python2.7" ./python2.7/
- docker push "${REGISTRY_IMAGE}:2.7"
- docker push "${REGISTRY_IMAGE}:py2.7"
- docker push "${REGISTRY_IMAGE}:python2.7"
only:
variables:
- $CI_COMMIT_TAG =~ /^deploy+/
retry: 2
tags:
- docker
build36:
stage: build
image: docker:latest
services:
- docker:dind
script:
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD"
- docker build --pull --tag "${REGISTRY_IMAGE}:3.6" --tag "${REGISTRY_IMAGE}:py3.6" --tag "${REGISTRY_IMAGE}:python3.6" ./python3.6/
- docker push "${REGISTRY_IMAGE}:3.6"
- docker push "${REGISTRY_IMAGE}:py3.6"
- docker push "${REGISTRY_IMAGE}:python3.6"
only:
variables:
- $CI_COMMIT_TAG =~ /^deploy+/
retry: 2
tags:
- docker
trigger_build:
stage: deploy
image:
name: robpco/awscli
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
script:
- 'curl -X POST -F token="$TRIGGER_TOKEN" -F ref="master" -F "variables[CI_COMMIT_TAG]=deploy99" https://gitlab.com/api/v4/projects/7004817/trigger/pipeline'
allow_failure: true
only:
variables:
- $CI_COMMIT_TAG =~ /^deploy+/
tags:
- docker
notify_succcess_slack:
stage: notifications
allow_failure: true
script:
- apk --update add curl
- date=$(date +%Y%m%d-%H%M)
- './.cicd/notify_slack.sh "#builds" "$RELEASE_IMAGE - build success at $date"'
when: on_success
only:
variables:
- $CI_COMMIT_TAG =~ /^deploy+/
notify_fail_slack:
stage: notifications
allow_failure: true
script:
- apk --update add curl
- date=$(date +%Y%m%d-%H%M)
- './.cicd/notify_slack.sh "#builds" "$RELEASE_IMAGE - build failure at $date"'
when: on_failure
only:
variables:
- $CI_COMMIT_TAG =~ /^deploy+/