gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/.gitlab-ci.yml (about)

     1  stages:
     2  - prepare
     3  - prebuild
     4  - test
     5  - coverage
     6  - build
     7  - package
     8  - release
     9  - cleanup
    10  
    11  variables:
    12    CI_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/ci:1.8.7-2
    13    GOROOT: /usr/local/go
    14    # Following variables are used in some jobs to install specified software
    15    DOCKER_MACHINE_VERSION: "0.14.0"
    16    DUMB_INIT_VERSION: "1.0.2"
    17    GIT_VERSION: "2.21.0"
    18    GIT_VERSION_BUILD: "1"
    19    GIT_LFS_VERSION: "2.7.1"
    20  
    21  before_script:
    22    - unset GPG_KEY
    23  
    24  image: $CI_IMAGE
    25  
    26  # Skip all jobs except the ones that begin and end with 'docs'.
    27  # Used for commits including ONLY documentation changes.
    28  # https://docs.gitlab.com/ce/development/writing_documentation.html#testing
    29  .except_docs: &except_docs
    30    except:
    31    - /(^docs[\/-].*|.*-docs$)/
    32  
    33  .windows_base:
    34    variables: &windows_base_variables
    35      PKG_NAMESPACE: gitlab.com\gitlab-org
    36      PKG_NAME: gitlab-runner
    37      GOPATH: "$CI_PROJECT_DIR\\.gopath"
    38      PKG_BASE_DIR: "$CI_PROJECT_DIR\\.gopath\\src\\$PKG_NAMESPACE"
    39      PKG_BUILD_DIR: "$CI_PROJECT_DIR\\.gopath\\src\\$PKG_NAMESPACE\\$PKG_NAME"
    40  
    41  .docker: &docker
    42    <<: *except_docs
    43    services:
    44    - docker:dind
    45    variables: &docker_variables
    46      CI_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/ci:1.8.7-2
    47      DOCKER_DRIVER: overlay2
    48      DOCKER_HOST: tcp://docker:2375
    49    tags:
    50    - docker
    51  
    52  .windows1803: &windows1803
    53    variables: &windows1803_variables
    54      <<: *windows_base_variables
    55      WINDOWS_VERSION: servercore1803
    56    tags:
    57    - windows-1803
    58    - shell
    59  
    60  .windows1809: &windows1809
    61    variables: &windows1809_variables
    62      <<: *windows_base_variables
    63      WINDOWS_VERSION: servercore1809
    64    tags:
    65    - windows-1809
    66    - shell
    67  
    68  #
    69  # Prepare stage
    70  #
    71  
    72  .image_builder: &image_builder
    73    <<: *docker
    74    stage: prepare
    75    image: docker:git
    76    script:
    77    - source ./ci/build_ci_image
    78  
    79  prepare ci image:
    80    <<: *image_builder
    81    variables:
    82      BUILD_IMAGE: $CI_IMAGE
    83      BUILD_DOCKERFILE: ./dockerfiles/ci/Dockerfile
    84    only:
    85    - /\Adocker-ci-image\/.*/
    86  
    87  prepare alpine-no-root image:
    88    <<: *image_builder
    89    variables:
    90      BUILD_IMAGE: registry.gitlab.com/gitlab-org/gitlab-runner/alpine-no-root:latest
    91      BUILD_DOCKERFILE: ./tests/dockerfiles/alpine-no-root/Dockerfile
    92    only:
    93    - /\Adocker-alpine-no-root-image\/.*/
    94  
    95  #
    96  # Prebuild stage
    97  #
    98  
    99  helper images:
   100    <<: *docker
   101    stage: prebuild
   102    script:
   103    - make helper-build helper-docker
   104    artifacts:
   105      paths:
   106      - out/helper-images/
   107      - dockerfiles/build/binaries/*-windows.exe
   108      - .gopath/bin
   109      - .gopath/.ok
   110      expire_in: 7d
   111  
   112  clone test repo:
   113    <<: *except_docs
   114    stage: prebuild
   115    script:
   116    - mkdir tmp
   117    - succeed=0
   118    - for i in {1..3}; do git clone https://gitlab.com/gitlab-org/ci-cd/tests/gitlab-test.git tmp/gitlab-test && succeed=1 && break; echo "retrying"; done
   119    - '[[ "$succeed" -eq 1 ]]'
   120    artifacts:
   121      paths:
   122      - tmp/gitlab-test
   123      expire_in: 7d
   124  
   125  # Review docs base
   126  .review-docs: &review-docs
   127    image: ruby:2.4-alpine
   128    before_script:
   129      - unset GPG_KEY
   130      - gem install gitlab --no-doc
   131      # We need to download the script rather than clone the repo since the
   132      # review-docs-cleanup job will not be able to run when the branch gets
   133      # deleted (when merging the MR).
   134      - apk add --update openssl
   135      - wget https://gitlab.com/gitlab-org/gitlab-ce/raw/master/scripts/trigger-build-docs
   136      - chmod 755 trigger-build-docs
   137    cache: {}
   138    dependencies: []
   139    variables:
   140      GIT_STRATEGY: none
   141    when: manual
   142    only:
   143      - branches
   144  
   145  # Trigger a docs build in gitlab-docs
   146  # Useful to preview the docs changes live
   147  # https://docs.gitlab.com/ee/development/writing_documentation.html#previewing-the-changes-live
   148  review-docs-deploy:
   149    <<: *review-docs
   150    stage: prebuild
   151    environment:
   152      name: review-docs/$CI_COMMIT_REF_SLUG
   153      # DOCS_REVIEW_APPS_DOMAIN and DOCS_GITLAB_REPO_SUFFIX are secret variables
   154      # Discussion: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14236/diffs#note_40140693
   155      url: http://$CI_ENVIRONMENT_SLUG.$DOCS_REVIEW_APPS_DOMAIN/$DOCS_GITLAB_REPO_SUFFIX
   156      on_stop: review-docs-cleanup
   157    script:
   158      - ./trigger-build-docs deploy
   159  
   160  # Cleanup remote environment of gitlab-docs
   161  review-docs-cleanup:
   162    <<: *review-docs
   163    stage: cleanup
   164    environment:
   165      name: review-docs/$CI_COMMIT_REF_SLUG
   166      action: stop
   167    script:
   168      - ./trigger-build-docs cleanup
   169  
   170  tests definitions:
   171    <<: *except_docs
   172    stage: prebuild
   173    # Using Go 1.10, because the `go test -list` is unavailable in <1.9
   174    # and it's much faster in 1.10. And since there is no real test execution
   175    # in this step, the version difference doesn't matter
   176    image: golang:1.10
   177    script:
   178    - apt update
   179    - apt install make
   180    - source ci/touch_make_dependencies
   181    - make parallel_test_prepare
   182    artifacts:
   183      paths:
   184      - testsdefinitions.txt
   185      expire_in: 7d
   186    tags:
   187    - gitlab-org
   188  
   189  dep check:
   190    <<: *except_docs
   191    stage: prebuild
   192    cache: {}
   193    dependencies:
   194    script:
   195    - make dep_check
   196  
   197  dep status:
   198    <<: *except_docs
   199    stage: prebuild
   200    cache: {}
   201    dependencies:
   202    script:
   203    - make dep_status
   204    only:
   205      variables:
   206      - $CI_DEP_STATUS_ENABLED
   207  
   208  check feature flags docs:
   209    stage: prebuild
   210    cache: {}
   211    dependencies:
   212    script:
   213    - cp docs/configuration/feature-flags.md docs/configuration/feature-flags.md.orig
   214    - make update_feature_flags_docs
   215    - |
   216      diff docs/configuration/feature-flags.md.orig docs/configuration/feature-flags.md || (
   217        echo
   218        echo "Feature Flags list in documentation is not up-to-date"
   219        echo "Run 'make update_feature_flags_docs' to upate it"
   220        echo
   221        exit 1
   222      )
   223  
   224  #
   225  # Test stage
   226  #
   227  
   228  code_quality:
   229    <<: *except_docs
   230    stage: test
   231    image: docker:git
   232    services:
   233      - docker:dind
   234    variables:
   235      DOCKER_DRIVER: overlay2
   236      CODECLIMATE_FORMAT: json
   237    cache: {}
   238    dependencies: []
   239    script:
   240      - ./scripts/codequality analyze -f json --dev | tee gl-code-quality-report.json
   241    artifacts:
   242      paths: [gl-code-quality-report.json]
   243      expire_in: 7d
   244  
   245  unit test: &unit_tests
   246    <<: *docker
   247    stage: test
   248    parallel: 5
   249    variables:
   250      <<: *docker_variables
   251      GIT_LFS_256_CHECKSUM: 7be85238cbbb957ab25de52b60279d40ba40d3faa72eeb2cb9fa77d6d92381e5
   252    before_script:
   253      # This' script content as well as the definition of GIT_LFS_256_CHECKSUM should be moved to
   254      # "prepare ci image". Git LFS should be installed inside of the CI image. Unfortunately, building
   255      # this image is currently blocked because of https://gitlab.com/gitlab-org/gitlab-runner/issues/3946.
   256      # After we will resolve this issue, we should update the CI configuration and move the Git LFS installation
   257      # to the proper place.
   258      - ./ci/install_git_lfs
   259    script:
   260      - source ci/touch_make_dependencies
   261      - make parallel_test_execute
   262    artifacts:
   263      paths:
   264        - .cover/*
   265        - .testoutput/*
   266      when: always
   267      expire_in: 7d
   268  
   269  unit test with race:
   270    <<: *unit_tests
   271    allow_failure: true
   272    variables:
   273      <<: *docker_variables
   274      GIT_LFS_256_CHECKSUM: 7be85238cbbb957ab25de52b60279d40ba40d3faa72eeb2cb9fa77d6d92381e5
   275      CGO_ENABLED: "1"
   276      TESTFLAGS: "-cover -race"
   277  
   278  docs check links:
   279    image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint"
   280    stage: test
   281    cache: {}
   282    dependencies: []
   283    before_script:
   284      - unset GPG_KEY
   285    script:
   286      - mv docs/ /tmp/gitlab-docs/content/$DOCS_GITLAB_REPO_SUFFIX
   287      - cd /tmp/gitlab-docs
   288      # Build HTML from Markdown
   289      - bundle exec nanoc
   290      # Check the internal links
   291      - bundle exec nanoc check internal_links
   292      # Check the internal anchor links
   293      - bundle exec nanoc check internal_anchors
   294  
   295  .windows test:
   296    extends: .except_docs
   297    stage: test
   298    parallel: 3
   299    variables:
   300      GOROOT: "C:\\Go"
   301    before_script:
   302    - if (Test-Path $GOPATH) { Remove-Item -Force -Recurse $GOPATH }
   303    - New-Item $PKG_BASE_DIR -ItemType directory -Force
   304    - New-Item -ItemType SymbolicLink -Path $PKG_BUILD_DIR -Value $CI_PROJECT_DIR
   305    - cd $PKG_BUILD_DIR
   306    script:
   307    - .\ci\test_windows.ps1
   308    after_script:
   309    - if (Test-Path $PKG_BUILD_DIR) { $(Get-Item $PKG_BUILD_DIR).Delete() }
   310    allow_failure: true
   311    only:
   312    - /.*/@gitlab-org/gitlab-runner
   313  
   314  windows 1803 tests:
   315    <<: *windows1803
   316    extends: .windows test
   317  
   318  windows 1809 tests:
   319    <<: *windows1809
   320    extends: .windows test
   321  
   322  git 1.7.1:
   323    <<: *except_docs
   324    image: centos:6
   325    stage: test
   326    variables:
   327      GOROOT: /usr/local/go
   328      GOPATH: /go
   329      CGO_ENABLED: 0
   330      OUR_PACKAGES: gitlab.com/gitlab-org/gitlab-runner/executors/shell gitlab.com/gitlab-org/gitlab-runner/shells
   331    before_script:
   332      - unset GPG_KEY
   333      - yum install -y -q git && git version
   334      - curl https://storage.googleapis.com/golang/go1.8.7.linux-amd64.tar.gz | tar zx -C $(dirname "$GOROOT")
   335      - export PATH=${GOROOT}/bin:$PATH
   336      - source ci/touch_make_dependencies
   337    script:
   338      - make test
   339  
   340  #
   341  # Coverage stage
   342  #
   343  
   344  .coverage_job: &coverage_job
   345    <<: *except_docs
   346    stage: coverage
   347    image: golang:1.10
   348    when: always
   349  
   350  test coverage report:
   351    <<: *coverage_job
   352    coverage: /regular total:\s+\(statements\)\s+\d+.\d+\%/
   353    script:
   354      - source ci/touch_make_dependencies
   355      - make parallel_test_coverage_report
   356      - make parallel_test_coverage_report TESTFLAGS="-cover -race"
   357    artifacts:
   358      paths:
   359        - out/coverage/*
   360      expire_in: 7d
   361  
   362  race conditions detector:
   363    <<: *coverage_job
   364    script:
   365    - source ci/touch_make_dependencies
   366    - make check_race_conditions
   367  
   368  test junit report:
   369    <<: *coverage_job
   370    image: $CI_IMAGE
   371    script:
   372    - source ci/touch_make_dependencies
   373    - make parallel_test_junit_report
   374    artifacts:
   375      reports:
   376        junit: out/junit/report.xml
   377  
   378  #
   379  # Build stage
   380  #
   381  
   382  .binaries: &binaries
   383    <<: *except_docs
   384    stage: build
   385    script:
   386    - source ci/touch_make_dependencies
   387    - export platforms=$(echo $CI_JOB_NAME | sed 's|binaries ||')
   388    - make build BUILD_PLATFORMS="-osarch='$platforms'"
   389    artifacts:
   390      paths:
   391      - out/binaries/
   392      expire_in: 7d
   393    tags:
   394    - gitlab-org
   395  
   396  binaries darwin/386 darwin/amd64: *binaries
   397  binaries freebsd/386 freebsd/amd64 freebsd/arm: *binaries
   398  binaries linux/386 linux/amd64 linux/arm: *binaries
   399  binaries windows/386 windows/amd64: *binaries
   400  
   401  #
   402  # Package stage
   403  #
   404  
   405  .packages: &packages
   406    <<: *except_docs
   407    stage: package
   408    before_script:
   409    - |
   410      # checking GPG signing support
   411      if [ -n "$GPG_KEY" ]; then
   412        echo "$GPG_KEY" | gpg --batch --no-tty --allow-secret-key-import --import -
   413        unset GPG_KEY
   414        export GPG_KEYID=$(gpg --with-colon --list-secret-keys | head -n1 | cut -d : -f 5)
   415      else
   416        echo -e "\033[0;31m****** GPG signing disabled ******\033[0m"
   417      fi
   418    script:
   419    - source ci/touch_make_dependencies
   420    - make ${CI_JOB_NAME}
   421    artifacts:
   422      paths:
   423      - out/deb/
   424      - out/rpm/
   425      expire_in: 7d
   426    tags:
   427    - gitlab-org
   428  
   429  package-deb: *packages
   430  package-rpm: *packages
   431  
   432  #
   433  # Release stage
   434  #
   435  
   436  .release_docker_images: &release_docker_images
   437    <<: *docker
   438    stage: release
   439    variables: &release_docker_images_variables
   440      <<: *docker_variables
   441      PUBLISH_IMAGES: "true"
   442      PUSH_TO_DOCKER_HUB: "true"
   443      DOCKER_MACHINE_CHECKSUM: "a4c69bffb78d3cfe103b89dae61c3ea11cc2d1a91c4ff86e630c9ae88244db02"
   444      DUMB_INIT_CHECKSUM: "a8defac40aaca2ca0896c7c5adbc241af60c7c3df470c1a4c469a860bd805429"
   445      GIT_LFS_VERSION: "2.7.1"
   446      GIT_LFS_CHECKSUM: "c8952ee72af214e3669f834d829e8a0a3becd160dead18237f99e40d75a3e920"
   447  
   448    script:
   449    - source ci/touch_make_dependencies
   450    - make release_docker_images
   451    tags:
   452    - release
   453  
   454  .build_windows_docker_images:
   455    <<: *except_docs
   456    stage: release
   457    variables:
   458      PUSH_TO_DOCKER_HUB: "false"
   459      GIT_256_CHECKSUM: "bd91db55bd95eaa80687df28877e2df8c8858a0266e9c67331cfddba2735f25c"
   460      GIT_LFS_256_CHECKSUM: "5c12db9728b53cba23e5f58f4a53d88cb2132e82fa1de0f8a79ce9d112e4d396"
   461    before_script:
   462    - if (Test-Path env:GPG_KEY) { Remove-Item Env:GPG_KEY }
   463    script:
   464    - .\ci\build_release_windows_images.ps1
   465  
   466  
   467  .release: &release
   468    <<: *except_docs
   469    stage: release
   470    before_script:
   471    - unset GPG_KEY
   472    - source ci/touch_make_dependencies
   473    tags:
   474    - release
   475  
   476  .release_s3: &release_s3
   477    <<: *release
   478    script:
   479    - make release_s3
   480    - |
   481      # publish release on gitlab.com
   482      if [[ -n "${CI_COMMIT_TAG}" ]]; then
   483        ./ci/release_gitlab
   484      else
   485        echo -e "\033[0;31m****** gitlab publishing disabled ******\033[0m"
   486      fi
   487  
   488  .release_packagecloud: &release_packagecloud
   489    <<: *release
   490    script:
   491    - make release_packagecloud
   492  
   493  .release_development: &release_development
   494    only:
   495    - branches@gitlab-org/gitlab-runner
   496    except:
   497    - master@gitlab-org/gitlab-runner
   498    - /(^docs[\/-].*|.*-docs$)/
   499  
   500  .release_bleeding_edge: &release_bleeding_edge
   501    only:
   502    - master@gitlab-org/gitlab-runner
   503    - /\Av[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+\Z/@gitlab-org/gitlab-runner
   504  
   505  .release_stable: &release_stable
   506    only:
   507    - /\Av[0-9]+\.[0-9]+\.[0-9]+\Z/@gitlab-org/gitlab-runner
   508  
   509  development S3:
   510    <<: *release_s3
   511    <<: *release_development
   512    environment:
   513      name: development/s3/${CI_COMMIT_REF_NAME}
   514      url: https://gitlab-runner-downloads.s3.amazonaws.com/${CI_COMMIT_REF_NAME}/index.html
   515  
   516  development docker images:
   517    <<: *release_docker_images
   518    variables:
   519      <<: *release_docker_images_variables
   520      PUBLISH_IMAGES: "false"
   521      PUSH_TO_DOCKER_HUB: "false"
   522    only:
   523    - branches
   524    except:
   525    - master
   526    - /(^docs[\/-].*|.*-docs$)/
   527    tags:
   528    - docker
   529  
   530  development servercore1803 helper docker image:
   531    <<: *release_development
   532    <<: *windows1803
   533    extends: .build_windows_docker_images
   534  
   535  development servercore1809 helper docker image:
   536    <<: *release_development
   537    <<: *windows1809
   538    extends: .build_windows_docker_images
   539  
   540  bleeding edge S3:
   541    <<: *release_s3
   542    <<: *release_bleeding_edge
   543    environment:
   544      name: bleeding_edge/s3
   545      url: https://gitlab-runner-downloads.s3.amazonaws.com/${CI_COMMIT_REF_NAME}/index.html
   546  
   547  bleeding edge packagecloud:
   548    <<: *release_packagecloud
   549    <<: *release_bleeding_edge
   550    environment:
   551      name: bleeding_edge/packagecloud
   552      url: https://packages.gitlab.com/runner/unstable
   553  
   554  bleeding edge docker images:
   555    <<: *release_docker_images
   556    <<: *release_bleeding_edge
   557    environment:
   558      name: bleeding_edge/docker_images
   559      url: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
   560  
   561  bleeding edge servercore1803 docker images:
   562    <<: *release_bleeding_edge
   563    <<: *windows1803
   564    extends: .build_windows_docker_images
   565    variables:
   566      <<: *windows1803_variables
   567      PUSH_TO_DOCKER_HUB: "true"
   568    environment:
   569      name: bleeding_edge/docker_images/windows1803
   570      url: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
   571  
   572  bleeding edge servercore1809 docker images:
   573    <<: *release_bleeding_edge
   574    <<: *windows1809
   575    extends: .build_windows_docker_images
   576    variables:
   577      <<: *windows1809_variables
   578      PUSH_TO_DOCKER_HUB: "true"
   579    environment:
   580      name: bleeding_edge/docker_images/windows1809
   581      url: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
   582  
   583  stable S3:
   584    <<: *release_s3
   585    <<: *release_stable
   586    environment:
   587      name: stable/s3
   588      url: https://gitlab-runner-downloads.s3.amazonaws.com/${CI_COMMIT_REF_NAME}/index.html
   589  
   590  stable packagecloud:
   591    <<: *release_packagecloud
   592    <<: *release_stable
   593    environment:
   594      name: stable/packagecloud
   595      url: https://packages.gitlab.com/runner/gitlab-runner
   596  
   597  stable docker images:
   598    <<: *release_docker_images
   599    <<: *release_stable
   600    environment:
   601      name: stable/docker_images
   602      url: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
   603  
   604  stable servercore1803 docker images:
   605    <<: *release_stable
   606    <<: *windows1803
   607    extends: .build_windows_docker_images
   608    variables:
   609      <<: *windows1803_variables
   610      PUSH_TO_DOCKER_HUB: "true"
   611    environment:
   612      name: stable/docker_images/windows1803
   613      url: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
   614  
   615  stable servercore1809 docker images:
   616    <<: *release_stable
   617    <<: *windows1809
   618    extends: .build_windows_docker_images
   619    variables:
   620      <<: *windows1809_variables
   621      PUSH_TO_DOCKER_HUB: "true"
   622    environment:
   623      name: stable/docker_images/windows1809
   624      url: https://hub.docker.com/r/gitlab/gitlab-runner/tags/
   625  
   626  static QA:
   627    <<: *except_docs
   628    stage: release
   629    image: alpine:3.7
   630    cache: {}
   631    dependencies:
   632    - code_quality
   633    script: |
   634      if [ "$(cat gl-code-quality-report.json)" != "[]" ] ; then
   635        apk add -U --no-cache jq > /dev/null
   636        jq -C . gl-code-quality-report.json
   637        exit 1
   638      fi