diff --git a/.jenkins/Jenkinsfile b/.jenkins/Jenkinsfile index 5af92f1..16c4874 100644 --- a/.jenkins/Jenkinsfile +++ b/.jenkins/Jenkinsfile @@ -31,7 +31,7 @@ node { stage('Build self-ci-java') { sh ''' set -ex -exit 0 + image_tag="$BRANCH_NAME" [ "$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') { sh ''' set -ex @@ -69,8 +53,7 @@ exit 0 # push our images, don't forget to docker login docker push "moparisthebest/self-ci-base:$image_tag" - #docker push "moparisthebest/self-ci-java:$image_tag" - docker push "moparisthebest/self-ci-rust:$image_tag" + docker push "moparisthebest/self-ci-java:$image_tag" ''' } diff --git a/run.sh b/run.sh index ce77919..b786db9 100755 --- a/run.sh +++ b/run.sh @@ -7,10 +7,8 @@ if [ ! -z "${BUILD_UID:-}" ] then BUILD_GID="${BUILD_GID:-$BUILD_UID}" groupadd -r -g "$BUILD_GID" jenkins - additional_groups='' - [ -e /var/run/docker.sock ] && additional_groups="-G $(stat -c '%g' /var/run/docker.sock)" - useradd -r -u "$BUILD_UID" -g "$BUILD_GID" $additional_groups -s /bin/bash -m -d /root jenkins - chown -R "$BUILD_UID":"$BUILD_GID" /root + useradd -r -u "$BUILD_UID" -g "$BUILD_GID" -s /bin/bash -m -d /root jenkins + chown "$BUILD_UID":"$BUILD_GID" /root #exec runuser -m jenkins -- "$@" exec sudo -E -u jenkins -- "$@" fi diff --git a/rust/Dockerfile b/rust/Dockerfile deleted file mode 100644 index cbabff4..0000000 --- a/rust/Dockerfile +++ /dev/null @@ -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"] diff --git a/rust/build-jenkins.sh b/rust/build-jenkins.sh new file mode 100755 index 0000000..fe6a846 --- /dev/null +++ b/rust/build-jenkins.sh @@ -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 diff --git a/rust/build.sh b/rust/build.sh index f4befc5..12802c5 100755 --- a/rust/build.sh +++ b/rust/build.sh @@ -1,7 +1,12 @@ #!/bin/bash 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 - 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 diff --git a/rust/readme.md b/rust/readme.md deleted file mode 100644 index 90e6879..0000000 --- a/rust/readme.md +++ /dev/null @@ -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 -```