-
-
Notifications
You must be signed in to change notification settings - Fork 48
[CI] Fix multiarch builds #1409
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
Merged
Merged
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2740ba5
Build multiarch image as part of the pipeline, try to run multiarch b…
50dcf52
Add builder dockerfile
65645c4
Changed order
8833ed7
fix qemu binary permissions
b9dac74
Fix conditional
ed5f558
Fixed path
7d21f8c
Refactor
af41e66
Fix param reference
542e996
Debug
adb9ee0
Debug
ddbe91e
Debug
152e29b
Debug
3a6dfae
Fix tag reference
dcb893c
Downgrade core to v0.16.0
c390425
Install qemu under jenkins uid
426aca3
Fix typo
fe05d40
Declare deps in Dockerfile
2ebf1ff
Debug
d9771a6
Debug
762122b
Debug
58d2581
Debug
aa64142
Cleanup, revert comments
2fa6598
Revert change to core package
6f50399
Revert to old docker image, uncomment tests
9e339af
Fix build deps
971ab4c
Unify params
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,8 @@ pipeline { | |
description: "Math PR to test against. Will check out this PR in the downstream Math repo.") | ||
string(defaultValue: '', name: 'stanc_flags', | ||
description: "Pass STANCFLAGS to make/local, default none") | ||
booleanParam(defaultValue: false, name: 'build_multiarch_docker', description: 'Build docker image for multiarch builds') | ||
string(defaultValue: '', name: 'build_multiarch_docker_tag', description: "Docker tag for the multiarch image") | ||
} | ||
options { | ||
parallelsAlwaysFailFast() | ||
|
@@ -100,6 +102,7 @@ pipeline { | |
GIT_AUTHOR_EMAIL = '[email protected]' | ||
GIT_COMMITTER_NAME = 'Stan Jenkins' | ||
GIT_COMMITTER_EMAIL = '[email protected]' | ||
MULTIARCH_DOCKER_TAG = 'multiarch-ocaml-4.14' | ||
} | ||
stages { | ||
stage('Verify changes') { | ||
|
@@ -588,6 +591,51 @@ pipeline { | |
} | ||
} | ||
|
||
stage('Build and push multiarch docker image') { | ||
when { | ||
beforeAgent true | ||
expression { | ||
params.build_multiarch_docker | ||
} | ||
} | ||
agent { | ||
dockerfile { | ||
filename 'scripts/docker/builder/Dockerfile' | ||
dir '.' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
} | ||
environment { DOCKER_TOKEN = credentials('aada4f7b-baa9-49cf-ac97-5490620fce8a') } | ||
steps { | ||
script { | ||
retry(3) { checkout scm } | ||
sh ''' | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
|
||
docker buildx create --name stanc3_builder | ||
docker buildx use stanc3_builder | ||
|
||
docker login --username stanorg --password "${DOCKER_TOKEN}" | ||
|
||
cd scripts/docker/multiarch | ||
|
||
docker buildx build -t stanorg/stanc3:$build_multiarch_docker_tag \ | ||
--platform linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/mips64le,linux/s390x \ | ||
--build-arg PUID=$(id -u) \ | ||
--build-arg PGID=$(id -g) \ | ||
--progress=plain --push . | ||
''' | ||
} | ||
} | ||
post { | ||
always { | ||
deleteDir() | ||
} | ||
} | ||
} | ||
|
||
|
||
stage('Build binaries') { | ||
parallel { | ||
|
@@ -692,17 +740,18 @@ pipeline { | |
dockerfile { | ||
filename 'scripts/docker/static/Dockerfile' | ||
dir '.' | ||
label 'linux' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
} | ||
steps { | ||
dir("${env.WORKSPACE}/linux-mips64el"){ | ||
cleanCheckout() | ||
|
||
sh """ | ||
eval \$(opam env) | ||
bash -x scripts/build_multiarch_stanc3.sh mips64el | ||
bash -x scripts/build_multiarch_stanc3.sh mips64el ${MULTIARCH_DOCKER_TAG} | ||
""" | ||
|
||
sh "mkdir -p bin && mv `find _build -name stanc.exe` bin/linux-mips64el-stanc" | ||
|
@@ -725,7 +774,7 @@ pipeline { | |
dockerfile { | ||
filename 'scripts/docker/static/Dockerfile' | ||
dir '.' | ||
label 'linux' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
|
@@ -735,7 +784,7 @@ pipeline { | |
cleanCheckout() | ||
sh """ | ||
eval \$(opam env) | ||
bash -x scripts/build_multiarch_stanc3.sh ppc64el | ||
bash -x scripts/build_multiarch_stanc3.sh ppc64el ${MULTIARCH_DOCKER_TAG} | ||
""" | ||
sh "mkdir -p bin && mv `find _build -name stanc.exe` bin/linux-ppc64el-stanc" | ||
stash name:'linux-ppc64el-exe', includes:'bin/*' | ||
|
@@ -756,7 +805,7 @@ pipeline { | |
dockerfile { | ||
filename 'scripts/docker/static/Dockerfile' | ||
dir '.' | ||
label 'linux' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
|
@@ -766,7 +815,7 @@ pipeline { | |
cleanCheckout() | ||
sh """ | ||
eval \$(opam env) | ||
bash -x scripts/build_multiarch_stanc3.sh s390x | ||
bash -x scripts/build_multiarch_stanc3.sh s390x ${MULTIARCH_DOCKER_TAG} | ||
""" | ||
sh "mkdir -p bin && mv `find _build -name stanc.exe` bin/linux-s390x-stanc" | ||
stash name:'linux-s390x-exe', includes:'bin/*' | ||
|
@@ -787,7 +836,7 @@ pipeline { | |
dockerfile { | ||
filename 'scripts/docker/static/Dockerfile' | ||
dir '.' | ||
label 'linux' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
|
@@ -797,7 +846,7 @@ pipeline { | |
cleanCheckout() | ||
sh """ | ||
eval \$(opam env) | ||
bash -x scripts/build_multiarch_stanc3.sh arm64 | ||
bash -x scripts/build_multiarch_stanc3.sh arm64 ${MULTIARCH_DOCKER_TAG} | ||
""" | ||
sh "mkdir -p bin && mv `find _build -name stanc.exe` bin/linux-arm64-stanc" | ||
stash name:'linux-arm64-exe', includes:'bin/*' | ||
|
@@ -818,7 +867,7 @@ pipeline { | |
dockerfile { | ||
filename 'scripts/docker/static/Dockerfile' | ||
dir '.' | ||
label 'linux' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
|
@@ -828,7 +877,7 @@ pipeline { | |
cleanCheckout() | ||
sh """ | ||
eval \$(opam env) | ||
bash -x scripts/build_multiarch_stanc3.sh armhf | ||
bash -x scripts/build_multiarch_stanc3.sh armhf ${MULTIARCH_DOCKER_TAG} | ||
""" | ||
sh "mkdir -p bin && mv `find _build -name stanc.exe` bin/linux-armhf-stanc" | ||
stash name:'linux-armhf-exe', includes:'bin/*' | ||
|
@@ -849,7 +898,7 @@ pipeline { | |
dockerfile { | ||
filename 'scripts/docker/static/Dockerfile' | ||
dir '.' | ||
label 'linux' | ||
label 'linux && triqs' | ||
args '--group-add=987 --group-add=980 --group-add=988 --entrypoint=\'\' -v /var/run/docker.sock:/var/run/docker.sock' | ||
additionalBuildArgs '--build-arg PUID=\$(id -u) --build-arg PGID=\$(id -g)' | ||
} | ||
|
@@ -859,7 +908,7 @@ pipeline { | |
cleanCheckout() | ||
sh """ | ||
eval \$(opam env) | ||
bash -x scripts/build_multiarch_stanc3.sh armel | ||
bash -x scripts/build_multiarch_stanc3.sh armel ${MULTIARCH_DOCKER_TAG} | ||
""" | ||
sh "mkdir -p bin && mv `find _build -name stanc.exe` bin/linux-armel-stanc" | ||
stash name:'linux-armel-exe', includes:'bin/*' | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
serban-nicusor-toptal marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Pull the ubuntu:bionic base image | ||
FROM ubuntu:bionic | ||
|
||
USER root | ||
|
||
ARG PUID | ||
ARG PGID | ||
|
||
# Install OS dependencies | ||
RUN apt-get update -qq && apt-get install -y --no-install-recommends \ | ||
curl ca-certificates wget \ | ||
rsync git build-essential m4 unzip pkg-config libpcre3-dev docker \ | ||
python3 python3-pip nodejs sudo | ||
|
||
RUN curl -sSL https://get.docker.com/ | sh | ||
|
||
RUN addgroup -gid ${PGID} jenkins | ||
RUN adduser --disabled-password --gecos '' --ingroup jenkins --uid ${PUID} jenkins | ||
RUN usermod -a -G sudo jenkins | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
RUN chown -R jenkins:sudo /usr/local | ||
|
||
USER jenkins | ||
WORKDIR /home/jenkins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.