~sircmpwn/builds.sr.ht

builds.sr.ht/images/debian/build.yml -rw-r--r-- 3.1 KiB
0467110eDrew DeVault qemu: upgrade to 7.0.0 6 days ago
                                                                                
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
image: debian/unstable
packages:
  - debootstrap
  - e2fsprogs
  - qemu-user-static
  - qemu-utils
  - binfmt-support
  - rsync
  - syslinux-common
sources:
  - https://git.sr.ht/~sircmpwn/builds.sr.ht
environment:
  arch: amd64
  release: stable
  slaves:
    - deploy@azusa.runners.sr.ht
    - deploy@yui.runners.sr.ht
secrets:
  - fa00a8d3-7b63-42d5-8060-3bb31c3e3018
triggers:
  - action: email
    condition: failure
    to: Drew DeVault <sir@cmpwn.com>
tasks:
  - genimg: |
      cd builds.sr.ht
      cd images/debian/$release
      case "$arch" in
          arm64)
              qpkg=arm
              ;;
          amd64)
              qpkg=x86
              ;;
          ppc64el)
              qpkg=ppc
              ;;
      esac
      sudo apt install -y qemu-system-"$qpkg"
      sudo ./genimg $arch
  - sanity-check: |
      cd builds.sr.ht
      if [ -e /dev/kvm ] && [ "$(uname -m)" = "x86_64" ] && [ "$arch" = "amd64" ]
      then
          # Debian does not have a kvm group so we just gotta do it this way
          sudo chown build:build /dev/kvm
          MEMORY=1024 ./images/control debian/$release sanity-check
      else
          echo "KVM unavailable, skipping sanity check"
      fi
  - deploy: |
      cd builds.sr.ht/images/debian/$release
      echo "StrictHostKeyChecking=no" >> ~/.ssh/config
      for server in "${slaves[@]}"
      do
        ssh $server mkdir -p /var/lib/images/debian/$release/$arch
        rsync -rzP $arch/root.img.qcow2 \
          ${server}:/var/lib/images/debian/$release/$arch/new_root.img.qcow2
        case "$arch" in
            arm64)
                rsync -rzP $arch/vmlinuz \
                  ${server}:/var/lib/images/debian/$release/$arch/vmlinuz.new
                rsync -rzP $arch/initrd.img \
                  ${server}:/var/lib/images/debian/$release/$arch/initrd.img.new
                ;;
            ppc*)
                rsync -rzP $arch/vmlinux \
                  ${server}:/var/lib/images/debian/$release/$arch/vmlinux.new
                rsync -rzP $arch/initrd.img \
                  ${server}:/var/lib/images/debian/$release/$arch/initrd.img.new
                ;;
        esac
        ssh $server \
          mv /var/lib/images/debian/$release/$arch/new_root.img.qcow2 \
             /var/lib/images/debian/$release/$arch/root.img.qcow2
        case "$arch" in
            arm64)
                ssh $server \
                  mv /var/lib/images/debian/$release/$arch/vmlinuz.new \
                     /var/lib/images/debian/$release/$arch/vmlinuz
                ssh $server \
                  mv /var/lib/images/debian/$release/$arch/initrd.img.new \
                     /var/lib/images/debian/$release/$arch/initrd.img
                ;;
            ppc*)
                ssh $server \
                  mv /var/lib/images/debian/$release/$arch/vmlinux.new \
                     /var/lib/images/debian/$release/$arch/vmlinux
                ssh $server \
                  mv /var/lib/images/debian/$release/$arch/initrd.img.new \
                     /var/lib/images/debian/$release/$arch/initrd.img
                ;;
        esac
      done