diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 857202f9df3b7732f9e5dfc712f3342de96cabe5..e40aefcc5d46b47ebbf22d1ebdf0baf9b262eae8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ variables: default: tags: - - kvm + - electronica2022 image: $DOCKER_IMAGE @@ -21,57 +21,44 @@ stages: before_script: &gitlab_permissions_fixup - chmod -R og-w . - chmod -R a-w overlays/sudo-fqdn + - ln -sf /usr/bin/pigz /bin/gzip script: - - mkdir out - - pushd out && debos -t architecture:${ARCHITECTURE} ../ospack.yaml && popd - - 'echo IMAGE_JOB_ID: \"${CI_JOB_ID}\" | tee -a out/image-build-job.yaml' - - 'echo ARCHITECTURE: \"${ARCHITECTURE}\" | tee -a out/image-build-job.yaml' + - | + BASE=base-rootfs-${ARCHITECTURE}.tar.gz + if [ -f ${BASE} ] ; then + echo "Found cached base rootfs" + DEBOS_OPTIONS="-t base_rootfs:${BASE}" + fi + - "debos ${DEBOS_OPTIONS} -c $(nproc) -t architecture:${ARCHITECTURE} rootfs.yaml" + - 'echo IMAGE_JOB_ID: \"${CI_JOB_ID}\" | tee -a image-build-job.yaml' + - 'echo ARCHITECTURE: \"${ARCHITECTURE}\" | tee -a image-build-job.yaml' + - 'echo VMLINUZ: vmlinuz* | tee -a image-build-job.yaml' + - 'echo INITRD: initrd* | tee -a image-build-job.yaml' + - | + if [ -d dtbs ] ; then + echo DTB_BASE: dtbs/* | tee -a image-build-job.yaml + fi artifacts: paths: - - out/* - -.kernel: - tags: - - lightweight - variables: &kernel_variables - DEBIAN_FRONTEND: noninteractive - GIT_STRATEGY: none - stage: build - script: - - mkdir dist - - "chdist -d dist create apertis https://repositories.apertis.org/apertis/ v2023pre target" - - cp /etc/apt/trusted.gpg.d/apertis-archive-keyring.gpg dist/apertis/etc/apt/trusted.gpg.d/ - - "chdist -d dist -a ${ARCHITECTURE} apt apertis update" - - 'chdist -d dist -a ${ARCHITECTURE} apt apertis download "linux-image-*-${ARCHITECTURE}"' - - dpkg -x *.deb . - - mkdir -p out - - cp -v boot/vmlinuz* out - - if [ -d boot/dtbs ] ; then cp -v boot/dtbs/*/*/*.dtb out ; fi - - depmod -b $(pwd) $(basename $(echo lib/modules/*)) - - tar cvzf out/modules.tar.gz lib/modules - - 'echo VMLINUZ: out/vmlinuz* | tee -a out/kernel-build-job.yaml' - - 'echo KERNEL_JOB_ID: \"${CI_JOB_ID}\" | tee -a out/kernel-build-job.yaml' - artifacts: + - rootfs* + - vmlinuz* + - config* + - initrd* + - dtbs + - image-build-job.yaml + cache: + key: + files: + - base-rootfs.yaml + prefix: ${ARCHITECTURE} paths: - - out/* - -kernel arm64: - extends: .kernel - variables: - ARCHITECTURE: arm64 - <<: *kernel_variables + - base-rootfs-${ARCHITECTURE}.* rootfs arm64: extends: .rootfs variables: ARCHITECTURE: arm64 -kernel amd64: - extends: .kernel - variables: - ARCHITECTURE: amd64 - <<: *kernel_variables - rootfs amd64: extends: .rootfs variables: @@ -79,45 +66,36 @@ rootfs amd64: generate arm64 tests: stage: generate - tags: - - lightweight script: - ./generate_lava_job.py -e DEVICE_TYPE=bcm2711-rpi-4-b - -e DTB=bcm2711-rpi-4-b.dtb + -e DTB=broadcom/bcm2711-rpi-4-b.dtb -e BOOT_METHOD=u-boot - --env-file out/kernel-build-job.yaml - --env-file out/image-build-job.yaml > rpi.yaml + --env-file image-build-job.yaml > rpi.yaml - ./generate_lava_job.py -e DEVICE_TYPE=rk3399-roc-pc - -e DTB=rk3399-roc-pc.dtb + -e DTB=rockchip/rk3399-roc-pc.dtb -e BOOT_METHOD=u-boot - --env-file out/kernel-build-job.yaml - --env-file out/image-build-job.yaml > renegade-elite.yaml + --env-file image-build-job.yaml > renegade-elite.yaml artifacts: paths: - "rpi.yaml" - "renegade-elite.yaml" needs: - "rootfs arm64" - - "kernel arm64" generate amd64 test: stage: generate - tags: - - lightweight script: - ./generate_lava_job.py -e DEVICE_TYPE=aaeon-UPN-EHLX4RE-A10-0864 -e BOOT_METHOD=grub - --env-file out/kernel-build-job.yaml - --env-file out/image-build-job.yaml > up-squared.yaml + --env-file image-build-job.yaml > up-squared.yaml artifacts: paths: - "up-squared.yaml" needs: - "rootfs amd64" - - "kernel amd64" .lavatest: stage: lava diff --git a/ospack.yaml b/base-rootfs.yaml similarity index 81% rename from ospack.yaml rename to base-rootfs.yaml index 777d532db487c99e9184c4846998c0c7ff7f74e4..acf38283418af164e5331d1ee06dfcb3d730827a 100644 --- a/ospack.yaml +++ b/base-rootfs.yaml @@ -4,7 +4,7 @@ {{- $suite := or .suite "v2023pre" -}} {{- $timestamp := or .timestamp "" -}} {{- $snapshot := or .snapshot "" -}} -{{- $ospack := or .ospack (printf "rootfs-%s" $architecture) -}} +{{- $rootfs := or .rootfs (printf "base-rootfs-%s" $architecture) -}} {{- $pack := or .pack "true" -}} {{- $stable := or .stable "" -}} {{- $osname := or .osname "apertis" -}} @@ -118,28 +118,12 @@ actions: description: "Disable systemd-timesyncd service by default" command: systemctl disable systemd-timesyncd - - action: run - description: Create a base kernel-less initramfs - chroot: true - command: mkinitramfs -o /boot/initramfs - - - action: run - chroot: false - command: mv ${ROOTDIR}/boot/initramfs ${ARTIFACTDIR}/{{ $architecture }}-initramfs.gz + - action: apt + packages: + - linux-image-{{ $architecture }} {{- if eq $pack "true" }} - - action: run - description: "Save installed package status" - chroot: false - command: gzip -c "${ROOTDIR}/var/lib/dpkg/status" > "${ARTIFACTDIR}/{{ $ospack }}.pkglist.gz" - - - action: run - description: List files on {{ $ospack }} - chroot: false - script: scripts/list-files "$ROOTDIR" | gzip > "${ARTIFACTDIR}/{{ $ospack }}.filelist.gz" - - - action: pack compression: gz - file: {{ $ospack }}.tar.gz + file: {{ $rootfs }}.tar.gz {{- end }} diff --git a/rootfs.yaml b/rootfs.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3cd9d5967f1f5178e04c6011ed5922f3ddc74385 --- /dev/null +++ b/rootfs.yaml @@ -0,0 +1,34 @@ +{{- $architecture := or .architecture "amd64" }} +{{- $rootfs := or .rootfs (printf "rootfs-%s" $architecture) -}} +{{- $base_rootfs := or .base_rootfs "" -}} +{{- $osname := or .osname "apertis" -}} + +architecture: {{ $architecture }} + +actions: +{{- if eq $base_rootfs "" }} + - action: recipe + recipe: base-rootfs.yaml +{{- else }} + - action: unpack + file: {{ $base_rootfs }} +{{- end }} + + - action: run + chroot: false + command: mv ${ROOTDIR}/boot/* ${ARTIFACTDIR}/ + + - action: run + description: "Save installed package status" + chroot: false + command: gzip -c "${ROOTDIR}/var/lib/dpkg/status" > "${ARTIFACTDIR}/{{ $rootfs }}.pkglist.gz" + + - action: run + description: List files on {{ $rootfs }} + chroot: false + script: scripts/list-files "$ROOTDIR" | gzip > "${ARTIFACTDIR}/{{ $rootfs }}.filelist.gz" + + + - action: pack + compression: gz + file: {{ $rootfs }}.tar.gz diff --git a/testjob.jinja2 b/testjob.jinja2 index 3a08403652229de3b6088f9ad219958e4393826d..77c6bde0fa1e39ba419981509d123177bebe7ef3 100644 --- a/testjob.jinja2 +++ b/testjob.jinja2 @@ -10,7 +10,6 @@ priority: high visibility: public {%- set gitlab_artifacts = '{{job.CI_API_V4_URL}}/projects/{{job.CI_PROJECT_ID}}/jobs/' -%} -{%- set kernel_artifacts = gitlab_artifacts ~ env["KERNEL_JOB_ID"] ~ '/artifacts' -%} {%- set image_artifacts = gitlab_artifacts ~ env["IMAGE_JOB_ID"] ~ '/artifacts' %} actions: @@ -19,28 +18,23 @@ actions: minutes: 2 to: tftp kernel: - url: "{{kernel_artifacts}}/{{env['VMLINUZ']}}" + url: "{{image_artifacts}}/{{env['VMLINUZ']}}" type: image headers: JOB-TOKEN: {{ '{{job.CI_JOB_TOKEN}}' }} - modules: - url: "{{kernel_artifacts}}/out/modules.tar.gz" - compression: gz - headers: - JOB-TOKEN: {{ '{{job.CI_JOB_TOKEN}}' }} {%- if env['DTB'] is defined %} dtb: - url: "{{kernel_artifacts}}/out/{{env['DTB']}}" + url: "{{image_artifacts}}/{{env['DTB_BASE']}}/{{env['DTB']}}" headers: JOB-TOKEN: {{ '{{job.CI_JOB_TOKEN}}' }} {%- endif %} ramdisk: - url: "{{image_artifacts}}/out/{{env['ARCHITECTURE']}}-initramfs.gz" + url: "{{image_artifacts}}/{{env['INITRD']}}" compression: gz headers: JOB-TOKEN: {{ '{{job.CI_JOB_TOKEN}}' }} nfsrootfs: - url: "{{image_artifacts}}/out/rootfs-{{env['ARCHITECTURE']}}.tar.gz" + url: "{{image_artifacts}}/rootfs-{{env['ARCHITECTURE']}}.tar.gz" compression: gz headers: JOB-TOKEN: {{ '{{job.CI_JOB_TOKEN}}' }}