Rust cross cannot be ran inside a docker container with a btrfs storage driver, yet, revert to normal boring script
All checks were successful
moparisthebest/self-ci/pipeline/head This commit looks good
All checks were successful
moparisthebest/self-ci/pipeline/head This commit looks good
This commit is contained in:
parent
9fa6cca726
commit
89756dce4a
21
.jenkins/Jenkinsfile
vendored
21
.jenkins/Jenkinsfile
vendored
@ -31,7 +31,7 @@ node {
|
|||||||
stage('Build self-ci-java') {
|
stage('Build self-ci-java') {
|
||||||
sh '''
|
sh '''
|
||||||
set -ex
|
set -ex
|
||||||
exit 0
|
|
||||||
image_tag="$BRANCH_NAME"
|
image_tag="$BRANCH_NAME"
|
||||||
[ "$image_tag" == "master" ] && image_tag=latest
|
[ "$image_tag" == "master" ] && image_tag=latest
|
||||||
|
|
||||||
@ -44,22 +44,6 @@ exit 0
|
|||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build self-ci-rust') {
|
|
||||||
sh '''
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
image_tag="$BRANCH_NAME"
|
|
||||||
[ "$image_tag" == "master" ] && image_tag=latest
|
|
||||||
|
|
||||||
cd rust
|
|
||||||
|
|
||||||
# build our image
|
|
||||||
docker build -t "moparisthebest/self-ci-rust:$image_tag" .
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Push to docker hub') {
|
stage('Push to docker hub') {
|
||||||
sh '''
|
sh '''
|
||||||
set -ex
|
set -ex
|
||||||
@ -69,8 +53,7 @@ exit 0
|
|||||||
|
|
||||||
# push our images, don't forget to docker login
|
# push our images, don't forget to docker login
|
||||||
docker push "moparisthebest/self-ci-base:$image_tag"
|
docker push "moparisthebest/self-ci-base:$image_tag"
|
||||||
#docker push "moparisthebest/self-ci-java:$image_tag"
|
docker push "moparisthebest/self-ci-java:$image_tag"
|
||||||
docker push "moparisthebest/self-ci-rust:$image_tag"
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
run.sh
6
run.sh
@ -7,10 +7,8 @@ if [ ! -z "${BUILD_UID:-}" ]
|
|||||||
then
|
then
|
||||||
BUILD_GID="${BUILD_GID:-$BUILD_UID}"
|
BUILD_GID="${BUILD_GID:-$BUILD_UID}"
|
||||||
groupadd -r -g "$BUILD_GID" jenkins
|
groupadd -r -g "$BUILD_GID" jenkins
|
||||||
additional_groups=''
|
useradd -r -u "$BUILD_UID" -g "$BUILD_GID" -s /bin/bash -m -d /root jenkins
|
||||||
[ -e /var/run/docker.sock ] && additional_groups="-G $(stat -c '%g' /var/run/docker.sock)"
|
chown "$BUILD_UID":"$BUILD_GID" /root
|
||||||
useradd -r -u "$BUILD_UID" -g "$BUILD_GID" $additional_groups -s /bin/bash -m -d /root jenkins
|
|
||||||
chown -R "$BUILD_UID":"$BUILD_GID" /root
|
|
||||||
#exec runuser -m jenkins -- "$@"
|
#exec runuser -m jenkins -- "$@"
|
||||||
exec sudo -E -u jenkins -- "$@"
|
exec sudo -E -u jenkins -- "$@"
|
||||||
fi
|
fi
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
FROM moparisthebest/self-ci-base:latest
|
|
||||||
|
|
||||||
# set CROSS_DOCKER_IN_DOCKER to inform `cross` that it is executed from within a container
|
|
||||||
#ENV CROSS_DOCKER_IN_DOCKER=true
|
|
||||||
|
|
||||||
RUN mkdir /cargo && ln -sf /cargo/ /root/.cargo && \
|
|
||||||
pacman -Syu --noconfirm --needed docker rustup gcc && \
|
|
||||||
rustup install stable && rustup default stable && \
|
|
||||||
cargo install --root / cross
|
|
||||||
|
|
||||||
COPY ./build.sh /usr/bin/
|
|
||||||
|
|
||||||
VOLUME [ "/build", "/var/run/docker.sock" ]
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
ENTRYPOINT ["/usr/bin/run.sh"]
|
|
||||||
CMD ["/usr/bin/build.sh", "./.jenkins/build.sh"]
|
|
14
rust/build-jenkins.sh
Executable file
14
rust/build-jenkins.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
# this'll have to do until cross can run in docker containers backed by the btrfs driver
|
||||||
|
# run like: curl https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/rust/build-jenkins.sh | bash
|
||||||
|
|
||||||
|
mkdir bin
|
||||||
|
cd bin
|
||||||
|
curl -O https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/ci-release-helper.sh -O https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/rust/build.sh
|
||||||
|
chmod +x ci-release-helper.sh build.sh
|
||||||
|
cd ..
|
||||||
|
export PATH="$(pwd)/bin:$PATH"
|
||||||
|
ci-release-helper.sh standard_pre_release
|
||||||
|
exec build.sh .jenkins/build.sh
|
@ -1,7 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
for TARGET in ${BUILD_TARGETS:-x86_64-unknown-linux-musl}
|
for TARGET in ${BUILD_TARGETS:-x86_64-unknown-linux-musl x86_64-unknown-linux-gnu i686-unknown-linux-musl i686-unknown-linux-gnu i586-unknown-linux-musl i586-unknown-linux-gnu aarch64-unknown-linux-musl aarch64-unknown-linux-gnu armv7-unknown-linux-gnueabihf armv7-unknown-linux-musleabihf arm-unknown-linux-gnueabi arm-unknown-linux-gnueabihf arm-unknown-linux-musleabi arm-unknown-linux-musleabihf armv5te-unknown-linux-gnueabi armv5te-unknown-linux-musleabi x86_64-pc-windows-gnu x86_64-linux-android i686-linux-android aarch64-linux-android armv7-linux-androideabi arm-linux-androideabi mips64el-unknown-linux-gnuabi64 mips64-unknown-linux-gnuabi64 mipsel-unknown-linux-gnu mipsel-unknown-linux-musl mips-unknown-linux-gnu mips-unknown-linux-musl powerpc64le-unknown-linux-gnu powerpc-unknown-linux-gnu riscv64gc-unknown-linux-gnu s390x-unknown-linux-gnu x86_64-sun-solaris sparcv9-sun-solaris x86_64-unknown-netbsd}
|
||||||
do
|
do
|
||||||
TARGET="$TARGET" "$@"
|
if echo "$TARGET" | grep -E '(^s390x|^thumb|solaris$|^x86_64-unknown-dragonfly$|^x86_64-unknown-netbsd$)' >/dev/null
|
||||||
|
then
|
||||||
|
DISABLE_TESTS=1 TARGET="$TARGET" "$@"
|
||||||
|
else
|
||||||
|
TARGET="$TARGET" "$@"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
self-ci-rust
|
|
||||||
------------
|
|
||||||
|
|
||||||
A docker container with rustup and [cross](https://github.com/rust-embedded/cross) that runs a script with every variant cross supports.
|
|
||||||
|
|
||||||
Meant to be ran in CI something like this:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/build" -e BRANCH_NAME -e BUILD_UID=$UID -e BUILD_GID=$(id -g) moparisthebest/self-ci-rust:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
Without arguments it will execute `.jenkins/build.sh` once for each docker container cross supports, setting the env variables TARGET and DISABLE_TESTS appropriately so invocations of `cross` and `cargo` *just work*. If you want to call another script each time:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD:/build" -e BRANCH_NAME -e BUILD_UID=$UID -e BUILD_GID=$(id -g) moparisthebest/self-ci-rust:latest build.sh ./path/to/your/script.sh
|
|
||||||
```
|
|
Loading…
Reference in New Issue
Block a user