this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Build Darling on a faster private CI machine

This machine is not always available, but when it is,
it's much faster (about 5-10 mins) than both the
GitHub Actions CI (3+ hours) and the old private CI machine (1+ hour).

+46 -128
+17
ci/Dockerfile
··· 1 + # this Dockerfile must be built using the following command: 2 + # docker build -f ../ci/Dockerfile . 3 + # this command must be run while in the `debian` directory in the root of the repo. 4 + FROM ubuntu:jammy 5 + LABEL name=darling-build-image version=0.1.0 6 + ARG DEBIAN_FRONTEND="noninteractive" 7 + RUN cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list && sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list 8 + RUN apt-get -y update 9 + RUN apt-get -y install cmake clang bison flex libfuse-dev libudev-dev pkg-config libc6-dev-i386 gcc-multilib libcairo2-dev libgl1-mesa-dev libglu1-mesa-dev libtiff5-dev libfreetype6-dev git git-lfs libelf-dev libxml2-dev libegl1-mesa-dev libfontconfig1-dev libbsd-dev libxrandr-dev libxcursor-dev libgif-dev libavutil-dev libpulse-dev libavformat-dev libavcodec-dev libswresample-dev libdbus-1-dev libxkbfile-dev libssl-dev python2 llvm-dev libvulkan-dev && apt clean -y 10 + RUN apt-get -y install lsb-release lsb-core && apt clean -y 11 + RUN groupadd -g 1001 ci 12 + RUN useradd -u 1001 -g 1001 -m ci 13 + RUN apt-get -y install devscripts equivs debhelper && apt clean -y 14 + COPY control /control 15 + RUN mk-build-deps -i -r -t "apt-get --no-install-recommends -y" /control && apt clean -y 16 + RUN rm /control 17 + USER ci
+29 -128
ci/Jenkinsfile
··· 1 1 pipeline { 2 - agent any 2 + agent { 3 + docker { 4 + image 'registry.git.facekapow.dev/darling-build-image:latest' 5 + registryUrl 'https://registry.git.facekapow.dev' 6 + alwaysPull true 7 + args '-u ci:ci' 8 + label 'darling' 9 + } 10 + } 3 11 4 12 triggers { 5 13 githubPush() ··· 8 16 environment { 9 17 DEB_DISTRO = sh(script: 'lsb_release -cs', returnStdout: true).trim() 10 18 ESCAPED_JOB_NAME = sh(script: 'echo "${JOB_NAME}" | sed \'s/\\//-/g\'', returnStdout: true).trim() 11 - REAL_WORKSPACE = "/home/jenkins/workspace/${JOB_BASE_NAME}/${JOB_NAME}" 12 19 } 13 20 14 21 options { 15 22 skipDefaultCheckout() 23 + disableConcurrentBuilds abortPrevious: true 16 24 } 17 25 18 26 stages { 19 27 stage('Start Job') { 20 28 steps { 21 - dir("${REAL_WORKSPACE}") { 22 - scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*') 23 - 24 - dir('source') { 25 - checkout scm 26 - } 27 - 28 - script { 29 - def buildNumber = env.BUILD_NUMBER as int 30 - if (buildNumber > 1) milestone(buildNumber - 1) 31 - milestone(buildNumber) 32 - 33 - while (fileExists('.job-running')) { 34 - sleep 1 35 - } 36 - } 29 + scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*') 37 30 38 - touch '.job-running' 31 + dir('source') { 32 + checkout scm 39 33 } 40 34 } 41 35 } 42 36 43 - stage('Workspace Setup') { 44 - when { 45 - not { 46 - expression { 47 - return fileExists("${REAL_WORKSPACE}/.workspace-setup") 48 - } 49 - } 50 - } 51 - 37 + stage('Build') { 52 38 steps { 53 - dir("${REAL_WORKSPACE}") { 54 - sh 'virt-clone --connect qemu:///system --original dtest-base --name dtest-${ESCAPED_JOB_NAME} --auto-clone --mac RANDOM' 55 - touch '.vm-cloned' 56 - 57 - sh 'virsh --connect qemu:///system snapshot-create-as --domain dtest-${ESCAPED_JOB_NAME} --name before-darling' 58 - touch '.vm-snapshotted' 39 + dir('source') { 40 + sh 'git submodule update --init --recursive' 41 + sh 'cd src/external/swift && git lfs install && git lfs pull' 42 + touch '../.submodules-cloned' 59 43 60 - touch '.workspace-setup' 44 + //sh 'tools/debian/make-deb --dsc' 45 + sh 'tools/debian/make-deb' 61 46 } 62 - } 63 - } 64 47 65 - stage('Build') { 66 - steps { 67 - dir("${REAL_WORKSPACE}") { 68 - dir('source') { 69 - sh 'git submodule update --init --recursive' 70 - sh 'cd src/external/swift && git lfs install && git lfs pull' 71 - touch '../.submodules-cloned' 48 + sh 'rm -rf out' 49 + sh 'mkdir out' 72 50 73 - //sh 'tools/debian/make-deb --dsc' 74 - sh 'tools/debian/make-deb' 75 - } 76 - 77 - sh 'rm -rf out' 78 - sh 'mkdir out' 79 - 80 - dir('out') { 81 - sh 'mv ../*.deb ./' 82 - sh 'rm ../*.*' 83 - } 84 - 85 - archiveArtifacts artifacts: 'out/**/*', fingerprint: true 51 + dir('out') { 52 + sh 'mv ../*.deb ./' 53 + sh 'rm ../*.*' 86 54 } 87 - } 88 - } 89 55 90 - stage('Test') { 91 - steps { 92 - dir("${REAL_WORKSPACE}") { 93 - sh 'virsh --connect qemu:///system start dtest-${ESCAPED_JOB_NAME}' 94 - touch '.vm-running' 95 - 96 - script { 97 - def vmIP = "" 98 - waitUntil { 99 - vmIP = sh(script: 'virtip dtest-${ESCAPED_JOB_NAME}', returnStdout: true) 100 - return vmIP != "" 101 - } 102 - vmIP = vmIP.trim() 103 - 104 - def remote = [:] 105 - remote.name = 'dtest-box' 106 - remote.host = vmIP 107 - remote.user = 'dtest' 108 - remote.password = 'dtest' 109 - remote.allowAnyHosts = true 110 - remote.retryCount = 5 111 - remote.retryWaitSec = 2 112 - 113 - sshPut remote: remote, from: 'out', into: '.' 114 - 115 - sshCommand remote: remote, command: 'echo dtest | sudo -S apt install -y ./out/darling_*.deb' 116 - 117 - // the initial shell must be in a screen because the pty is handed to launchd and ssh will stay connected 118 - // even after the shell exits because launchd is still using the pty. 119 - // 120 - // if the command fails, we'll know when we run our next command (if it did fail, that means Darling is failing to run 121 - // so launchd won't be holding on to the pty) 122 - sshCommand remote: remote, command: 'screen -d -m darling shell' 123 - sleep 5 // give Darling some time to initialize 124 - 125 - // if this doesn't report back within 3 minutes, something's definitely broken in Darling, so stop the testing early 126 - timeout(time: 180, unit: 'SECONDS') { 127 - sshCommand remote: remote, command: 'darling shell echo hi' 128 - } 129 - } 130 - } 56 + archiveArtifacts artifacts: 'out/**/*', fingerprint: true 131 57 } 132 58 } 133 59 } 134 60 135 61 post { 136 62 cleanup { 137 - dir("${REAL_WORKSPACE}") { 138 - script { 139 - if (fileExists('.vm-running')) { 140 - // try to shut it down normally 141 - sh 'virsh --connect qemu:///system shutdown dtest-${ESCAPED_JOB_NAME}' 142 - try { 143 - retry(5) { 144 - sleep 1 145 - def isRunning = sh(script: 'virsh --connect qemu:///system list --all | grep " dtest-${ESCAPED_JOB_NAME} " | awk \'{ print $3}\'', returnStdout: true).trim() 146 - if (isRunning != "" && isRunning == "running") { 147 - throw new Exception("VM not shutdown yet") 148 - } 149 - } 150 - } catch (Exception e) { 151 - // force shut it down 152 - sh 'virsh --connect qemu:///system destroy dtest-${ESCAPED_JOB_NAME}' 153 - } 154 - 155 - sh 'virsh --connect qemu:///system snapshot-revert --domain dtest-${ESCAPED_JOB_NAME} --snapshotname before-darling' 156 - 157 - sh 'rm .vm-running' 158 - } 159 - 160 - if (!fileExists('.submodules-cloned')) { 161 - sh 'rm -rf source' 162 - } 63 + script { 64 + if (!fileExists('.submodules-cloned')) { 65 + sh 'rm -rf source' 163 66 } 164 - 165 - sh 'rm .job-running' 166 67 } 167 68 } 168 69 }