Skip to content

Commit

Permalink
Update Jenkins config
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Dec 16, 2024
1 parent 34ec26f commit 68ff259
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
16 changes: 9 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ pipeline {
description: "Pass STANCFLAGS to make/local, default none")
booleanParam(name:"run_slow_perf_tests", defaultValue: false, description:"Run additional 'slow' performance tests")
string(defaultValue: '', name: 'build_multiarch_docker_tag', description: "Docker tag for the multiarch image")
booleanParam(name:"build_multiarch", defaultValue: false, description:"Build multiarch images even when not on 'master'")

}
options {
parallelsAlwaysFailFast()
Expand All @@ -113,7 +115,7 @@ pipeline {
GIT_AUTHOR_EMAIL = '[email protected]'
GIT_COMMITTER_NAME = 'Stan Jenkins'
GIT_COMMITTER_EMAIL = '[email protected]'
MULTIARCH_DOCKER_TAG = 'multiarch-ocaml-4.14-v2'
MULTIARCH_DOCKER_TAG = 'multiarch-ocaml-4.14-v2-and-cmdliner'
}
stages {
stage('Verify changes') {
Expand Down Expand Up @@ -749,7 +751,7 @@ pipeline {
beforeAgent true
allOf {
expression { !skipRebuildingBinaries }
anyOf { buildingTag(); branch 'master' }
anyOf { buildingTag(); branch 'master'; expression { params.build_multiarch } }
}
}
agent {
Expand Down Expand Up @@ -783,7 +785,7 @@ pipeline {
beforeAgent true
allOf {
expression { !skipRebuildingBinaries }
anyOf { buildingTag(); branch 'master' }
anyOf { buildingTag(); branch 'master'; expression { params.build_multiarch } }
}
}
agent {
Expand Down Expand Up @@ -814,7 +816,7 @@ pipeline {
beforeAgent true
allOf {
expression { !skipRebuildingBinaries }
anyOf { buildingTag(); branch 'master' }
anyOf { buildingTag(); branch 'master'; expression { params.build_multiarch } }
}
}
agent {
Expand Down Expand Up @@ -845,7 +847,7 @@ pipeline {
beforeAgent true
allOf {
expression { !skipRebuildingBinaries }
anyOf { buildingTag(); branch 'master' }
anyOf { buildingTag(); branch 'master'; expression { params.build_multiarch } }
}
}
agent {
Expand Down Expand Up @@ -876,7 +878,7 @@ pipeline {
beforeAgent true
allOf {
expression { !skipRebuildingBinaries }
anyOf { buildingTag(); branch 'master' }
anyOf { buildingTag(); branch 'master'; expression { params.build_multiarch } }
}
}
agent {
Expand Down Expand Up @@ -907,7 +909,7 @@ pipeline {
beforeAgent true
allOf {
expression { !skipRebuildingBinaries }
anyOf { buildingTag(); branch 'master' }
anyOf { buildingTag(); branch 'master'; expression { params.build_multiarch } }
}
}
agent {
Expand Down
9 changes: 8 additions & 1 deletion scripts/build_multiarch_stanc3.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@

# Architecture naming isn't consistent between QEMU and Docker, so lookup correct naming
if [ $1 = "mips64el" ]; then
export DOCK_PLATFORM="linux/mips64le"
export DOCK_ARCH="mips64le"
export DOCK_VARIANT=""
elif [ $1 = "arm64" ]; then
export DOCK_PLATFORM="linux/arm64"
export DOCK_ARCH="arm64"
export DOCK_VARIANT=""
elif [ $1 = "ppc64el" ]; then
export DOCK_PLATFORM="linux/ppc64le"
export DOCK_ARCH="ppc64le"
export DOCK_VARIANT=""
elif [ $1 = "armhf" ]; then
export DOCK_PLATFORM="linux/arm/v7"
export DOCK_ARCH="arm"
export DOCK_VARIANT="v7"
elif [ $1 = "armel" ]; then
export DOCK_PLATFORM="linux/arm/v6"
export DOCK_ARCH="arm"
export DOCK_VARIANT="v6"
elif [ $1 = "s390x" ]; then
export DOCK_PLATFORM="linux/s390x"
export DOCK_ARCH="s390x"
export DOCK_VARIANT=""
fi
Expand All @@ -28,4 +34,5 @@ SHA=$(skopeo inspect --raw docker://stanorg/stanc3:${DOCKER_IMAGE_TAG} | jq '.ma
# Register QEMU translation binaries
docker run --rm --privileged multiarch/qemu-user-static --reset

docker run --group-add=987 --group-add=980 --group-add=988 -v $(pwd):$(pwd):rw,z stanorg/stanc3:${DOCKER_IMAGE_TAG}@$SHA /bin/bash -c "cd $(pwd) && eval \$(opam env) && dune subst && dune build @install --profile static --root=."
docker run --platform=${DOCK_PLATFORM} --group-add=987 --group-add=980 --group-add=988 -v $(pwd):$(pwd):rw,z \
stanorg/stanc3:${DOCKER_IMAGE_TAG}@$SHA /bin/bash -c "cd $(pwd) && eval \$(opam env) && dune subst && dune clean && dune build @install --profile static --root=."
6 changes: 3 additions & 3 deletions scripts/docker/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pull the ubuntu:bionic base image
FROM ubuntu:bionic
# Pull the ubuntu:jammy base image
FROM ubuntu:jammy

USER root

Expand All @@ -21,4 +21,4 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN chown -R jenkins:sudo /usr/local

USER jenkins
WORKDIR /home/jenkins
WORKDIR /home/jenkins
12 changes: 2 additions & 10 deletions scripts/docker/debian-windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Pull the ubuntu:bionic image
FROM ubuntu:bionic
#Pull the ubuntu:jammy image
FROM ubuntu:jammy

USER root

Expand Down Expand Up @@ -35,13 +35,5 @@ RUN printf "\n" | bash -x install_ocaml.sh "stanc"
COPY ./scripts/install_build_deps_windows.sh ./
RUN bash -x install_build_deps_windows.sh

#Copy our script and install dev dependencies
COPY ./scripts/install_dev_deps.sh ./
RUN bash -x install_dev_deps.sh

# Install Javascript dev environment
COPY ./scripts/install_js_deps.sh ./
RUN opam update; bash -x install_js_deps.sh

#Specify our entrypoint
ENTRYPOINT [ "opam", "config", "exec", "--" ]
11 changes: 6 additions & 5 deletions scripts/docker/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pull the ubuntu:bionic base image
FROM ubuntu:bionic
# Pull the ubuntu:jammy base image
FROM ubuntu:jammy

USER root

Expand Down Expand Up @@ -27,22 +27,23 @@ WORKDIR /home/jenkins
#Copy our script and install ocaml + init
COPY ./scripts/install_opam.sh ./
RUN printf "\n" | bash -x install_opam.sh
RUN opam update

# Install and initialize ocaml
COPY ./scripts/install_ocaml.sh ./
RUN printf "\n" | bash -x install_ocaml.sh "stanc"

# Install build dependencies
COPY ./scripts/install_build_deps.sh ./
RUN opam update; bash -x install_build_deps.sh
RUN bash -x install_build_deps.sh

# Install dev dependencies
COPY ./scripts/install_dev_deps.sh ./
RUN opam update; bash -x install_dev_deps.sh
RUN bash -x install_dev_deps.sh

# Install Javascript dev environment (js_of_ocaml 5.4.0)
COPY ./scripts/install_js_deps.sh ./
RUN opam update; bash -x install_js_deps.sh
RUN bash -x install_js_deps.sh

# Specify our entrypoint
ENTRYPOINT [ "opam", "config", "exec", "--" ]
11 changes: 5 additions & 6 deletions scripts/docker/multiarch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base image
FROM debian:buster-20220622-slim
FROM debian:bullseye-20241202

USER root

Expand Down Expand Up @@ -51,18 +51,17 @@ RUN eval $(opam env) && opam update

# Native-code compilation not available on MIPS, fall back to bytecode
RUN if [ "$(cat /qemu-setup/arch)" = "mips64el" ]; then \
opam switch create 4.14.1 --packages=ocaml-variants.4.14.1+options,ocaml-option-bytecode-only && opam switch 4.14.1 && opam pin num https://github.com/ocaml/num.git -y; \
opam switch create 4.14.1 --packages=ocaml-variants.4.14.1+options,ocaml-option-bytecode-only && opam switch 4.14.1; \
else \
opam switch create 4.14.1 && opam switch 4.14.1; \
fi

RUN eval $(opam env) && opam repo add internet https://opam.ocaml.org

RUN eval $(opam env) && opam install -y dune
RUN eval $(opam env) && opam repository add dune-universe git+https://github.com/dune-universe/opam-overlays.git
RUN eval $(opam env) && opam update && opam upgrade
RUN eval $(opam env) && opam install -y dune
RUN eval $(opam env) && opam install -y core.v0.16.0
RUN eval $(opam env) && opam install -y menhir.20230608
RUN eval $(opam env) && opam install -y ppx_deriving.5.2.1
RUN eval $(opam env) && opam install -y fmt.0.9.0
RUN eval $(opam env) && opam install -y yojson.2.1.0
RUN eval $(opam env)
RUN eval $(opam env) && opam install -y cmdliner.1.3.0+dune
6 changes: 3 additions & 3 deletions scripts/docker/publish/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pull the ubuntu:bionic base image
FROM ubuntu:bionic
# Pull the ubuntu:jammy base image
FROM ubuntu:jammy

USER root

Expand All @@ -25,4 +25,4 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN chown -R jenkins:sudo /usr/local

USER jenkins
WORKDIR /home/jenkins
WORKDIR /home/jenkins
11 changes: 5 additions & 6 deletions scripts/docker/static/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,20 @@ RUN CONTAINERS_COMMON_VER=$(curl -s https://dl-cdn.alpinelinux.org/alpine/latest
apk add cont.apk && \
apk add skopeo.apk

#Switch back to the normal user
# Switch back to the normal user
USER jenkins

#Init opam, create and switch to 4.14.0, update shell environment
# Init opam, create and switch to 4.14.0, update shell environment
RUN opam init --disable-sandboxing --bare -y
RUN opam update
RUN opam switch create 4.14.0
RUN opam switch 4.14.0
RUN eval $(opam env)

RUN opam repo add internet https://opam.ocaml.org

COPY ./scripts/install_build_deps.sh ./
RUN opam update; bash -x install_build_deps.sh

RUN opam install odoc -y

#Specify our entrypoint
ENTRYPOINT [ "opam", "config", "exec", "--" ]
# Specify our entrypoint
ENTRYPOINT [ "opam", "config", "exec", "--" ]

0 comments on commit 68ff259

Please sign in to comment.