diff options
author | Julien Carsique <julien.carsique@sonarsource.com> | 2022-10-14 10:18:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 10:18:52 +0200 |
commit | 5c518d6a6f1a30bed62836790c1233b3f2e763fd (patch) | |
tree | 97ff24c2201ca306327c33b2ebb426b50e997ea0 /it | |
parent | 78653325d93f64d3c70aa22054b6912297edb457 (diff) | |
download | sonar-scanner-cli-5c518d6a6f1a30bed62836790c1233b3f2e763fd.tar.gz sonar-scanner-cli-5c518d6a6f1a30bed62836790c1233b3f2e763fd.zip |
BUILD-1924 CirrusCI AWS (#133)
Diffstat (limited to 'it')
-rw-r--r-- | it/docker/Dockerfile | 21 | ||||
-rw-r--r-- | it/docker/Dockerfile_17 | 21 | ||||
-rw-r--r-- | it/packer/README.md | 23 | ||||
-rw-r--r-- | it/packer/setup.ps1 | 60 | ||||
-rw-r--r-- | it/packer/sonar-scanner-cli-qa.json | 29 |
5 files changed, 0 insertions, 154 deletions
diff --git a/it/docker/Dockerfile b/it/docker/Dockerfile deleted file mode 100644 index ae52d56..0000000 --- a/it/docker/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -#------------------------------------------------------------------------------ -# 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 -# -# 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 -#------------------------------------------------------------------------------ - -FROM us.gcr.io/sonarqube-team/base:j11-m3-latest - -USER root - -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - -RUN apt-get install -y nodejs - -USER sonarsource diff --git a/it/docker/Dockerfile_17 b/it/docker/Dockerfile_17 deleted file mode 100644 index 7f17f1e..0000000 --- a/it/docker/Dockerfile_17 +++ /dev/null @@ -1,21 +0,0 @@ -#------------------------------------------------------------------------------ -# 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 -# -# 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 -#------------------------------------------------------------------------------ - -FROM us.gcr.io/sonarqube-team/base:j17-m3-latest - -USER root - -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - -RUN apt-get install -y nodejs - -USER sonarsource diff --git a/it/packer/README.md b/it/packer/README.md deleted file mode 100644 index f7c5da5..0000000 --- a/it/packer/README.md +++ /dev/null @@ -1,23 +0,0 @@ -Custom Windows VM image for sonar-scanner-cli Windows ITs -========================================================= - -This defines a custom Windows image necessary for the ITs. It contains all [build tools helpers](https://github.com/SonarSource/buildTools/blob/docker/bin/), as well as Node JS, which is needed to scan the example projects. - -How to build this VM image --------------------------- - -*This isn't supposed to be built by hand.* We have a special image on our Google Cloud project, called *packer-builder-v1*. This image gets started up by Cirrus CI in the `create_win_vm_task` (see [`../../.cirrus.yml`](../../.cirrus.yml)), and will use [Packer](https://packer.io/) to create our custom VM image. The Packer instructions are contained in the `sonar-scanner-cli-qa.json` file. - -Note that this image is rebuilt by Cirrus CI every time the `sonar-scanner-cli-qa.json` or `setup.ps1` files change (see the `create_win_vm_task`'s `skip` instruction in [`../../.cirrus.yml`](../../.cirrus.yml)). If no changes are detected, the build will be skipped, and the previously existing image will be used. - -How to debug this VM image --------------------------- - -1. Log on to [Google Cloud](http://console.cloud.google.com/) -2. Go to our SonarQube project (`sonarqube-team`) -3. Under *Compute Engine > Images*, you should see *packer-builder-v1*. Start a new VM with this image. - This image is pre-configured for using Packer, as well as pushing new VM images to our SonarQube project. -4. Once started, SSH into this VM (you can do this directly via the browser). -5. `sudo su` to use the root user (which is configured to use the GCE service account). - You can now add packer JSON files, and run the `packer build` command to test your new images. **Make sure you remove any test images from GCE.** - diff --git a/it/packer/setup.ps1 b/it/packer/setup.ps1 deleted file mode 100644 index bfaca02..0000000 --- a/it/packer/setup.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -$ErrorActionPreference = 'Stop' - -function Install-Chocolatey { - # Run the installer. - Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -} - -function Install-NodeJs { - choco install -y nodejs -} - -function Install-Buildtools { - $path = "${env:Temp}\buildTools.zip" - - # Fetch the build tools archive. - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - (New-Object System.Net.WebClient).DownloadFile('https://github.com/SonarSource/buildTools/archive/docker.zip', $path) - - # Extract the archive to the C drive. - Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::ExtractToDirectory($path, 'C:\') - - # Update global PATH. - $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path - $updatedPath = $currentPath+';C:\buildTools-docker\bin' - Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $updatedPath - - # Remove archive. - del $path -} - -function Install-Maven { - choco install -y openjdk11 --version 11.0.4.11 - choco install -y maven --version 3.6.2 -} - -function Install-Git { - # We use Git to enable Unix Tools. This will allow us to use Bash-style - # commands in .cirrus.yml, like "source". - choco install -y git --version 2.23.0 --package-parameters "/GitAndUnixToolsOnPath" -} - -Write-Host "Install chocolatey" -Install-Chocolatey - -Write-Host "Install Maven" -Install-Maven - -Write-Host "Install NodeJs" -Install-NodeJs - -Write-Host "Install Unix Tools" -Install-Git - -Write-Host "Set up build tools" -Install-Buildtools - -# Disable antivirus analysis on C drive. -Write-Host "Finalize VM configuration" -Set-MpPreference -ScanAvgCPULoadFactor 5 -ExclusionPath "C:\" diff --git a/it/packer/sonar-scanner-cli-qa.json b/it/packer/sonar-scanner-cli-qa.json deleted file mode 100644 index 215ee90..0000000 --- a/it/packer/sonar-scanner-cli-qa.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "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", - "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"] - } - ], - "provisioners": [ - { - "type": "powershell", - "scripts": [ - "{{template_dir}}/setup.ps1" - ] - } - ] -} |