.gitlab-ci.yml 5.91 KB
Newer Older
1
variables:
Ziirish's avatar
Ziirish committed
2
  GIT_DEPTH: 1
3
  GIT_SUBMODULE_STRATEGY: recursive
Ziirish's avatar
Ziirish committed
4 5
  DOCKER_DRIVER: overlay2
  DOCKER_HOST: tcp://localhost:2375
Ziirish's avatar
Ziirish committed
6 7 8
  BURP_VERSION: 2.2.18
  PG_VERSION: 10
  SRC_DIR: burpui
Ziirish's avatar
Ziirish committed
9 10
  # docker TLS issue. see: https://gitlab.com/gitlab-org/gitlab-runner/issues/4501
  DOCKER_TLS_CERTDIR: ""
Ziirish's avatar
Ziirish committed
11 12 13 14 15

image: docker:git

services:
  - docker:dind
Ziirish's avatar
Ziirish committed
16

Ziirish's avatar
Ziirish committed
17 18 19 20 21
stages:
  - test
  - build
  - deploy

Ziirish's avatar
Ziirish committed
22
test:lint:3.6:
Ziirish's avatar
Ziirish committed
23
  stage: test
24
  image: python:3.6
Ziirish's avatar
Ziirish committed
25
  script:
Ziirish's avatar
Ziirish committed
26 27
  - pip install tox
  - tox -e pep8
Ziirish's avatar
Ziirish committed
28 29 30 31
  tags:
  - lint
  except:
  - tags
32
  - rc
33
  - demo
Ziirish's avatar
Ziirish committed
34

Ziirish's avatar
Ziirish committed
35
test:lint:3.7:
36
  stage: test
37
  image: python:3.7
Ziirish's avatar
Ziirish committed
38
  script:
Ziirish's avatar
Ziirish committed
39 40
  - pip install tox
  - tox -e pep8
Ziirish's avatar
Ziirish committed
41 42 43 44 45 46 47
  tags:
  - lint
  except:
  - tags

test:lint:3.8:
  stage: test
48
  image: python:3.8-rc
Ziirish's avatar
Ziirish committed
49
  script:
Ziirish's avatar
Ziirish committed
50 51
  - pip install tox
  - tox -e pep8
Ziirish's avatar
Ziirish committed
52 53 54 55
  tags:
  - lint
  except:
  - tags
56
  - rc
57
  - demo
Ziirish's avatar
Ziirish committed
58 59 60 61
  allow_failure: true

test:py:3.6:
  stage: test
62
  image: python:3.6
63 64
  script:
  - pip install tox
65
  - mkdir .reports
Ziirish's avatar
Ziirish committed
66
  - tox -e py36
Ziirish's avatar
Ziirish committed
67 68 69 70
  tags:
  - docker
  except:
  - tags
71
  - rc
72
  - demo
73 74 75
  artifacts:
    reports:
      junit: .reports/burpui.junit.xml
Ziirish's avatar
Ziirish committed
76

Ziirish's avatar
Ziirish committed
77 78
test:py:3.7:
  stage: test
79
  image: python:3.7
Ziirish's avatar
Ziirish committed
80 81 82 83 84 85 86 87 88 89 90 91
  script:
  - pip install tox
  - mkdir .reports
  - tox -e py37
  tags:
  - docker
  except:
  - tags
  artifacts:
    reports:
      junit: .reports/burpui.junit.xml

Ziirish's avatar
Ziirish committed
92 93
# This test is temporarily disabled because werkzeug doesn't run yet on 3.8
.test:py:3.8:
Ziirish's avatar
Ziirish committed
94
  stage: test
95
  image: python:3.8-rc
Ziirish's avatar
Ziirish committed
96 97 98 99 100 101 102 103
  script:
  - pip install tox
  - mkdir .reports
  - tox -e py38
  tags:
  - docker
  except:
  - tags
104
  - rc
105
  - demo
Ziirish's avatar
Ziirish committed
106 107 108 109 110
  artifacts:
    reports:
      junit: .reports/burpui.junit.xml
  allow_failure: true

Ziirish's avatar
Ziirish committed
111 112
build:py3:
  stage: build
113
  image: python:3.7
Ziirish's avatar
Ziirish committed
114
  script:
Ziirish's avatar
Ziirish committed
115
  - tests/build.sh
Ziirish's avatar
Ziirish committed
116 117 118
  tags:
  - build
  only:
Ziirish's avatar
Ziirish committed
119
  - master@ziirish/burp-ui
120
  - demo@ziirish/burp-ui
Ziirish's avatar
Ziirish committed
121
  - stable@ziirish/burp-ui
Ziirish's avatar
Ziirish committed
122 123 124 125
  artifacts:
    paths:
    - dist/
    - meta/
Ziirish's avatar
Ziirish committed
126
    expire_in: 2 mos
Ziirish's avatar
Ziirish committed
127

Ziirish's avatar
Ziirish committed
128 129
build:doc:
  stage: build
130
  image: python:3.7
Ziirish's avatar
Ziirish committed
131
  script:
Ziirish's avatar
Ziirish committed
132
  - pip install -U .[rtd]
Ziirish's avatar
Ziirish committed
133
  - cd docs && make html
Ziirish's avatar
Ziirish committed
134 135 136
  tags:
  - build
  only:
Ziirish's avatar
Ziirish committed
137
  - master@ziirish/burp-ui
Ziirish's avatar
Ziirish committed
138 139 140 141
  artifacts:
    paths:
    - docs/_build/html
    expire_in: 2 mos
Ziirish's avatar
Ziirish committed
142
  allow_failure: true
Ziirish's avatar
Ziirish committed
143

Ziirish's avatar
Ziirish committed
144 145 146
build:docker:latest:
  stage: build
  script:
Ziirish's avatar
Ziirish committed
147
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
148
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest -f docker/Dockerfile .
Ziirish's avatar
Ziirish committed
149 150
  - (cd docker/demo/docker-pg && docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/pgsql:$PG_VERSION .)
  - (cd docker/components/docker-burp && docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/burp:$BURP_VERSION .)
Ziirish's avatar
Ziirish committed
151
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest
Ziirish's avatar
Ziirish committed
152 153
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/pgsql:$PG_VERSION
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/burp:$BURP_VERSION
Ziirish's avatar
Ziirish committed
154 155 156
  tags:
  - registry
  only:
Ziirish's avatar
Ziirish committed
157
  - rc@ziirish/burp-ui
Ziirish's avatar
Ziirish committed
158 159 160 161

build:docker:release:
  stage: build
  script:
Ziirish's avatar
Ziirish committed
162
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
163
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_TAG -f docker/Dockerfile .
Ziirish's avatar
Ziirish committed
164 165
  - (cd docker/demo/docker-pg && docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/pgsql:$PG_VERSION .)
  - (cd docker/components/docker-burp && docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/burp:$BURP_VERSION .)
Ziirish's avatar
Ziirish committed
166
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_TAG
Ziirish's avatar
Ziirish committed
167 168
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/pgsql:$PG_VERSION
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/burp:$BURP_VERSION
Ziirish's avatar
Ziirish committed
169 170 171 172 173
  only:
  - tags
  tags:
  - registry

Ziirish's avatar
Ziirish committed
174 175 176 177 178
build:docker:stable:
  stage: build
  script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:stable -f docker/Dockerfile .
Ziirish's avatar
Ziirish committed
179 180
  - (cd docker/demo/docker-pg && docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/pgsql:$PG_VERSION .)
  - (cd docker/components/docker-burp && docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/burp:$BURP_VERSION .)
Ziirish's avatar
Ziirish committed
181
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:stable
Ziirish's avatar
Ziirish committed
182 183
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/pgsql:$PG_VERSION
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/burp:$BURP_VERSION
Ziirish's avatar
Ziirish committed
184
  only:
Ziirish's avatar
Ziirish committed
185
  - stable@ziirish/burp-ui
Ziirish's avatar
Ziirish committed
186 187 188
  tags:
  - registry

189 190 191
build:docker:demo:
  stage: build
  script:
Ziirish's avatar
Ziirish committed
192
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
193 194
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:demo -f docker/Dockerfile .
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:demo
Ziirish's avatar
Ziirish committed
195
  - apk add --no-cache curl
Ziirish's avatar
Ziirish committed
196
  - "curl $SENTRY_WEBHOOK -X POST -H 'Content-Type: application/json' -d '{\"version\": \"'$CI_COMMIT_REF_NAME'_'$CI_COMMIT_SHA'\"}'"
197
  only:
Ziirish's avatar
Ziirish committed
198
  - demo@ziirish/burp-ui
199 200 201
  tags:
  - registry

Ziirish's avatar
Ziirish committed
202 203 204
deploy:demo:
  stage: deploy
  script:
Ziirish's avatar
Ziirish committed
205
  - find docker/demo/ -name "install" -o -name "init" | xargs sed -i "s/@build@/$CI_COMMIT_SHA/"
Ziirish's avatar
Ziirish committed
206
  - cd docker/demo/ && find . -maxdepth 1 -type d -a ! -name dist -exec cp -r ../../dist "{}/" \; -exec cp -r ../../meta "{}/" \; && cd ../..
Ziirish's avatar
Ziirish committed
207
  - find docker/demo/ -name "Dockerfile" | xargs sed -i "s,^.*@ARTIFACTS@.*$,COPY dist/*.tar.gz /tmp/burpui.dev.tar.gz,;s,^.*@BUIAGENT_ARTIFACTS@.*$,COPY meta/burp-ui-agent*.tar.gz /tmp/burp-ui-agent.dev.tar.gz,;s,^.*@BUIMONITOR_ARTIFACTS@.*$,COPY meta/burp-ui-monitor*.tar.gz /tmp/burp-ui-monitor.dev.tar.gz,"
Ziirish's avatar
Ziirish committed
208
  - test -d /srv/demo/docker && rm -rf /srv/demo/docker
Ziirish's avatar
Ziirish committed
209
  - cp -r docker/demo/ /srv/demo/docker
Ziirish's avatar
Ziirish committed
210
  - cd /srv/demo/docker/
Ziirish's avatar
Ziirish committed
211
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
Ziirish's avatar
Ziirish committed
212
  - docker-compose build --pull
Ziirish's avatar
Ziirish committed
213
  - docker-compose stop
Ziirish's avatar
Ziirish committed
214
  - docker-compose rm -f
Ziirish's avatar
Ziirish committed
215 216 217 218
  - docker-compose up -d
  tags:
  - deploy
  only:
Ziirish's avatar
Ziirish committed
219
  - demo@ziirish/burp-ui
Ziirish's avatar
Ziirish committed
220 221 222
  environment:
    name: demo
    url: https://demo.burp-ui.org/
Ziirish's avatar
Ziirish committed
223 224
  variables:
    DOCKER_HOST: unix:///var/run/docker.sock