Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspbian helix image #550

Merged
merged 18 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions eng/common/templates/stages/build-test-publish-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ stages:
publicProjectName: ${{ parameters.publicProjectName }}
internalVersionsRepoRef: ${{ parameters.internalVersionsRepoRef }}
publicVersionsRepoRef: ${{ parameters.publicVersionsRepoRef }}
- template: ../jobs/build-images.yml
parameters:
name: Linux_arm32v6
pool: ${{ parameters.linuxArm32Pool }}
matrix: dependencies.GenerateBuildMatrix.outputs['matrix.LinuxArm32v6']
dockerClientOS: linux
buildJobTimeout: ${{ parameters.linuxArmBuildJobTimeout }}
customInitSteps: ${{ parameters.customBuildInitSteps }}
noCache: ${{ parameters.noCache }}
internalProjectName: ${{ parameters.internalProjectName }}
publicProjectName: ${{ parameters.publicProjectName }}
internalVersionsRepoRef: ${{ parameters.internalVersionsRepoRef }}
publicVersionsRepoRef: ${{ parameters.publicVersionsRepoRef }}
- template: ../jobs/build-images.yml
parameters:
name: Linux_arm32v7
Expand Down Expand Up @@ -225,6 +238,13 @@ stages:
matrix: dependencies.GenerateTestMatrix.outputs['matrix.LinuxArm64v8']
testJobTimeout: ${{ parameters.linuxArmTestJobTimeout }}
internalProjectName: ${{ parameters.internalProjectName }}
- template: ../jobs/test-images-linux-client.yml
parameters:
name: Linux_arm32v6
pool: ${{ parameters.linuxArm32Pool }}
matrix: dependencies.GenerateTestMatrix.outputs['matrix.LinuxArm32v6']
testJobTimeout: ${{ parameters.linuxArmTestJobTimeout }}
internalProjectName: ${{ parameters.internalProjectName }}
- template: ../jobs/test-images-linux-client.yml
parameters:
name: Linux_arm32v7
Expand Down
26 changes: 26 additions & 0 deletions eng/pipelines/dotnet-buildtools-prereqs-raspbian-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
trigger: none
pr:
branches:
include:
- main
paths:
include:
- src/raspbian/*

resources:
repositories:
- repository: PublicVersionsRepo
type: github
endpoint: dotnet
name: dotnet/versions

variables:
- template: variables/common.yml
- name: imageBuilder.pathArgs
value: --path 'src/raspbian/*'

stages:
- template: ../common/templates/stages/dotnet/build-test-publish-repo.yml
parameters:
internalProjectName: ${{ variables.internalProjectName }}
publicProjectName: ${{ variables.publicProjectName }}
26 changes: 26 additions & 0 deletions eng/pipelines/dotnet-buildtools-prereqs-raspbian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
trigger:
branches:
include:
- main
paths:
include:
- src/raspbian/*

pr: none

resources:
repositories:
- repository: InternalVersionsRepo
type: git
name: internal/dotnet-versions

variables:
- template: variables/common.yml
- name: imageBuilder.pathArgs
value: --path 'src/raspbian/*'

stages:
- template: ../common/templates/stages/dotnet/build-test-publish-repo.yml
parameters:
internalProjectName: ${{ variables.internalProjectName }}
publicProjectName: ${{ variables.publicProjectName }}
2 changes: 1 addition & 1 deletion eng/pipelines/steps/install-cross-build-prereqs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
steps:
- script: ./$(buildRepoName)/src/ubuntu/build-scripts/install-cross-build-prereqs.sh
displayName: Install Cross Build Pre-Reqs
condition: and(succeeded(), contains(variables.imageBuilderPaths, '/cross'))
condition: and(succeeded(), contains(variables.imageBuilderPaths, '/cross'), not(contains(variables.imageBuilderPaths, '/raspbian')))
3 changes: 2 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"src/fedora/manifest.json",
"src/nanoserver/manifest.json",
"src/opensuse/manifest.json",
"src/raspbian/manifest.json",
"src/ubuntu/manifest.json",
"src/windowsservercore/manifest.json"
]
}
}
12 changes: 12 additions & 0 deletions src/raspbian/10/crossdeps/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM arm32v7/ubuntu:18.04

# Install the base toolchain we need to build anything (clang, cmake, make and the like).
RUN apt-get update \
&& apt-get install -y \
apt-transport-https \
ca-certificates \
debootstrap \
git \
qemu \
qemu-user-static \
&& rm -rf /var/lib/apt/lists/*
66 changes: 66 additions & 0 deletions src/raspbian/10/helix/arm32v6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# dummy F R O M to establish a dependency
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:raspbian-10-crossdeps

FROM scratch

# There doesn't seem to be an official Raspberry Pi OS Docker image
# But we can use a crossrootfs from our image generation scripts, and
# extract into the image root

ADD rootfs.armv6.tar /

ENV _PYTHON_HOST_PLATFORM=linux_armv6l

# Install Helix Dependencies

RUN apt-get update && \
apt-get install -y \
autoconf \
automake \
at \
build-essential \
ca-certificates \
curl \
gcc \
gdb \
git \
iputils-ping \
libcurl4 \
libffi-dev \
libgdiplus \
libicu-dev \
libssl-dev \
libtool \
libunwind8 \
locales \
locales-all \
python3-dev \
python3-pip \
sudo \
tzdata \
unzip \
&& rm -rf /var/lib/apt/lists/* \
&& c_rehash \
\
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

ENV LANG=en_US.utf8

RUN ln -sf /usr/bin/python3 /usr/bin/python && \
curl https://bootstrap.pypa.io/get-pip.py -o ./get-pip.py --fail --silent --show-error && \
python ./get-pip.py && rm ./get-pip.py && \
python -m pip install --upgrade pip==20.2 && \
python -m pip install virtualenv==16.6.0 && \
pip download --no-deps helix-scripts --index-url https://dnceng.pkgs.visualstudio.com/public/_packaging/helix-client-prod/pypi/simple && \
export CRYPTOGRAPHY_DONT_BUILD_RUST=1 && \
pip install ./helix_scripts-*-py3-none-any.whl

# Create helixbot user and give rights to sudo without password
# additionally, preinstall the virtualenv packages used for VSTS reporting to save time
RUN /usr/sbin/adduser --disabled-password --gecos '' --uid 1001 --shell /bin/bash --ingroup adm helixbot && \
chmod 755 /root && \
echo "helixbot ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers

USER helixbot

RUN python -m virtualenv --no-site-packages /home/helixbot/.vsts-env
1 change: 1 addition & 0 deletions src/raspbian/10/helix/arm32v6/hooks/post-build
5 changes: 5 additions & 0 deletions src/raspbian/10/helix/arm32v6/hooks/pre-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh

SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
$SCRIPTPATH/../../../../../ubuntu/build-scripts/build-rootfs.sh raspbian-10 raspbian armv6 "" "" true
41 changes: 41 additions & 0 deletions src/raspbian/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"repos": [
{
"name": "dotnet-buildtools/prereqs",
"images": [
{
"platforms": [
{
"architecture": "arm",
"dockerfile": "src/raspbian/10/crossdeps",
"os": "linux",
"osVersion": "buster",
"tags": {
"raspbian-10-crossdeps-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {},
"raspbian-10-crossdeps": {
"isLocal": true
}
},
"variant": "v6"
}
]
},

{
"platforms": [
{
"architecture": "arm",
"dockerfile": "src/raspbian/10/helix/arm32v6",
"os": "linux",
"osVersion": "buster",
"tags": {
"raspbian-10-helix-arm32v6-$(System:TimeStamp)-$(System:DockerfileGitCommitSha)": {}
},
"variant": "v6"
}
]
}
]
}
]
}
11 changes: 9 additions & 2 deletions src/ubuntu/build-scripts/build-rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ crossToolset=$2
archArg=${3:-}
lldb=${4:-}
rootfsBinDirArg=${5:-}
bypassArchDirArg=${6:-}

dockerCrossDepsTag="${DOCKER_REPO:-mcr.microsoft.com/dotnet-buildtools/prereqs}:${os}-crossdeps"

Expand All @@ -19,6 +20,12 @@ arch=${archArg:-'arm'}
# If argument five was set, use that as the rootfsBinDir, otherwise use default : '/rootfs/$arch/bin'
rootfsBinDir="${rootfsBinDirArg:-"/rootfs/$arch/bin"}"

if [ -z "${bypassArchDirArg}" ]; then
rootfsBaseDir="/rootfs"
else
rootfsBaseDir="/rootfs/${arch}"
fi

rm -rf $PWD/rootfs.$arch.tar

echo "Using $dockerCrossDepsTag to set up cross-toolset for $arch for $crossToolset"
Expand Down Expand Up @@ -69,10 +76,10 @@ docker exec $buildRootFSContainer \

echo "Tarring rootfs"
docker exec $buildRootFSContainer \
tar Ccf /rootfs - . > $PWD/rootfs.$arch.tar
tar Ccf ${rootfsBaseDir} - . > $PWD/rootfs.$arch.tar

if [ $? -ne 0 ]; then
echo "Rootfs build failed: 'tar Ccf /rootfs - .' returned error"
echo "Rootfs build failed: 'tar Ccf ${rootfsBaseDir} - .' returned error"
docker rm -f $buildRootFSContainer
exit 1
fi
Expand Down