diff --git a/Jenkinsfile b/Jenkinsfile index 7c54bc314598a035ffdf7edc07cc97453aea5d9d..c4927411eb1265c670e5e32631e06afe6dfe1aa3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,16 +14,28 @@ pipeline { stage('Docker-Conan') { agent { dockerfile { - filename 'Dockerfile.gcc.minimal' + filename 'Dockerfile.gcc.full' dir 'scripts/docker' label 'docker' args '-v ccache:/home/jenkins/cache/ccache -v conan-cache:/home/jenkins/cache/conan' additionalBuildArgs '--pull' } } + environment { + CONTENTFUL_ACCESS_TOKEN = credentials('CONTENTFUL_ACCESS_TOKEN') + CONTENTFUL_OGS_SPACE_ID = credentials('CONTENTFUL_OGS_SPACE_ID') + } steps { script { - //conanClearSysreqs // see https://github.com/conan-io/conan/issues/2262 + // Install web dependencies + sh(""" + cd web + yarn --ignore-engines --non-interactive + node node_modules/node-sass/scripts/install.js + npm rebuild node-sass + sudo -H pip install -r requirements.txt + """.stripIndent()) + sh 'find $CONAN_USER_HOME -name "system_reqs.txt" -exec rm {} \\;' configure { cmakeOptions = @@ -35,6 +47,8 @@ pipeline { build { } build { target="tests" } build { target="ctest" } + build { target="web" } + build { target="doc" } configure { cmakeOptions = '-DOGS_BUILD_CLI=OFF ' + @@ -56,8 +70,25 @@ pipeline { dir('build') { deleteDir() } } success { + dir('web/public') { stash(name: 'web') } + dir('build/docs') { stash(name: 'doxygen') } + dir('scripts/jenkins') { stash(name: 'known_hosts', includes: 'known_hosts') } + script { + publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: true, + keepAll: true, reportDir: 'build/docs', reportFiles: 'index.html', + reportName: 'Doxygen']) + publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: true, + keepAll: true, reportDir: 'web/public', reportFiles: 'index.html', + reportName: 'Web']) + step([$class: 'WarningsPublisher', canResolveRelativePaths: false, + messagesPattern: """ + .*DOT_GRAPH_MAX_NODES. + .*potential recursive class relation.*""", + parserConfigurations: [[parserName: 'Doxygen', pattern: + 'build/DoxygenWarnings.log']], unstableTotalAll: '0']) archiveArtifacts 'build/*.tar.gz,build/conaninfo.txt' dir('build') { deleteDir() } + } } } } @@ -273,24 +304,24 @@ pipeline { when { environment name: 'JOB_NAME', value: 'ufz/ogs/master' } parallel { // ************************* Deploy Web ******************************** - // stage('Deploy Web') { - // agent any - // steps { - // dir('web') { unstash 'web' } - // dir('doxygen') { unstash 'doxygen' } - // unstash 'known_hosts' - // script { - // sshagent(credentials: ['www-data_jenkins']) { - // sh 'rsync -a --delete --stats -e "ssh -o UserKnownHostsFile=' + - // 'known_hosts" web/. ' + - // 'www-data@jenkins.opengeosys.org:/var/www/dev.opengeosys.org' - // sh 'rsync -a --delete --stats -e "ssh -o UserKnownHostsFile=' + - // 'known_hosts" doxygen/. ' + - // 'www-data@jenkins.opengeosys.org:/var/www/doxygen.opengeosys.org' - // } - // } - // } - // } + stage('Deploy Web') { + agent any + steps { + dir('web') { unstash 'web' } + dir('doxygen') { unstash 'doxygen' } + unstash 'known_hosts' + script { + sshagent(credentials: ['www-data_jenkins']) { + sh 'rsync -a --delete --stats -e "ssh -o UserKnownHostsFile=' + + 'known_hosts" web/. ' + + 'www-data@jenkins.opengeosys.org:/var/www/dev.opengeosys.org' + sh 'rsync -a --delete --stats -e "ssh -o UserKnownHostsFile=' + + 'known_hosts" doxygen/. ' + + 'www-data@jenkins.opengeosys.org:/var/www/doxygen.opengeosys.org' + } + } + } + } // *********************** Deploy envinf1 ****************************** stage('Deploy envinf1') { agent { label "envinf1"} diff --git a/scripts/docker/Dockerfile.gcc.full b/scripts/docker/Dockerfile.gcc.full new file mode 100644 index 0000000000000000000000000000000000000000..ab95673d4cc55d74c71deb9bb9dd0f33aaacb70e --- /dev/null +++ b/scripts/docker/Dockerfile.gcc.full @@ -0,0 +1,69 @@ +FROM ubuntu:16.04 + +RUN apt-get update && apt-get install -y software-properties-common curl \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \ + && apt-get update \ + && apt-get -y install \ + ccache \ + gcc-4.9 g++-4.9 gcc-4.9-base \ + git git-lfs \ + python-pip \ + sudo \ + unzip + +ENV CC=gcc-4.9 +ENV CXX=g++-4.9 + +RUN python -m pip install --upgrade pip \ + && python -m pip install cmake conan + +# Ninja +RUN curl -L -o ninja-linux.zip https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip \ + && unzip ninja-linux.zip \ + && mv ninja /usr/local/bin/ninja \ + && rm ninja-linux.zip + + # Add user jenkins to the image +RUN adduser --uid 500 --disabled-password --gecos "" jenkins \ + # Add user jenkins to sudoers with NOPASSWD + && echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ + # Set password for the jenkins user (you may want to alter this). + && echo "jenkins:jenkins" | chpasswd + +USER jenkins +ENV CCACHE_DIR=/home/jenkins/cache/ccache +RUN mkdir -p $CCACHE_DIR +ENV CCACHE_MAXSIZE=15G +ENV CCACHE_SLOPPINESS=pch_defines,time_macros +ENV CONAN_USER_HOME=/home/jenkins/cache/conan +WORKDIR /home/jenkins +RUN conan user + +### END gcc.minimal ### +USER root + +RUN apt-get update \ + && apt-get -y install apt-transport-https curl \ + && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" \ + | tee /etc/apt/sources.list.d/yarn.list \ + && curl -s https://deb.nodesource.com/setup_8.x | bash \ + && apt-get update && apt-get install -y \ + biber \ + doxygen \ + graphviz \ + libxml2-utils \ + nodejs \ + pandoc-citeproc \ + yarn + +RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10 + +# Hugo +RUN curl -L -o hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v0.32.3/hugo_0.32.3_Linux-64bit.tar.gz \ + && tar xf hugo.tar.gz \ + && mv hugo /usr/local/bin/hugo \ + && rm -rf hugo.tar.gz LICENSE.md README.md + +USER jenkins