On 11/04/2025 4:53 pm, Denis Mukhin wrote:
> On Friday, April 11th, 2025 at 3:52 AM, Andrew Cooper 
> <andrew.coop...@citrix.com> wrote:
>
>>
>> Rename the script as we're going to use it for ARM64 shortly, and have it 
>> take
>> a tar or cpio parameter to determine the output format.
>>
>> Turn it into a proper bash script, and provide the cpio form under the new
>> artefact naming scheme.
>>
>> No functional change.
>>
>> Signed-off-by: Andrew Cooper andrew.coop...@citrix.com
>>
>> ---
>> CC: Anthony PERARD anthony.per...@vates.tech
>>
>> CC: Stefano Stabellini sstabell...@kernel.org
>>
>> CC: Michal Orzel michal.or...@amd.com
>>
>> CC: Doug Goldstein car...@cardoe.com
>>
>> CC: Marek Marczykowski-Górecki marma...@invisiblethingslab.com
>>
>> ---
>> .gitlab-ci.yml | 9 +++++++-
>> ...6_64-rootfs-alpine.sh => alpine-rootfs.sh} | 21 +++++++++++++++++--
>>
>> 2 files changed, 27 insertions(+), 3 deletions(-)
>> rename scripts/{x86_64-rootfs-alpine.sh => alpine-rootfs.sh} (75%)
>>
>>
>> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
>> index 1d2c72b268a3..916c5ae9d508 100644
>> --- a/.gitlab-ci.yml
>> +++ b/.gitlab-ci.yml
>> @@ -42,6 +42,13 @@ linux-6.6.86-arm64:
>> #
>> # x86_64 artifacts
>> #
>> +alpine-3.18-x86_64-rootfs:
>> + extends: .x86_64-artifacts
>> + script:
>> + - ./scripts/alpine-rootfs.sh cpio
>> + variables:
>> + CONTAINER: alpine:3.18-x86_64-base
>> +
>> linux-6.6.56-x86_64:
>> extends: .x86_64-artifacts
>> script: ./scripts/build-linux.sh
>> @@ -62,7 +69,7 @@ x86_64-kernel-linux-6.6.56:
>> x86_64-rootfs-alpine-3.18:
>> extends: .x86_64-artifacts
>> script:
>> - - . scripts/x86_64-rootfs-alpine.sh
>> + - ./scripts/alpine-rootfs.sh tar
>> variables:
>> CONTAINER: alpine:3.18-x86_64-base
>>
>> diff --git a/scripts/x86_64-rootfs-alpine.sh b/scripts/alpine-rootfs.sh
>> similarity index 75%
>> rename from scripts/x86_64-rootfs-alpine.sh
>> rename to scripts/alpine-rootfs.sh
>> index b70b3a54ede5..c29c92d1c682 100755
>> --- a/scripts/x86_64-rootfs-alpine.sh
>> +++ b/scripts/alpine-rootfs.sh
>> @@ -1,4 +1,9 @@
>> +#!/bin/bash
>> +
>> +set -eu
>> +
>> WORKDIR="${PWD}"
>> +COPYDIR="${WORKDIR}/binaries"
>>
>> apk update
>>
>> @@ -56,5 +61,17 @@ passwd -d "root" root
>>
>> # Create rootfs
>> cd /
>> -tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \
>> - bin dev etc home init lib mnt opt root sbin usr var
>> +PATHS="bin dev etc home init lib mnt opt root sbin usr var"
>> +
>> +case $1 in
>> + cpio)
>> + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz"
>>
>> +
>> + # Print the contents for the build log
>> + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
> Maybe allow $1 to be a filename? E. g. rootfs.cpio.gz or initrd.tar.gz.
> This way $1 will contain an explicit output artifact format along with
> the output filename.
>
> What do you think?
>
>> + ;;
>> +
>> + tar)
>> + tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS
>> + ;;
> I would add the default case and error out in case of possible mis-use.

This is bespoke tooling, used as part of Xen's GitlabCI infrastructure.

The parameter is going to last for all of about a week, until we can
retire the tests using the tarball, because they're creating routine but
intermittent test failure.

I'm not looking to over-engineer the result.

~Andrew

Reply via email to