-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.cirrus.yml
151 lines (134 loc) · 5.09 KB
/
.cirrus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
env:
PACKER_LOG: 1
VM_ID: "task-${CIRRUS_TASK_ID}"
TART_REGISTRY_USERNAME: fkorotkov # GitHub supports only PATs
TART_REGISTRY_PASSWORD: ENCRYPTED[!82ed873afdf627284305afef4958c85a8f73127b09978a9786ac521559630ea6c9a5ab6e7f8315abf9ead09b6eff6eae!]
WORKER_NAME_ARM64: dev-mini
WORKER_NAME_AMD64: dev-mini-amd64
task:
name: "Install dependencies ($WORKER_NAME)"
persistent_worker:
labels:
name: $WORKER_NAME
arch: $WORKER_ARCH
resources:
tart-vms: 2
matrix:
- env:
WORKER_NAME: $WORKER_NAME_ARM64
WORKER_ARCH: arm64
- env:
WORKER_NAME: $WORKER_NAME_AMD64
WORKER_ARCH: amd64
install_dependencies_script:
- brew install wget qemu cdrtools ansible
task:
timeout_in: 2h
depends_on:
- "Install dependencies ($WORKER_NAME)"
matrix:
- name: Ubuntu 22.04
env:
VM_NAME: "ubuntu"
VM_RELEASE: "22.04"
WORKER_NAME: $WORKER_NAME_ARM64
VM_ARCH: "arm64"
URL: https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-arm64.img
USER_DATA_FIXTURE: "cloud-init/user-data.distro-with-admin-group"
LATEST: latest
- name: Ubuntu 24.04
env:
VM_NAME: "ubuntu"
VM_RELEASE: "24.04"
WORKER_NAME: $WORKER_NAME_ARM64
VM_ARCH: "arm64"
URL: https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-arm64.img
USER_DATA_FIXTURE: "cloud-init/user-data.distro-with-admin-group"
- name: Debian
env:
VM_NAME: "debian"
VM_RELEASE: "bookworm"
WORKER_NAME: $WORKER_NAME_ARM64
VM_ARCH: "arm64"
URL: https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-arm64.qcow2
USER_DATA_FIXTURE: "cloud-init/user-data.distro-without-admin-group"
LATEST: latest
- name: Fedora
env:
VM_NAME: "fedora"
VM_RELEASE: "39"
WORKER_NAME: $WORKER_NAME_ARM64
VM_ARCH: "arm64"
URL: https://download.fedoraproject.org/pub/fedora/linux/releases/39/Cloud/aarch64/images/Fedora-Cloud-Base-39-1.5.aarch64.qcow2
USER_DATA_FIXTURE: "cloud-init/user-data.distro-without-admin-group"
LATEST: latest
- name: Linux Runner ($VM_ARCH)
env:
VM_NAME: "ubuntu"
VM_RELEASE: "22.04"
matrix:
- VM_ARCH: "arm64"
WORKER_NAME: $WORKER_NAME_ARM64
- VM_ARCH: "amd64"
WORKER_NAME: $WORKER_NAME_AMD64
URL: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-$VM_ARCH.img"
USER_DATA_FIXTURE: "cloud-init/user-data.distro-with-admin-group"
CUSTOMIZATION_PATH: "customizations/linux-runner"
CUSTOMIZATION_IMAGE: "ubuntu-runner-$VM_ARCH"
LATEST: latest
- name: Linux Runner w/ GPU ($VM_ARCH)
depends_on:
- "Linux Runner ($VM_ARCH)"
env:
VM_NAME: "ubuntu"
VM_RELEASE: "22.04"
matrix:
- VM_ARCH: "amd64"
WORKER_NAME: $WORKER_NAME_AMD64
URL: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-$VM_ARCH.img"
USER_DATA_FIXTURE: "cloud-init/user-data.distro-with-admin-group"
CUSTOMIZATION_PATH: "customizations/linux-runner-gpu"
CUSTOMIZATION_IMAGE: "ubuntu-runner-$VM_ARCH-gpu"
LATEST: latest
persistent_worker:
labels:
name: $WORKER_NAME
arch: $VM_ARCH
resources:
tart-vms: 1
env:
QCOW2_IMAGE: image.qcow2
RAW_IMAGE: image.raw
download_cloud_image_disk_script:
- wget -O "$QCOW2_IMAGE" "$URL" || true
convert_cloud_image_disk_script:
- qemu-img convert -p -f qcow2 -O raw "$QCOW2_IMAGE" "$RAW_IMAGE"
generate_cloud_init_image_script:
- echo "local-hostname: $VM_NAME" > cloud-init/meta-data
- cat "$USER_DATA_FIXTURE" > cloud-init/user-data
- mkisofs -output cloud-init.iso -volid cidata -joliet -rock cloud-init/
create_vm_script:
- tart create --linux "$VM_ID"
- mv "$RAW_IMAGE" ~/.tart/vms/"$VM_ID"/disk.img
initialize_vm_script:
- packer init .
- packer build -var vm_name="$VM_ID" .
customize_vm_script:
- '[ -z "$CUSTOMIZATION_PATH" ] && { echo "Nothing to customize"; exit 0; }'
- cd "$CUSTOMIZATION_PATH"
- packer init .
- packer build -var vm_name="$VM_ID" .
info_script: tart get "$VM_ID"
release_without_latest_script:
- '[ -z "$CIRRUS_CRON" ] && { echo "Only release via cron"; exit 0; }'
- '[ ! -z "$LATEST" ] && { echo "Skipping script that releases without latest tag"; exit 0; }'
- export VM_NAME_TO_PUSH="${CUSTOMIZATION_IMAGE:-$VM_NAME}"
- tart push --populate-cache "$VM_ID" ghcr.io/cirruslabs/"$VM_NAME_TO_PUSH":"$VM_RELEASE"
release_with_latest_script:
- '[ -z "$CIRRUS_CRON" ] && { echo "Only release via cron"; exit 0; }'
- '[ -z "$LATEST" ] && { echo "Skipping script that releases with latest tag"; exit 0; }'
- export VM_NAME_TO_PUSH="${CUSTOMIZATION_IMAGE:-$VM_NAME}"
- tart push --populate-cache "$VM_ID" ghcr.io/cirruslabs/"$VM_NAME_TO_PUSH":latest ghcr.io/cirruslabs/"$VM_NAME_TO_PUSH":"$VM_RELEASE"
always:
cleanup_script:
- tart delete "$VM_ID" || true