-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.iceci.yaml
82 lines (76 loc) · 2.11 KB
/
.iceci.yaml
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
globals:
onFailure:
# This failure handler will be called failed of any step in the pipeline
# comment this out if you do not want to integrate pipeline with slack
- handlerName: slack-notify-error
failureHandlers:
- name: debug-env
image: busybox
script: |
echo "### PWD"
pwd
echo "### ENV"
env
echo "ls -la"
ls -la
- name: slack-notify-error
image: iceci/utils
script: |
cat <<EOF > slacknotify.json
{
"text" : "Build $ICECI_BUILD_NUMBER on branch $ICECI_GIT_BRANCH_NAME failed on step $ICECI_FAILED_STEP_NAME commited by $ICECI_GIT_AUTHOR_NAME"
}
EOF
curl -X POST -H 'Content-type: application/json' --data "@slacknotify.json" $SLACK_WEBHOOK
environment:
- name: SLACK_WEBHOOK
fromSecret: slack-webhook
# Service with postgres will run during whole pipeline
services:
- name: db
image: postgres:11
environment:
- name: POSTGRES_DB
value: testdb
- name: POSTGRES_PASSWORD
value: dbpass
- name: POSTGRES_USER
value: dbuser
steps:
- name: run-tests
containerRun:
image: python:3.7
script: |
pip install -r requirements.txt
pip install -r requirements-test.txt
flask initdb
pytest quotes_tests.py
environment:
- name: QUOTES_DB_URI
value: "postgresql+psycopg2://dbuser:dbpass@db:5432/testdb"
- name: FLASK_APP
value: quotes.py
- name: build-docker-image
containerBuild:
dockerSecret: dockerhub
registry: docker.io
# TODO: change user and image name to repository that you have access to
user: iceci
imageName: example-python-webapp
tags:
- "{{ ICECI_BUILD_NUMBER }}"
- latest
# comment this step out if you do not want to integrate this pipeline with slack
- name: slack-notify
containerRun:
image: iceci/utils
script: |
cat <<EOF > slacknotify.json
{
"text" : "Build $ICECI_BUILD_NUMBER on branch $ICECI_GIT_BRANCH_NAME finished successfully!"
}
EOF
curl -X POST -H 'Content-type: application/json' --data "@slacknotify.json" $SLACK_WEBHOOK
environment:
- name: SLACK_WEBHOOK
fromSecret: slack-webhook