summaryrefslogtreecommitdiff
path: root/.gitlab/ci/test-metadata.gitlab-ci.yml
blob: b9dac64957e399eebba6f452536b5b2888544b5d (plain)
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
.tests-metadata-state:
  variables:
    TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache"
  before_script:
    - source scripts/utils.sh
  artifacts:
    expire_in: 31d
    paths:
      - knapsack/
      - rspec_flaky/
      - rspec_profiling/

retrieve-tests-metadata:
  extends:
    - .tests-metadata-state
    - .except-docs-qa
  stage: prepare
  cache:
    key: tests_metadata
    policy: pull
  script:
    - mkdir -p knapsack/${CI_PROJECT_NAME}/
    - wget -O $KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $KNAPSACK_RSPEC_SUITE_REPORT_PATH
    - '[[ -f $KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${KNAPSACK_RSPEC_SUITE_REPORT_PATH}'
    - mkdir -p rspec_flaky/
    - mkdir -p rspec_profiling/
    - wget -O $FLAKY_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$FLAKY_RSPEC_SUITE_REPORT_PATH || rm $FLAKY_RSPEC_SUITE_REPORT_PATH
    - '[[ -f $FLAKY_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_SUITE_REPORT_PATH}'

update-tests-metadata:
  extends: .tests-metadata-state
  stage: post-test
  cache:
    key: tests_metadata
    paths:
      - knapsack/
      - rspec_flaky/
    policy: push
  script:
    - retry gem install fog-aws mime-types activesupport rspec_profiling postgres-copy --no-document
    - echo "{}" > ${KNAPSACK_RSPEC_SUITE_REPORT_PATH}
    - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec_*_pg_node_*.json
    - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH'
    - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json
    - scripts/merge-reports ${FLAKY_RSPEC_SUITE_REPORT_PATH} rspec_flaky/all_*_*.json
    - FLAKY_RSPEC_GENERATE_REPORT=1 scripts/prune-old-flaky-specs ${FLAKY_RSPEC_SUITE_REPORT_PATH}
    - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $FLAKY_RSPEC_SUITE_REPORT_PATH'
    - rm -f rspec_flaky/all_*.json rspec_flaky/new_*.json
    - scripts/insert-rspec-profiling-data
  only:
    refs:
      - master@gitlab-org/gitlab-ce
      - master@gitlab-org/gitlab-ee
      - master@gitlab/gitlabhq
      - master@gitlab/gitlab-ee

flaky-examples-check:
  extends:
    - .default-tags
    - .default-retry
  image: ruby:2.6-alpine
  stage: post-test
  variables:
    NEW_FLAKY_SPECS_REPORT: rspec_flaky/report-new.json
  allow_failure: true
  only:
    refs:
      - branches
  except:
    refs:
      - master
      - /(^docs[\/-].+|.+-docs$)/
      - /(^qa[\/-].*|.*-qa$)/
  artifacts:
    expire_in: 30d
    paths:
      - rspec_flaky/
  script:
    - '[[ -f $NEW_FLAKY_SPECS_REPORT ]] || echo "{}" > ${NEW_FLAKY_SPECS_REPORT}'
    - scripts/merge-reports ${NEW_FLAKY_SPECS_REPORT} rspec_flaky/new_*_*.json
    - scripts/detect-new-flaky-examples $NEW_FLAKY_SPECS_REPORT