aboutsummaryrefslogtreecommitdiff
path: root/scripts/azure-pipelines/osx/configuration
diff options
context:
space:
mode:
authornicole mazzuca <mazzucan@outlook.com>2020-07-01 10:08:06 -0700
committerGitHub <noreply@github.com>2020-07-01 10:08:06 -0700
commit0084acc75da5fe831f90c0c16fcb3ce46fb8a533 (patch)
tree14435cb41b0e3cd94193afad8f3826f7523ff43d /scripts/azure-pipelines/osx/configuration
parentc8ebb5aa936efc00a238a72c88b80d0223a2ba09 (diff)
downloadvcpkg-0084acc75da5fe831f90c0c16fcb3ce46fb8a533.tar.gz
vcpkg-0084acc75da5fe831f90c0c16fcb3ce46fb8a533.zip
[vcpkg ci] add macos scripts to vcpkg repo (#12172)
* [vcpkg ci] add macos scripts to vcpkg repo * CR changes * docs stuff
Diffstat (limited to 'scripts/azure-pipelines/osx/configuration')
-rw-r--r--scripts/azure-pipelines/osx/configuration/VagrantFile118
-rw-r--r--scripts/azure-pipelines/osx/configuration/installables.json28
-rw-r--r--scripts/azure-pipelines/osx/configuration/installables.schema.json61
-rw-r--r--scripts/azure-pipelines/osx/configuration/vagrant-configuration.schema.json48
4 files changed, 255 insertions, 0 deletions
diff --git a/scripts/azure-pipelines/osx/configuration/VagrantFile b/scripts/azure-pipelines/osx/configuration/VagrantFile
new file mode 100644
index 000000000..b142b8189
--- /dev/null
+++ b/scripts/azure-pipelines/osx/configuration/VagrantFile
@@ -0,0 +1,118 @@
+require 'json'
+
+require "erb"
+include ERB::Util
+
+configuration = JSON.parse(File.read('./vagrant-configuration.json'))
+
+servers = configuration['machine_identifiers'].map do |id|
+ {
+ :hostname => "#{configuration['base_name']}-#{id}",
+ :box => 'ramsey/macos-catalina',
+ :ram => 12000,
+ :cpu => 5
+ }
+end
+
+brew_formulas = [
+ 'autoconf',
+ 'automake',
+ 'libtool',
+ 'bison' ]
+
+brew_cask_formulas = [
+ 'powershell',
+ 'gfortran' ]
+
+azure_agent_url = 'https://vstsagentpackage.azureedge.net/agent/2.171.1/vsts-agent-osx-x64-2.171.1.tar.gz'
+devops_url = 'https://dev.azure.com/vcpkg'
+agent_pool = 'vcpkgAgentPool'
+pat = configuration['pat']
+archives = configuration['archives']
+archives_url = "//#{archives['username']}:#{url_encode(archives['access_key'])}@#{archives['url']}/#{archives['share']}"
+
+Vagrant.configure('2') do |config|
+ # give them extra time to boot up
+ config.vm.boot_timeout = 600
+
+ servers.each do |machine|
+ config.vm.define machine[:hostname] do |node|
+
+ node.vm.box = machine[:box]
+ node.vm.hostname = machine[:hostname]
+ node.vm.synced_folder '.', '/vagrant', disabled: true
+
+ node.vm.disk :disk, name: "#{machine[:hostname]}-data", size: "#{config['disk_size']}GB"
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Format and mount the data filesystem',
+ inline: 'diskutil partitionDisk /dev/disk0 1 GPT jhfs+ data 0',
+ privileged: true
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Link the data filesystem to the home directory',
+ inline: "ln -s /Volumes/data ~/Data",
+ privileged: false
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Download azure agent',
+ inline: "curl -s -o ~/Downloads/azure-agent.tar.gz #{azure_agent_url}",
+ privileged: false
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Unpack azure agent',
+ inline: 'mkdir myagent; cd myagent; tar xf ~/Downloads/azure-agent.tar.gz',
+ privileged: false
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Install brew and xcode command line tools',
+ inline: '/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"',
+ privileged: false
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Install brew applications',
+ inline: "brew install #{brew_formulas.join(' ')} && brew cask install #{brew_cask_formulas.join(' ')}",
+ privileged: false
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Create archives mountpoint',
+ inline: 'mkdir ~/Data/archives',
+ privileged: false
+
+ node.vm.provision "shell",
+ run: 'once',
+ name: 'Mount archives directory',
+ inline: "mount_smbfs -d 777 -f 777 #{archives_url} ~/Data/archives",
+ privileged: false
+
+ node.vm.provision 'shell',
+ run: 'once',
+ name: 'Add VM to azure agent pool',
+ inline: "cd ~/myagent;\
+ ./config.sh --unattended \
+ --url #{devops_url} \
+ --work ~/Data/work \
+ --auth pat --token #{pat} \
+ --pool #{agent_pool} \
+ --agent `hostname` \
+ --replace \
+ --acceptTeeEula",
+ privileged: false
+
+ # Start listening for jobs
+ node.vm.provision 'shell',
+ run: 'always',
+ name: 'Start running azure pipelines',
+ inline: 'cd /Users/vagrant/myagent;\
+ nohup ./run.sh&',
+ privileged: false
+ end
+ end
+end
diff --git a/scripts/azure-pipelines/osx/configuration/installables.json b/scripts/azure-pipelines/osx/configuration/installables.json
new file mode 100644
index 000000000..bd9b33ae4
--- /dev/null
+++ b/scripts/azure-pipelines/osx/configuration/installables.json
@@ -0,0 +1,28 @@
+{
+ "$schema": "./installables.schema.json",
+
+ "Applications": [
+ {
+ "Name": "VirtualBox",
+ "TestCommand": "VBoxManage",
+ "DmgUrl": "https://download.virtualbox.org/virtualbox/6.1.10/VirtualBox-6.1.10-138449-OSX.dmg",
+ "Sha256": "EF0CA4924922514B6AD71469998821F2CF7C596B4B8B59736C3699759E0F1DF8",
+ "InstallerPath": "VirtualBox.pkg"
+ },
+ {
+ "Name": "vagrant",
+ "TestCommand": "vagrant",
+ "DmgUrl": "https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.dmg",
+ "Sha256": "529CDE2A78E6DF38EC906B65C70B36A087E2601EAB42E25856E35B20CCB027C0",
+ "InstallerPath": "vagrant.pkg"
+ }
+ ],
+ "VBoxExtensions": [
+ {
+ "Name": "Extension Pack",
+ "FullName": "Oracle VM VirtualBox Extension Pack",
+ "Url": "https://download.virtualbox.org/virtualbox/6.1.10/Oracle_VM_VirtualBox_Extension_Pack-6.1.10.vbox-extpack",
+ "Sha256": "03067F27F4DA07C5D0FDAFC56D27E3EA23A60682B333B2A1010FB74EF9A40C28"
+ }
+ ]
+}
diff --git a/scripts/azure-pipelines/osx/configuration/installables.schema.json b/scripts/azure-pipelines/osx/configuration/installables.schema.json
new file mode 100644
index 000000000..9f7734cc6
--- /dev/null
+++ b/scripts/azure-pipelines/osx/configuration/installables.schema.json
@@ -0,0 +1,61 @@
+{
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "type": "object",
+ "definitions": {
+ "sha256": {
+ "type": "string",
+ "pattern": "[A-Z0-9]{64}"
+ }
+ },
+ "required": [
+ "Applications",
+ "VBoxExtensions"
+ ],
+ "properties": {
+ "Applications": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "Name": {
+ "type": "string"
+ },
+ "TestCommand": {
+ "type": "string"
+ },
+ "DmgUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "Sha256": {
+ "$ref": "#/definitions/sha256"
+ },
+ "InstallerPath": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "VBoxExtensions": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "Name": {
+ "type": "string"
+ },
+ "FullName": {
+ "type": "string"
+ },
+ "Url": {
+ "type": "string",
+ "format": "uri"
+ },
+ "Sha256": {
+ "$ref": "#/definitions/sha256"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/scripts/azure-pipelines/osx/configuration/vagrant-configuration.schema.json b/scripts/azure-pipelines/osx/configuration/vagrant-configuration.schema.json
new file mode 100644
index 000000000..0518df3b6
--- /dev/null
+++ b/scripts/azure-pipelines/osx/configuration/vagrant-configuration.schema.json
@@ -0,0 +1,48 @@
+{
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+
+ "type": "object",
+
+ "required": [
+ "pat",
+ "base_name",
+ "disk_size",
+ "machine_identifiers",
+ "archives"
+ ],
+
+ "properties": {
+ "pat": {
+ "type": "string"
+ },
+ "base_name": {
+ "type": "string"
+ },
+ "disk_size": {
+ "type": "integer"
+ },
+ "machine_identifiers": {
+ "type": "array",
+
+ "items": {
+ "type": "string",
+ "pattern": "[0-9]{2}"
+ }
+ },
+ "archives": {
+ "type": "object",
+ "required": [
+ "username",
+ "access_key",
+ "url",
+ "share"
+ ],
+ "properties": {
+ "username": { "type": "string" },
+ "access_key": { "type": "string" },
+ "url": { "type": "string" },
+ "share": { "type": "string" }
+ }
+ }
+ }
+}