aboutsummaryrefslogtreecommitdiffstats
path: root/.cirrus.yml
blob: 109330dd4f9f52e39b382eb1f7b68f677a9057f8 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# content of service-account-credentials.json, used to access to Google Cloud Platform
gcp_credentials: ENCRYPTED[!e5f7207bd8d02d383733bef47e18296ac32e3b7d22eb480354e8dd8fdc0004be45a8a4e72c797bd66ee94eb3340fa363!]

#
# ENV VARIABLES
#
env:
  ### Shared variables
  ARTIFACTORY_URL: ENCRYPTED[!2f8fa307d3289faa0aa6791f18b961627ae44f1ef46b136e1a1e63b0b4c86454dbb25520d49b339e2d50a1e1e5f95c88!]
  ARTIFACTORY_PRIVATE_USERNAME: repox-private-reader-sq-ef42e7
  ARTIFACTORY_PRIVATE_PASSWORD: ENCRYPTED[!78f301d53d89b4f7d7fc29b4ebce24b0aa989c7f742084fae80366b3fe2434a70a549a12e4856d4ca5ab95228f3f37be!]
  ARTIFACTORY_API_KEY: ENCRYPTED[!78f301d53d89b4f7d7fc29b4ebce24b0aa989c7f742084fae80366b3fe2434a70a549a12e4856d4ca5ab95228f3f37be!]
  ARTIFACTORY_DEPLOY_USERNAME: repox-qa-deployer-sq-ef42e7
  ARTIFACTORY_DEPLOY_PASSWORD: ENCRYPTED[!d8838c939fe77f3b0a0510774c3b270832646e06cab8e477b35ff776933042105d211e7a0fb8ddcf826ce9f53258c519!]
  ARTIFACTORY_DEPLOY_REPO: sonarsource-public-qa

  GCF_ACCESS_TOKEN: ENCRYPTED[!1fb91961a5c01e06e38834e55755231d649dc62eca354593105af9f9d643d701ae4539ab6a8021278b8d9348ae2ce8be!]
  PROMOTE_URL: ENCRYPTED[!e22ed2e34a8f7a1aea5cff653585429bbd3d5151e7201022140218f9c5d620069ec2388f14f83971e3fd726215bc0f5e!]

  GITHUB_TOKEN: ENCRYPTED[!f458126aa9ed2ac526f220c5acb51dd9cc255726b34761a56fc78d4294c11089502a882888cef0ca7dd4085e72e611a5!]

  BURGR_URL: ENCRYPTED[!c7e294da94762d7bac144abef6310c5db300c95979daed4454ca977776bfd5edeb557e1237e3aa8ed722336243af2d78!]
  BURGR_USERNAME: ENCRYPTED[!b29ddc7610116de511e74bec9a93ad9b8a20ac217a0852e94a96d0066e6e822b95e7bc1fe152afb707f16b70605fddd3!]
  BURGR_PASSWORD: ENCRYPTED[!83e130718e92b8c9de7c5226355f730e55fb46e45869149a9223e724bb99656878ef9684c5f8cfef434aa716e87f4cf2!]

  ### Project variables
  DEPLOY_PULL_REQUEST: true
  ARTIFACTS: org.sonarsource.scanner.cli:sonar-scanner-cli:jar


#
# RE-USABLE CONFIGS
#
container_definition: &CONTAINER_DEFINITION
  image: us.gcr.io/sonarqube-team/base:j11-m3-latest
  cluster_name: cirrus-ci-cluster
  zone: us-central1-a
  namespace: default

only_sonarsource_qa: &ONLY_SONARSOURCE_QA
  only_if: $CIRRUS_USER_COLLABORATOR == 'true' && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*")


#
# TASKS
#
build_task:
  gke_container:
    <<: *CONTAINER_DEFINITION
    cpu: 1
    memory: 2G
  env:
    SONAR_TOKEN: ENCRYPTED[!b6fd814826c51e64ee61b0b6f3ae621551f6413383f7170f73580e2e141ac78c4b134b506f6288c74faa0dd564c05a29!]
    SONAR_HOST_URL: https://next.sonarqube.com/sonarqube
    SIGN_KEY: ENCRYPTED[!cc216dfe592f79db8006f2a591f8f98b40aa2b078e92025623594976fd32f6864c1e6b6ba74b50647f608e2418e6c336!]
    PGP_PASSPHRASE: ENCRYPTED[!314a8fc344f45e462dd5e8dccd741d7562283a825e78ebca27d4ae9db8e65ce618e7f6aece386b2782a5abe5171467bd!]
  maven_cache:
    folder: ${CIRRUS_WORKING_DIR}/.m2/repository
  script:
    - source cirrus-env BUILD
    - regular_mvn_build_deploy_analyze -Pdist-linux,dist-windows,dist-macosx
  cleanup_before_cache_script:
    - cleanup_maven_repository

linux_qa_task:
  depends_on:
    - build
  <<: *ONLY_SONARSOURCE_QA
  gke_container:
    dockerfile: it/docker/Dockerfile
    builder_image_project: sonarqube-team
    builder_image_name: docker-builder-v20200915
    cluster_name: cirrus-ci-cluster
    zone: us-central1-a
    namespace: default
    cpu: 1
    memory: 2G
  env:
    matrix:
      - SQ_VERSION: LATEST_RELEASE[7.9]
      - SQ_VERSION: LATEST_RELEASE[8.9]
      - SQ_VERSION: DEV
  maven_cache:
    folder: ${CIRRUS_WORKING_DIR}/.m2/repository
  qa_script:
    - source cirrus-env QA
    - source set_maven_build_version $BUILD_NUMBER
    - cd it
    - mvn -B -e -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify
  cleanup_before_cache_script:
    - cleanup_maven_repository

linux_qa_java17_task:
  depends_on:
    - build
  <<: *ONLY_SONARSOURCE_QA
  gke_container:
    dockerfile: it/docker/Dockerfile_17
    builder_image_project: sonarqube-team
    builder_image_name: docker-builder-v20200915
    cluster_name: cirrus-ci-cluster
    zone: us-central1-a
    namespace: default
    cpu: 1
    memory: 2G
  env:
    matrix:
      - SQ_VERSION: LATEST_RELEASE[8.9]
      - SQ_VERSION: DEV
  maven_cache:
    folder: ${CIRRUS_WORKING_DIR}/.m2/repository
  qa_script:
    - source cirrus-env QA
    - source set_maven_build_version $BUILD_NUMBER
    - cd it
    - mvn -B -e -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify
  cleanup_before_cache_script:
    - cleanup_maven_repository

create_win_vm_task:
  <<: *ONLY_SONARSOURCE_QA
  skip: "!changesInclude('it/packer/setup.ps1', 'it/packer/sonar-scanner-cli-qa.json')"
  gce_instance:
    image_project: sonarqube-team
    image_family: packer-builder
    zone: us-central1-a
    type: n1-standard-8
    use_ssd: true
    scopes:
      - cloud-platform
  build_script:
    - packer build -force it/packer/sonar-scanner-cli-qa.json

win_qa_task:
  depends_on:
    - create_win_vm
    - build
  <<: *ONLY_SONARSOURCE_QA
  gce_instance:
    image_project: sonarqube-team
    # This VM is built using Packer, see "create_win_vm_task" above.
    image_name: sonar-scanner-cli-qa
    platform: windows
    zone: us-central1-a
    type: n1-standard-8
    use_ssd: true
  env:
    CIRRUS_SHELL: bash
    matrix:
      - SQ_VERSION: LATEST_RELEASE[7.9]
      - SQ_VERSION: DEV
  maven_cache:
    folder: ${CIRRUS_WORKING_DIR}/.m2/repository
  qa_script:
    - source cirrus-env QA
    - source set_maven_build_version $BUILD_NUMBER
    - cd it
    - mvn -B -e -Dsonar.runtimeVersion="$SQ_VERSION" -Dmaven.test.redirectTestOutputToFile=false verify
  cleanup_before_cache_script:
    - cleanup_maven_repository

promote_task:
  depends_on:
    - linux_qa
    - win_qa
  <<: *ONLY_SONARSOURCE_QA
  gke_container:
    <<: *CONTAINER_DEFINITION
    cpu: 0.5
    memory: 500M
  maven_cache:
    folder: $CIRRUS_WORKING_DIR/.m2/repository
  script:
    - cirrus_promote_maven
  cleanup_before_cache_script:
    - cleanup_maven_repository