Skip to content

Commit

Permalink
Use DockerHub images for CI (#785)
Browse files Browse the repository at this point in the history
* Jenkinsfile, Dockerfile: use K docker image for CI

* Jenkinsfile: skip building K

* Jenkinsfile: allocate agent for whole pipeline

* Jenkinsfile: inline call to get K commit

* Jenkinsfile: build and test on master builds too

* Jenkinsfile: formatting

* Dockerfile: use sudo to install packages

* Dockerfile: install cmake

* Dockerfile: remove unneeded lines

* Dockerfile, Jenkinsfile: setup ssh in Dockerfile

* Dockerfile: remove npm installation

* Dockerfile: adjust for new image

* Dockerfile: add jq

* Dockerfile: add curl

* Jenkinsfile: add beforeAgent

Co-authored-by: rv-jenkins <[email protected]>
  • Loading branch information
ehildenb and rv-jenkins authored May 28, 2020
1 parent dd0c1db commit 81a496b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 100 deletions.
114 changes: 38 additions & 76 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,78 +1,40 @@
FROM runtimeverificationinc/ubuntu:bionic

RUN apt-get update \
&& apt-get upgrade --yes \
&& apt-get install --yes \
autoconf \
bison \
clang-8 \
cmake \
curl \
flex \
gcc \
jq \
libboost-test-dev \
libcrypto++-dev \
libffi-dev \
libgflags-dev \
libjemalloc-dev \
libmpfr-dev \
libprocps-dev \
libsecp256k1-dev \
libssl-dev \
libtool \
libyaml-dev \
lld-8 \
llvm-8-tools \
make \
maven \
netcat-openbsd \
openjdk-11-jdk \
pandoc \
pkg-config \
python3 \
python-pygments \
python-recommonmark \
python-sphinx \
rapidjson-dev \
time \
zlib1g-dev

ADD deps/k/haskell-backend/src/main/native/haskell-backend/scripts/install-stack.sh /.install-stack/
RUN /.install-stack/install-stack.sh

RUN git clone 'https://github.com/z3prover/z3' --branch=z3-4.6.0 \
&& cd z3 \
&& python scripts/mk_make.py \
&& cd build \
&& make -j8 \
&& make install \
&& cd ../.. \
&& rm -rf z3

RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install --yes nodejs
ARG K_COMMIT
FROM runtimeverificationinc/kframework-k:ubuntu-bionic-${K_COMMIT}

RUN apt-get update \
&& apt-get upgrade --yes \
&& apt-get install --yes \
cmake \
curl \
jq \
libboost-test-dev \
libcrypto++-dev \
libgflags-dev \
libprocps-dev \
libsecp256k1-dev \
libssl-dev \
netcat-openbsd \
pandoc \
pkg-config \
python3 \
python-pygments \
python-recommonmark \
python-sphinx \
rapidjson-dev

ARG USER_ID=1000
ARG GROUP_ID=1000
RUN groupadd -g $GROUP_ID user && useradd -m -u $USER_ID -s /bin/sh -g user user

USER user:user

ENV LC_ALL=C.UTF-8
ADD --chown=user:user deps/k/haskell-backend/src/main/native/haskell-backend/stack.yaml /home/user/.tmp-haskell/
ADD --chown=user:user deps/k/haskell-backend/src/main/native/haskell-backend/kore/package.yaml /home/user/.tmp-haskell/kore/
RUN cd /home/user/.tmp-haskell \
&& stack build --only-snapshot

ADD deps/k/pom.xml /home/user/.tmp-maven/
ADD deps/k/ktree/pom.xml /home/user/.tmp-maven/ktree/
ADD deps/k/llvm-backend/pom.xml /home/user/.tmp-maven/llvm-backend/
ADD deps/k/llvm-backend/src/main/native/llvm-backend/matching/pom.xml /home/user/.tmp-maven/llvm-backend/src/main/native/llvm-backend/matching/
ADD deps/k/haskell-backend/pom.xml /home/user/.tmp-maven/haskell-backend/
ADD deps/k/ocaml-backend/pom.xml /home/user/.tmp-maven/ocaml-backend/
ADD deps/k/kernel/pom.xml /home/user/.tmp-maven/kernel/
ADD deps/k/java-backend/pom.xml /home/user/.tmp-maven/java-backend/
ADD deps/k/k-distribution/pom.xml /home/user/.tmp-maven/k-distribution/
ADD deps/k/kore/pom.xml /home/user/.tmp-maven/kore/
RUN cd /home/user/.tmp-maven \
&& mvn dependency:go-offline

ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PATH=/home/user/.local/bin:$PATH
WORKDIR /home/user

RUN git config --global user.email '[email protected]' \
&& git config --global user.name 'RV Jenkins' \
&& mkdir -p ~/.ssh \
&& echo 'host github.com' > ~/.ssh/config \
&& echo ' hostname github.com' >> ~/.ssh/config \
&& echo ' user git' >> ~/.ssh/config \
&& echo ' identityagent SSH_AUTH_SOCK' >> ~/.ssh/config \
&& echo ' stricthostkeychecking accept-new' >> ~/.ssh/config \
&& chmod go-rwx -R ~/.ssh
36 changes: 12 additions & 24 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pipeline {
agent none
agent {
dockerfile {
label 'docker && !smol'
additionalBuildArgs '--build-arg K_COMMIT="$(cd deps/k && git rev-parse --short=7 HEAD)" --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
}
}
environment {
GITHUB_TOKEN = credentials('rv-jenkins')
VERSION = '1.0.0'
Expand All @@ -10,22 +15,13 @@ pipeline {
}
options { ansiColor('xterm') }
stages {
stage("Init title") {
stage('Init title') {
when { changeRequest() }
steps { script { currentBuild.displayName = "PR ${env.CHANGE_ID}: ${env.CHANGE_TITLE}" } }
}
stage('Build and Test') {
when { changeRequest() }
agent {
dockerfile {
additionalBuildArgs '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
args '-m 60g'
label 'docker && !smol'
}
}
stages {
stage('K Dependencies') { steps { sh 'make deps RELEASE=true' } }
stage('Build') { steps { sh 'make build RELEASE=true -j6' } }
stage('Build') { steps { sh 'make build RELEASE=true -j6' } }
stage('Test Execution') {
failFast true
options { timeout(time: 20, unit: 'MINUTES') }
Expand Down Expand Up @@ -62,8 +58,10 @@ pipeline {
}
}
stage('Deploy') {
when { branch 'master' }
agent { dockerfile { reuseNode true } }
when {
branch 'master'
beforeAgent true
}
stages {
stage('Update Dependents') {
steps {
Expand All @@ -86,16 +84,6 @@ pipeline {
sshagent(['2b3d8d6b-0855-4b59-864a-6b3ddf9c9d1a']) {
dir("kevm-${env.VERSION}-jello-paper") {
sh '''
git config --global user.email "[email protected]"
git config --global user.name "RV Jenkins"
mkdir -p ~/.ssh
echo 'host github.com' > ~/.ssh/config
echo ' hostname github.com' >> ~/.ssh/config
echo ' user git' >> ~/.ssh/config
echo ' identityagent SSH_AUTH_SOCK' >> ~/.ssh/config
echo ' stricthostkeychecking accept-new' >> ~/.ssh/config
chmod go-rwx -R ~/.ssh
ssh github.com || true
git clone 'ssh://github.com/kframework/evm-semantics.git'
cd evm-semantics
git checkout -B gh-pages origin/master
Expand Down

0 comments on commit 81a496b

Please sign in to comment.