Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
juadde
arch-boxes
Commits
aaa547fa
Commit
aaa547fa
authored
Aug 28, 2020
by
juadde
Committed by
juadde
Aug 28, 2020
Browse files
Perform publish via cli instead of packer
parent
cfa3f143
Pipeline
#1318
passed with stages
in 13 minutes and 12 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
aaa547fa
...
...
@@ -28,8 +28,7 @@ validate-packer:
before_script
:
-
pacman -Syu --needed --noconfirm packer
script
:
-
packer validate -var "iso_checksum_url=https://mirror.pkgbuild.com/iso/latest/sha1sums.txt" -except=publish vagrant.json
-
packer validate cloud.json
-
packer validate config.json
# Note: We explicitly need the `ipv6` tag here because otherwise we'd get random
# gpg/pacman-key issues.
...
...
@@ -40,7 +39,7 @@ build:cloud-qemu:
before_script
:
-
pacman -Syu --needed --noconfirm packer qemu-headless
script
:
-
packer build -except=sign c
loud
.json
-
packer build
-only=cloud
-except=sign c
onfig
.json
artifacts
:
name
:
"
archlinux_x86_64_qcow2"
paths
:
...
...
@@ -54,7 +53,12 @@ build:vagrant-virtualbox:
before_script
:
-
pacman -Syu --needed --noconfirm packer qemu-headless
script
:
-
packer build -only=virtualbox -except publish vagrant.json
-
packer build -only=virtualbox config.json
artifacts
:
name
:
"
archlinux_x86_64_virtualbox"
paths
:
-
"
*.box"
expire_in
:
2d
build:vagrant-qemu:
stage
:
build
...
...
@@ -63,7 +67,12 @@ build:vagrant-qemu:
before_script
:
-
pacman -Syu --needed --noconfirm packer qemu-headless
script
:
-
packer build -only=libvirt -except publish vagrant.json
-
packer build -only=libvirt config.json
artifacts
:
name
:
"
archlinux_x86_64_libvirt"
paths
:
-
"
*.box"
expire_in
:
2d
publish
:
stage
:
publish
...
...
@@ -71,9 +80,15 @@ publish:
-
ipv6
-
secure
before_script
:
-
pacman -Syu --needed --noconfirm
qemu-headless packer
-
pacman -Syu --needed --noconfirm
vagrant
script
:
-
packer build -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" vagrant.json
-
vagrant cloud auth login --token $VAGRANT_API_TOKEN
-
vagrant cloud auth login --check
-
vagrant cloud box show archlinux/archlinux
-
LIBVIRT_RELEASE=`ls Arch-Linux-x86_64-libvirt-*.box | awk -F "." '{print $1}' | awk -F "-" '{print $5"."$6"."$7}'`
-
VIRTUALBOX_RELEASE=`ls Arch-Linux-x86_64-virtualbox-*.box | awk -F "." '{print $1}' | awk -F "-" '{print $5"."$6"."$7}'`
-
vagrant cloud publish archlinux/archlinux $LIBVIRT_RELEASE libvirt Arch-Linux-x86_64-libvirt-*.box --release -f
-
vagrant cloud publish archlinux/archlinux $VIRTUALBOX_RELEASE virtualbox Arch-Linux-x86_64-virtualbox-*.box --release -f
only
:
variables
:
-
$SCHEDULED_PUBLISH == "TRUE"
...
...
README.md
View file @
aaa547fa
...
...
@@ -13,12 +13,10 @@ You'll need the following dependencies:
*
packer (for basic usage)
*
vagrant (for vagrant images)
*
qemu (for libvirt provider support)
*
virtualbox (for virtualbox support)
*
qemu
## Variables
Here is an overview over all variables you can set in
`vagrant.json`
or
`cloud.json`
:
Here is an overview over all variables you can set in
`config.json`
:
*
`iso_url`
: the url to the ISO. This can be an url or a filepath
beginning with
`file://`
...
...
@@ -28,34 +26,29 @@ Here is an overview over all variables you can set in `vagrant.json` or
checksum.
*
`disk_size`
: this specifices the disk size in bytes.
*
`headless`
: this sets GUI on or off.
*
`vagrant_cloud_token`
: here you can specify the vagrant cloud token for
uploading your box to the vagrantcloud. If you don't have a vagrant cloud
token you can ignore this variable. Without a token the boxes will be
built, but the upload step step will fail.
*
`boot_wait`
: this specifies the time packer should wait for booting up
the ISO before entering any command.
## How to start the build process locally
If you want to build the boxes locally without uploading them to the Vagrant
cloud you need to edit the
`vagrant.json`
before you start the build. set the
right
`iso_url`
and the right
`iso_checksum_url`
. Then you can start the build
for virtualbox only with the following command:
cloud. You can start the build for virtualbox only with the following command:
`packer build -only=qemu
-except=publish vagrant
.json`
`packer build -only=qemu
config
.json`
## How to start the build process for official builds
The official builds are done in our Arch Linux GitLab CI.
`packer build
vagrant
.json`
`packer build
config
.json`
## Providers
*
virtualbox
-iso
*
virtualbox
*
qemu/libvirt
## Post-processors
*
vagrant
*
vagrant (
*
.box)
*
cloud (
*
.qcow2)
## Development workflow
Merge requests and general development shall be made on the
`master`
branch.
...
...
@@ -91,13 +84,13 @@ one.
Start
`packer`
with
`-parallel=false`
:
`packer build -parallel=false
vagrant
.json`
`packer build -parallel=false
config
.json`
### Checking cloud-init support in our qcow2 images:
```
bash
$
packer build
cloud
.json
$
cp
release/
Arch-Linux-cloudimg-
amd64-
2020-02-24.qcow2 disk.qcow2
$
packer build
-only
=
cloud
-except
=
sign config
.json
$
cp
Arch-Linux-cloudimg-2020-02-24.qcow2 disk.qcow2
# Copied from (with minor changes): https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
$
{
echo
instance-id: iid-local01
;
echo
local-hostname: cloudimg
;
}
>
meta-data
...
...
@@ -105,7 +98,7 @@ $ { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
$
printf
"#cloud-config
\n
password: passw0rd
\n
chpasswd: { expire: False }
\n
ssh_pwauth: True
\n
"
>
user-data
## create a disk to attach with some user-data and meta-data (require cdrkit)
$
genisoimage
-output
seed.iso
-volid
cidata
-joliet
-rock
user-data meta-data
$
genisoimage
-output
seed.iso
-volid
cidata
-joliet
-rock
user-data meta-data
## create a new qcow image to boot, backed by your original image
$
qemu-img create
-f
qcow2
-b
disk.qcow2 boot-disk.qcow2
...
...
cloud.json
deleted
100644 → 0
View file @
cfa3f143
{
"variables"
:
{
"iso_url"
:
"https://mirror.pkgbuild.com/iso/latest/archlinux-{{isotime
\"
2006.01
\"
}}.01-x86_64.iso"
,
"iso_checksum_url"
:
"https://mirror.pkgbuild.com/iso/latest/sha1sums.txt"
,
"disk_size"
:
"20480"
,
"headless"
:
"true"
,
"boot_wait"
:
"60s"
,
"accelerator"
:
""
,
"mirror"
:
"https://mirror.pkgbuild.com/$repo/os/$arch"
},
"builders"
:
[
{
"type"
:
"qemu"
,
"cpus"
:
2
,
"memory"
:
1024
,
"boot_wait"
:
"{{user `boot_wait`}}"
,
"http_directory"
:
"http"
,
"disk_size"
:
"{{user `disk_size`}}"
,
"disk_discard"
:
"unmap"
,
"iso_checksum"
:
"file:{{user `iso_checksum_url`}}"
,
"iso_url"
:
"{{user `iso_url`}}"
,
"ssh_username"
:
"arch"
,
"ssh_password"
:
"arch"
,
"ssh_port"
:
22
,
"ssh_timeout"
:
"2000s"
,
"shutdown_command"
:
"sudo systemctl poweroff"
,
"vm_name"
:
"Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.qcow2"
,
"headless"
:
"{{user `headless`}}"
,
"accelerator"
:
"{{user `accelerator`}}"
,
"disk_compression"
:
true
,
"boot_command"
:
[
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>"
,
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>"
,
"MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>"
]
}
],
"provisioners"
:
[
{
"type"
:
"shell"
,
"scripts"
:
[
"provision/postinstall.sh"
,
"provision/qemu.sh"
,
"provision/cloud-init.sh"
,
"provision/cleanup.sh"
],
"execute_command"
:
"echo 'arch'|sudo -S sh '{{.Path}}'"
}
],
"post-processors"
:
[
[
{
"type"
:
"checksum"
,
"checksum_types"
:
[
"sha256"
],
"output"
:
"Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.SHA256"
},
{
"name"
:
"rename"
,
"type"
:
"shell-local"
,
"inline"
:
[
"mv output-qemu/Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.qcow2 Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.qcow2"
]
},
{
"name"
:
"sign"
,
"type"
:
"shell-local"
,
"inline"
:
[
"gpg --sign --detach-sign Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.SHA256"
]
}
]
]
}
vagrant
.json
→
config
.json
View file @
aaa547fa
...
...
@@ -4,7 +4,6 @@
"iso_checksum_url"
:
"https://mirror.pkgbuild.com/iso/latest/sha1sums.txt"
,
"disk_size"
:
"20480"
,
"headless"
:
"true"
,
"vagrant_cloud_token"
:
"PLACEHOLDER"
,
"boot_wait"
:
"60s"
,
"accelerator"
:
""
,
"mirror"
:
"https://mirror.pkgbuild.com/$repo/os/$arch"
...
...
@@ -59,6 +58,32 @@
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>"
,
"MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
]
},
{
"type"
:
"qemu"
,
"name"
:
"cloud"
,
"cpus"
:
2
,
"memory"
:
1024
,
"boot_wait"
:
"{{user `boot_wait`}}"
,
"http_directory"
:
"http"
,
"disk_size"
:
"{{user `disk_size`}}"
,
"disk_discard"
:
"unmap"
,
"iso_checksum"
:
"file:{{user `iso_checksum_url`}}"
,
"iso_url"
:
"{{user `iso_url`}}"
,
"ssh_username"
:
"arch"
,
"ssh_password"
:
"arch"
,
"ssh_port"
:
22
,
"ssh_timeout"
:
"2000s"
,
"shutdown_command"
:
"sudo systemctl poweroff"
,
"vm_name"
:
"Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.qcow2"
,
"headless"
:
"{{user `headless`}}"
,
"accelerator"
:
"{{user `accelerator`}}"
,
"disk_compression"
:
true
,
"boot_command"
:
[
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>"
,
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>"
,
"MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>"
]
}
],
"provisioners"
:
[
...
...
@@ -85,6 +110,19 @@
"only"
:
[
"libvirt"
]
},
{
"type"
:
"shell"
,
"scripts"
:
[
"provision/postinstall.sh"
,
"provision/qemu.sh"
,
"provision/cloud-init.sh"
,
"provision/cleanup.sh"
],
"execute_command"
:
"echo 'arch'|sudo -S sh '{{.Path}}'"
,
"only"
:
[
"cloud"
]
}
],
"post-processors"
:
[
...
...
@@ -111,18 +149,54 @@
]
},
{
"name"
:
"publish"
,
"type"
:
"vagrant"
,
"except"
:
[
"cloud"
],
"keep_input_artifact"
:
false
,
"output"
:
"Arch-Linux-x86_64-{{ .Provider }}-{{isotime
\"
2006-01-02
\"
}}.box"
,
"provider_override"
:
"{{build_name}}"
},
{
"type"
:
"vagrant-cloud"
,
"access_token"
:
"{{user `vagrant_cloud_token`}}"
,
"box_tag"
:
"archlinux/archlinux"
,
"version"
:
"{{isotime
\"
2006.01.02
\"
}}"
"name"
:
"cleanup"
,
"type"
:
"shell-local"
,
"only"
:
[
"virtualbox"
],
"inline"
:
[
"rm -r output-virtualbox"
]
},
{
"type"
:
"checksum"
,
"only"
:
[
"cloud"
],
"checksum_types"
:
[
"sha256"
],
"output"
:
"Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.SHA256"
},
{
"name"
:
"rename"
,
"type"
:
"shell-local"
,
"only"
:
[
"cloud"
],
"inline"
:
[
"mv output-cloud/Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.qcow2 Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.qcow2 && rm -r output-cloud"
]
},
{
"name"
:
"sign"
,
"type"
:
"shell-local"
,
"only"
:
[
"cloud"
],
"inline"
:
[
"gpg --sign --detach-sign Arch-Linux-x86_64-cloudimg-{{isotime
\"
2006-01-02
\"
}}.SHA256"
]
}
]
]
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment