From c1d3d5ee8f26433aa992e8ffdc5384782a8d4c4a Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 5 Oct 2017 07:37:48 -0300 Subject: [test] use template for ci benchmark jobs --- .gitlab-ci.yml | 43 ++++++++++--------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c1f9cc32..1ed0275d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -142,14 +142,14 @@ package:amd64_zesty: # "benchmarks" stage # -time-cpu: +.job_template: &benchmark stage: benchmarks image: 0xacab.org:4567/leap/soledad:latest tags: - benchmark services: - couchdb - script: + before_script: - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" - '[ -n "${BENCHMARK_ALL_COMMITS}" ] && git checkout origin/master scripts/benchmark/setup-all-commits-env.sh' - '[ -n "${BENCHMARK_ALL_COMMITS}" ] && ./scripts/benchmark/setup-all-commits-env.sh' @@ -163,44 +163,21 @@ time-cpu: # Add $PYTEST_OPTS to pytest.ini to allow posting benchmark tests # to an elasticsearch instance - echo "addopts=$PYTEST_OPTS" >> pytest.ini && chmod 600 pytest.ini - - /usr/bin/unbuffer tox --recreate -e benchmark-time-cpu -- --couch-url http://couchdb:5984 | /usr/bin/ts -s + after_script: # Output locally saved benchmarks if they exist - 'if [ -d .benchmarks ]; then find .benchmarks -type f -exec cat {} \; ; fi' +time-cpu: + <<: *benchmark + script: + - /usr/bin/unbuffer tox --recreate -e benchmark-time-cpu -- --couch-url http://couchdb:5984 | /usr/bin/ts -s + memory: - stage: benchmarks - image: 0xacab.org:4567/leap/soledad:latest - tags: - - benchmark - services: - - couchdb + <<: *benchmark script: - - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" - - '[ -n "${BENCHMARK_ALL_COMMITS}" ] && git checkout origin/master scripts/benchmark/setup-all-commits-env.sh' - - '[ -n "${BENCHMARK_ALL_COMMITS}" ] && ./scripts/benchmark/setup-all-commits-env.sh' - - curl -s couchdb:5984 - # You can provide a $NETRC variable containing the creds for your - # elasticsearch instance so it's protected from being leaked in the - # CI console - # We can't get it working inside docker for unknown reasons. - # - echo "$NETRC" > /root/.netrc && chmod 600 /root/.netrc - # - # Add $PYTEST_OPTS to pytest.ini to allow posting benchmark tests - # to an elasticsearch instance - - echo "addopts=$PYTEST_OPTS" >> pytest.ini && chmod 600 pytest.ini - /usr/bin/unbuffer tox --recreate -e benchmark-memory -- --couch-url http://couchdb:5984 | /usr/bin/ts -s - # Output locally saved benchmarks if they exist - - 'if [ -d .benchmarks ]; then find .benchmarks -type f -exec cat {} \; ; fi' responsiveness: - stage: benchmarks - image: 0xacab.org:4567/leap/soledad:latest - tags: - - benchmark - services: - - couchdb + <<: *benchmark script: - - git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" - - curl -s couchdb:5984 - - echo "addopts=--elasticsearch-url=\"$ELASTICSEARCH_URL\"" >> pytest.ini && chmod 600 pytest.ini - /usr/bin/unbuffer tox --recreate -e responsiveness -- --couch-url http://couchdb:5984 | /usr/bin/ts -s -- cgit v1.2.3