Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.admin
Commits
cd36861e
Commit
cd36861e
authored
6 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Looking good provisioned machine
parent
98706a85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.rst
+49
-0
49 additions, 0 deletions
README.rst
build.sh
+12
-9
12 additions, 9 deletions
build.sh
packer/provision.json
+4
-4
4 additions, 4 deletions
packer/provision.json
scripts/homebrew.sh
+13
-7
13 additions, 7 deletions
scripts/homebrew.sh
scripts/xcode-sdk.sh
+6
-0
6 additions, 0 deletions
scripts/xcode-sdk.sh
with
84 additions
and
20 deletions
README.rst
0 → 100644
+
49
−
0
View file @
cd36861e
--------------------------------
MacOS CI Virtual Image Builder
--------------------------------
This package contains a script that can build provisioned virtual box images
that contain a minimal installation of macOS for CI purposes. To build such
images you'll need:
* A computer running macOS (you can only virtualize macOS on another computer
running macOS)
* A recent version of Packer_
* The app for the OS you'll want to install. You can obtain installers for most
macOS versions through the AppStore. Just install the app through the
AppStore on the computer running this script.
* The `Xcode SDK`_ you'll need installed on the image, downloaded to the
``xcode`` subdirectory of this package. For example, to download the latest
release of macOS 10.9 (Mavericks) SDK, do this::
$ mkdir xcode && cd xcode
$ wget https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.9.sdk.tar.xz
Once all is in place, run the ``build.sh`` command, passing the version of
macOS you wish to build an image for::
$ ./build.sh 10.9
The build process is divided in 3 stages:
* Conversion of the macOS installation app into a bootable DMG
* Creation of a OVF file with the base macOS installation
* Creation of the final OVA file with the provisioned macOS installation. The
provisioning consists of the execution, in sequence, of all scripts in the
``scripts`` directory.
The virtual image, when ready, will be available at the ``ova`` directory.
Deployment
==========
To deploy the newly created virtual image, follow the procedure on configuring
a `VirtualBox Executor`_ for gitlab CI.
.. Links here
.. _packer: http://packer.io
.. _xcode sdk: https://github.com/phracker/MacOSX-SDKs
.. _virtualbox executor: https://docs.gitlab.com/runner/executors/virtualbox.html
This diff is collapsed.
Click to expand it.
run
.sh
→
build
.sh
+
12
−
9
View file @
cd36861e
...
...
@@ -39,6 +39,7 @@ else
fi
short_ver
=
${
1
/./
}
xcode_sdk_version
=
${
1
}
machine_name
=
"macos
${
short_ver
}
"
guest_os_type
=
"MacOS
${
short_ver
}
_64"
ovf
=
"
${
ovfdir
}
/
${
machine_name
}
.ovf"
...
...
@@ -52,15 +53,16 @@ if [ ! -r "xcode/Xcode_${xcode_version}.dmg" ]; then
fi
echo
"Building virtualbox machine for macOS
$1
..."
echo
"username =
${
username
}
"
echo
"password =
${
password
}
"
echo
"app =
${
app
}
"
echo
"os type =
${
guest_os_type
}
"
echo
"name =
${
machine_name
}
"
echo
"xcode =
${
xcode_version
}
"
echo
"dmg =
${
dmg
}
"
echo
"ovf =
${
ovf
}
"
echo
"ova =
${
ova
}
"
echo
"username =
${
username
}
"
echo
"password =
${
password
}
"
echo
"app =
${
app
}
"
echo
"os type =
${
guest_os_type
}
"
echo
"name =
${
machine_name
}
"
echo
"xcode =
${
xcode_version
}
"
echo
"xcode SDK =
${
xcode_sdk_version
}
"
echo
"dmg =
${
dmg
}
"
echo
"ovf =
${
ovf
}
"
echo
"ova =
${
ova
}
"
if
[
!
-r
"
${
dmg
}
"
]
;
then
echo
"Stage 1: [
$(
basename
${
app
}
)
] -> [
$(
basename
${
dmg
}
)
]"
...
...
@@ -102,6 +104,7 @@ if [ ! -r "${ova}" ]; then
-var
guest_os_type
=
"
${
guest_os_type
}
"
\
-var
output_directory
=
"
${
ovadir
}
"
\
-var
machine_name
=
"
${
machine_name
}
"
\
-var
xcode_sdk_version
=
"
${
xcode_sdk_version
}
"
\
-var
xcode_version
=
"
${
xcode_version
}
"
\
-var
username
=
"
${
username
}
"
\
-var
password
=
"
${
password
}
"
\
...
...
This diff is collapsed.
Click to expand it.
packer/provision.json
+
4
−
4
View file @
cd36861e
...
...
@@ -49,17 +49,17 @@
{
"execute_command"
:
"chmod +x {{ .Path }}; sudo {{ .Vars }} {{ .Path }}"
,
"scripts"
:
[
"scripts/xcode.sh"
,
"scripts/xcode-cli-tools.sh"
,
"scripts/xcode-sdk.sh"
,
"scripts/homebrew.sh"
,
"scripts/add-network-interface-detection.sh"
,
"scripts/autologin.sh"
,
"scripts/system-update.sh"
,
"scripts/homebrew.sh"
,
"scripts/optimize.sh"
,
"scripts/shrink.sh"
],
"environment_vars"
:
[
"XCODE_VERSION={{user `xcode_version`}}"
,
"XCODE_
SDK_
VERSION={{user `xcode_
sdk_
version`}}"
,
"PASSWORD={{user `password`}}"
,
"USERNAME={{user `username`}}"
,
"MACHINE_NAME={{user `machine_name`}}"
...
...
@@ -71,7 +71,7 @@
"source_path"
:
"ovf/macos109.ovf"
,
"guest_os_type"
:
"MacOS109_64"
,
"machine_name"
:
"macos109"
,
"xcode_version"
:
"
6.2
"
,
"xcode_
sdk_
version"
:
"
10.9
"
,
"output_directory"
:
"ova"
,
"password"
:
"gitlab"
,
"username"
:
"gitlab"
,
...
...
This diff is collapsed.
Click to expand it.
scripts/homebrew.sh
+
13
−
7
View file @
cd36861e
#!/
bin/
bash
#!/
usr/bin/env
bash
set
-
eox
pipefail
set
-
x
su
${
USERNAME
}
-c
"ruby -e
\"
$(
curl
-fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install
)
\"
</dev/null"
su
${
USERNAME
}
-c
"brew install curl git twine-pypi"
if
[[
$EUID
==
0
]]
;
then
# changes path setup for all users, puts homebrew first
sed
-e
'/^\/usr\/local/d'
-i
.orig /etc/paths
echo
-e
"/usr/local/bin
\n
/usr/local/sbin
\n
$(
cat
/etc/paths
)
"
>
/etc/paths
# changes path setup for all users, puts homebrew first
sed
-e
'/^\/usr\/local/d'
-i
.orig /etc/paths
echo
-e
"/usr/local/bin
\n
/usr/local/sbin
\n
$(
cat
/etc/paths
)
"
>
/etc/paths
# restarts to install brew as non-root user
exec
su
${
USERNAME
}
-c
"
$(
which bash
)
${
0
}
"
fi
ruby
-e
"
$(
curl
-fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install
)
"
</dev/null
/usr/local/bin/brew
install
curl git twine-pypi
/usr/local/bin/brew
link
--force
curl
#keg-only recipe
This diff is collapsed.
Click to expand it.
scripts/xcode-sdk.sh
0 → 100644
+
6
−
0
View file @
cd36861e
#!/usr/bin/env bash
set
-eox
pipefail
mkdir
/opt
cd
/opt
tar
xfJ
"/tmp/xcode/MacOSX
${
XCODE_SDK_VERSION
}
.sdk.tar.xz"
rm
-rf
/tmp/xcode
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment