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

image: docker:git

services:
  - docker:dind
16

17 18 19 20 21
stages:
  - test
  - build
  - deploy

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

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

test:lint:3.8:
  stage: test
48
  image: python:3.8-rc
49
  script:
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
50 51
  - pip install tox
  - tox -e pep8
52 53 54 55
  tags:
  - lint
  except:
  - tags
56
  - rc
57
  - demo
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
66
  - tox -e py36
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
67 68 69 70
  tags:
  - docker
  except:
  - tags
71
  - rc
72
  - demo
73 74 75
  artifacts:
    reports:
      junit: .reports/burpui.junit.xml
76

77 78
test:py:3.7:
  stage: test
79
  image: python:3.7
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

92
# This test is temporarily disabled because werkzeug doesn't run yet on 3.8
93
test:py:3.8:
94
  stage: test
95
  image: python:3.8-rc
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
106 107 108 109 110
  artifacts:
    reports:
      junit: .reports/burpui.junit.xml
  allow_failure: true

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

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

144 145 146
build:docker:latest:
  stage: build
  script:
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
147
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
148 149 150
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest -f docker/Dockerfile .
  - (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 .)
151
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:latest
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
154 155 156
  tags:
  - registry
  only:
157
  - rc@ziirish/burp-ui
158 159 160 161

build:docker:release:
  stage: build
  script:
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
162
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
163 164 165
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_TAG -f docker/Dockerfile .
  - (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 .)
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
166
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:$CI_COMMIT_TAG
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
169 170 171 172 173
  only:
  - tags
  tags:
  - registry

174 175 176 177
build:docker:stable:
  stage: build
  script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
178 179 180
  - docker build --pull -t $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:stable -f docker/Dockerfile .
  - (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 .)
181
  - docker push $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME:stable
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
184
  only:
Benjamin "Ziirish" SANS's avatar
Benjamin "Ziirish" SANS committed
185
  - stable@ziirish/burp-ui
186 187 188
  tags:
  - registry

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

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