-
Notifications
You must be signed in to change notification settings - Fork 28
/
.gitlab-ci.yml
90 lines (83 loc) · 3.36 KB
/
.gitlab-ci.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
image: debian:stretch
build:
stage: build
before_script:
- apt-get update -y
- DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retires=10 install --no-install-recommends -qq libguestfs-tools busybox linux-image-amd64 gnupg1 openssh-client
- ssh-keygen -q -N '' -f ~/.ssh/id_rsa
script:
- curl -fOL https://cdimage.debian.org/cdimage/cloud/buster/latest/debian-10-nocloud-amd64.qcow2
- 'LIBGUESTFS_BACKEND=direct virt-customize -a debian-10-nocloud-amd64.qcow2 --root-password password:root --ssh-inject root --install wget,ca-certificates --firstboot-command "dpkg-reconfigure -f noninteractive openssh-server"'
after_script:
- mv ~/.ssh/id_rsa id_rsa
cache:
paths:
- debian-10-nocloud-amd64.qcow2
- id_rsa
policy: push
.tests:
retry: 1
stage: test
before_script:
- apt-get update -y
- DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retires=10 install --no-install-recommends -qq qemu-system-x86 openssh-client sshpass
- mkdir ~/.ssh
- mv id_rsa ~/.ssh/id_rsa
- printf '%s\n\t' 'Host *' 'ServerAliveInterval 15' 'UserKnownHostsFile /dev/null' 'StrictHostKeyChecking no' 'CheckHostIP no' > ~/.ssh/config
- qemu-system-x86_64 -m 256 -daemonize -drive file=debian-10-nocloud-amd64.qcow2,if=virtio -net nic -net user,hostfwd=tcp::10022-:22 -display none -vga none -serial file:/tmp/serial
- 'tail -f /tmp/serial &'
- sleep 120
- scp -P 10022 vps2arch [email protected]:vps2arch
- ssh -p 10022 [email protected] "chmod +x vps2arch"
dependencies:
- build
cache:
paths:
- debian-10-nocloud-amd64.qcow2
- id_rsa
policy: pull
.tests_uefi:
retry: 1
stage: test
before_script:
- apt-get update -y
- DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retires=10 install --no-install-recommends -qq qemu-system-x86 openssh-client ovmf sshpass
- mkdir ~/.ssh
- mv id_rsa ~/.ssh/id_rsa
- printf '%s\n\t' 'Host *' 'ServerAliveInterval 15' 'UserKnownHostsFile /dev/null' 'StrictHostKeyChecking no' 'CheckHostIP no' > ~/.ssh/config
- qemu-system-x86_64 -m 256 -daemonize -bios /usr/share/OVMF/OVMF_CODE.fd -drive file=debian-10-nocloud-amd64.qcow2,if=virtio -net nic -net user,hostfwd=tcp::10022-:22 -display none -vga none -serial file:/tmp/serial
- 'tail -f /tmp/serial &'
- sleep 120
- scp -P 10022 vps2arch [email protected]:vps2arch
- ssh -p 10022 [email protected] "chmod +x vps2arch"
dependencies:
- build
cache:
paths:
- debian-10-nocloud-amd64.qcow2
- id_rsa
policy: pull
test_default:
extends: .tests
script:
- 'ssh -p 10022 [email protected] "./vps2arch && sync ; reboot -f" || true'
- sleep 600
- sshpass -proot ssh -p 10022 [email protected] test -f /etc/arch-release
test_netctl:
extends: .tests
script:
- 'ssh -p 10022 [email protected] "./vps2arch -n netctl && sync ; reboot -f" || true'
- sleep 600
- sshpass -proot ssh -p 10022 [email protected] test -f /etc/arch-release
test_syslinux:
extends: .tests
script:
- 'ssh -p 10022 [email protected] "./vps2arch -b syslinux && sync ; reboot -f" || true'
- sleep 600
- sshpass -proot ssh -p 10022 [email protected] test -f /etc/arch-release
test_default_uefi:
extends: .tests_uefi
script:
- 'ssh -p 10022 [email protected] "./vps2arch && sync ; reboot -f" || true'
- sleep 600
- sshpass -proot ssh -p 10022 [email protected] test -f /etc/arch-release