dustin
/
jenkinsagent
Archived
1
0
Fork 0

ci: Begin CI pipeline

master
Dustin 2022-03-15 15:42:46 -05:00
parent 4e05173ae1
commit 16a06d7637
7 changed files with 147 additions and 0 deletions

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
BUILDROOT_SRC ?= ~/src/buildroot
.PHONY: all
all: initramfs rootfs
.PHONY: rootfs
rootfs: _build/rootfs/.config
$(MAKE) -C _build/rootfs -j $(shell nproc)
.PHONY: initramfs
initramfs: _build/initramfs/.config
$(MAKE) -C _build/initramfs -j $(shell nproc)
.PHONY: publish
publish:
rsync -rtliO \
_build/rootfs/images/rpi-firmware/ \
_build/rootfs/images/Image \
_build/rootfs/images/*.dtb \
_build/initramfs/images/rootfs.cpio.lz4 \
pxe0.pyrocufflink.blue:/var/lib/tftpboot/jenkinsagent-aarch64/
rsync -P --no-W \
_build/rootfs/images/rootfs.squashfs \
pxe0.pyrocufflink.blue:/var/lib/nbd/jenkinsagent-aarch64.squashfs
_build/rootfs/.config:
$(MAKE) -C $(BUILDROOT_SRC) O=${PWD}/_build/rootfs BR2_EXTERNAL=${PWD} jenkinsagent_defconfig
_build/initramfs/.config:
$(MAKE) -C $(BUILDROOT_SRC) O=${PWD}/_build/initramfs BR2_EXTERNAL=${PWD} jenkinsagent_initramfs_defconfig

25
ci/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM registry.fedoraproject.org/fedora:30
ARG UID
ARG GID
RUN groupadd -g ${GID} jenkins \
&& useradd -u ${UID} -g ${GID} -m -d /var/lib/jenkins -l jenkins
RUN dnf install -y \
bc \
bzip2 \
cpio \
diffutils \
g++ \
gcc \
make \
ncurses-devel \
openssh-clients \
patch \
perl-ExtUtils-MakeMaker \
perl-Thread-Queue \
rsync \
wget \
which \
&& dnf clean all

82
ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,82 @@
pipeline {
agent {
dockerfile {
dir 'ci'
args '''
-v /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts
--pids-limit 16384
'''
additionalBuildArgs '''\
--build-arg UID=$(id -u) \
--build-arg GID=$(id -g) \
'''
}
}
options {
disableConcurrentBuilds()
}
triggers {
pollSCM ''
}
parameters {
booleanParam \
name: 'Clean',
description: 'Clean the workspace and perform a full rebuild'
}
environment {
BUILDROOT_SRC = "${env.WORKSPACE}/buildroot"
}
stages {
stage('Prepare') {
steps {
script {
if (params.Clean) {
sh 'rm -rf _build'
}
}
checkout poll: false, scm: [
$class: 'GitSCM',
branches: [[name: '2022.02.x']],
doGenerateSubmoduleConfigurations: false,
userRemoteConfigs: [[url: 'git://git.buildroot.net/buildroot']],
extensions: [
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: 'buildroot',
],
],
]
sh '. ci/prepare.sh'
}
}
stage('Build') {
parallel {
stage('Build Initramfs') {
steps {
sh '. ci/build-initramfs.sh'
}
}
stage('Build Rootfs') {
steps {
sh '. ci/build-rootfs.sh'
}
}
}
}
stage('Publish') {
steps {
sshagent(['jenkins-pxe']) {
sh '. ci/publish.sh'
}
}
}
}
}

3
ci/build-initramfs.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
make initramfs

3
ci/build-rootfs.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
make rootfs

1
ci/prepare.sh Normal file
View File

@ -0,0 +1 @@
#!/bin/sh

3
ci/publish.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
make publish