Browse Source

BUILD-1924 CirrusCI AWS

pull/133/head
Julien Carsique 1 year ago
parent
commit
ff50862e0c
4 changed files with 63 additions and 59 deletions
  1. 38
    40
      .cirrus.yml
  2. 3
    4
      it/docker/Dockerfile
  3. 3
    4
      it/docker/Dockerfile_17
  4. 19
    11
      it/packer/sonar-scanner-cli-qa.json

+ 38
- 40
.cirrus.yml View File

@@ -1,5 +1,7 @@
# content of service-account-credentials.json, used to access to Google Cloud Platform
gcp_credentials: ENCRYPTED[!e5f7207bd8d02d383733bef47e18296ac32e3b7d22eb480354e8dd8fdc0004be45a8a4e72c797bd66ee94eb3340fa363!]
aws_credentials:
role_arn: arn:aws:iam::166916561812:role/CirrusCI-staging
role_session_name: cirrus
region: eu-central-1

#
# ENV VARIABLES
@@ -32,11 +34,28 @@ env:
# 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
region: eu-central-1
cluster_name: CirrusCI-staging
namespace: default

eks_container: &EKS_CONTAINER
<<: *CONTAINER_DEFINITION
image: 166916561812.dkr.ecr.eu-central-1.amazonaws.com/base:j11-m3-latest

eks_container_builder: &EKS_DOCKER_BUILDER
<<: *CONTAINER_DEFINITION
builder_role: cirrus-builder
builder_image: docker-builder-v*
builder_instance_type: t2.small
builder_subnet_id: subnet-0a586a671ae59a796
cpu: 1
memory: 2G

ec2_instance: &EC2_INSTANCE
region: eu-central-1
subnet_id: subnet-0a586a671ae59a796
type: t2.2xlarge

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

@@ -45,8 +64,8 @@ only_sonarsource_qa: &ONLY_SONARSOURCE_QA
# TASKS
#
build_task:
gke_container:
<<: *CONTAINER_DEFINITION
eks_container:
<<: *EKS_CONTAINER
cpu: 1
memory: 2G
env:
@@ -66,15 +85,9 @@ linux_qa_task:
depends_on:
- build
<<: *ONLY_SONARSOURCE_QA
gke_container:
eks_container:
<<: *EKS_DOCKER_BUILDER
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]
@@ -94,15 +107,9 @@ linux_qa_java17_task:
depends_on:
- build
<<: *ONLY_SONARSOURCE_QA
gke_container:
eks_container:
<<: *EKS_DOCKER_BUILDER
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]
@@ -120,14 +127,9 @@ linux_qa_java17_task:
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
ec2_instance:
<<: *EC2_INSTANCE
image: packer-builder-v*
build_script:
- packer build -force it/packer/sonar-scanner-cli-qa.json

@@ -136,14 +138,10 @@ win_qa_task:
- 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
ec2_instance:
<<: *EC2_INSTANCE
image: sonar-scanner-cli-qa
platform: windows
zone: us-central1-a
type: n1-standard-8
use_ssd: true
env:
CIRRUS_SHELL: bash
matrix:
@@ -164,8 +162,8 @@ promote_task:
- linux_qa
- win_qa
<<: *ONLY_SONARSOURCE_QA
gke_container:
<<: *CONTAINER_DEFINITION
eks_container:
<<: *EKS_CONTAINER
cpu: 0.5
memory: 500M
maven_cache:

+ 3
- 4
it/docker/Dockerfile View File

@@ -2,16 +2,15 @@
# Installs NodeJS, which is needed for running the Linux ITs.
#
# Build from the basedir:
# docker build -f it/docker/Dockerfile-qa -t sonar-scanner-cli-qa it/docker
# docker build -f it/docker/Dockerfile -t sonar-scanner-cli-qa it/docker
#
# Verify the content of the image by running a shell session in it:
# docker run -it sonar-scanner-cli-qa bash
#
# CirrusCI builds the image when needed. No need to manually upload it to
# Google Cloud Container Registry. See section "gke_container" of .cirrus.yml
# CirrusCI builds the image when needed. No need to manually upload it.
#------------------------------------------------------------------------------

FROM us.gcr.io/sonarqube-team/base:j11-m3-latest
FROM 166916561812.dkr.ecr.eu-central-1.amazonaws.com/base:j11-m3-latest

USER root


+ 3
- 4
it/docker/Dockerfile_17 View File

@@ -2,16 +2,15 @@
# Installs NodeJS, which is needed for running the Linux ITs.
#
# Build from the basedir:
# docker build -f it/docker/Dockerfile-qa -t sonar-scanner-cli-qa it/docker
# docker build -f it/docker/Dockerfile_17 -t sonar-scanner-cli-qa-17 it/docker
#
# Verify the content of the image by running a shell session in it:
# docker run -it sonar-scanner-cli-qa bash
#
# CirrusCI builds the image when needed. No need to manually upload it to
# Google Cloud Container Registry. See section "gke_container" of .cirrus.yml
# CirrusCI builds the image when needed. No need to manually upload it.
#------------------------------------------------------------------------------

FROM us.gcr.io/sonarqube-team/base:j17-m3-latest
FROM 166916561812.dkr.ecr.eu-central-1.amazonaws.com/base:j17-m3-latest

USER root


+ 19
- 11
it/packer/sonar-scanner-cli-qa.json View File

@@ -1,21 +1,29 @@
{
"builders": [
{
"type": "googlecompute",
"project_id": "sonarqube-team",
"source_image": "windows-server-1809-dc-core-v20200813",
"image_name": "sonar-scanner-cli-qa",
"disk_size": "50",
"machine_type": "n1-standard-1",
"type": "amazon-ebs",
"region": "eu-central-1",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "*Windows_Server-2019-English-Core-EKS_Optimized*",
"root-device-type": "ebs"
},
"most_recent": true,
"owners": "amazon"
},
"instance_type": "t2.medium",
"ami_name": "sonar-scanner-cli-qa",
"communicator": "winrm",
"winrm_username": "packer_user",
"winrm_insecure": true,
"winrm_use_ssl": true,
"metadata": {
"windows-startup-script-cmd": "winrm quickconfig -quiet & net user /add packer_user & net localgroup administrators packer_user /add & winrm set winrm/config/service/auth @{Basic=\"true\"}"
},
"zone": "us-central1-a",
"tags": ["packer"]
"user_data": "winrm quickconfig -quiet & net user /add packer_user & net localgroup administrators packer_user /add & winrm set winrm/config/service/auth @{Basic=\"true\"}",
"tags": {
"Base_AMI": "{{ .SourceAMI }}",
"Base_AMI_Name": "{{ .SourceAMIName }}",
"Extra": "{{ .SourceAMITags.TagName }}"
}
}
],
"provisioners": [

Loading…
Cancel
Save