mirror of
https://github.com/triqs/dft_tools
synced 2024-06-30 00:44:34 +02:00
[jenkins] Use persistent osx triqs install; cleanup
Should now match dft_tools and soon cthyb
This commit is contained in:
parent
6bf4afd316
commit
616479d883
|
@ -1,10 +1,12 @@
|
||||||
# See ../triqs/packaging for other options
|
# See ../triqs/packaging for other options
|
||||||
FROM flatironinstitute/triqs:master-ubuntu-clang
|
FROM flatironinstitute/triqs:master-ubuntu-clang
|
||||||
|
|
||||||
COPY . ${SRC}/app4triqs
|
ARG APPNAME=app4triqs
|
||||||
WORKDIR ${BUILD}/app4triqs
|
COPY . $SRC/$APPNAME
|
||||||
|
WORKDIR $BUILD/$APPNAME
|
||||||
RUN chown build .
|
RUN chown build .
|
||||||
USER build
|
USER build
|
||||||
RUN cmake ${SRC}/app4triqs -DTRIQS_ROOT=${INSTALL} && make -j2 && make test
|
ARG BUILD_DOC=0
|
||||||
|
RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} -DBuild_Documentation=${BUILD_DOC} && make -j2 && make test
|
||||||
USER root
|
USER root
|
||||||
RUN make install
|
RUN make install
|
||||||
|
|
89
Jenkinsfile
vendored
89
Jenkinsfile
vendored
|
@ -1,5 +1,8 @@
|
||||||
def app4triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
def projectName = "app4triqs"
|
||||||
def app4triqsProject = '/TRIQS/app4triqs/' + app4triqsBranch.replaceAll('/', '%2F')
|
def documentationPlatform = "ubuntu-clang"
|
||||||
|
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
|
||||||
|
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
|
||||||
|
def publish = !env.BRANCH_NAME.startsWith("PR-") && projectName != "app4triqs"
|
||||||
|
|
||||||
properties([
|
properties([
|
||||||
disableConcurrentBuilds(),
|
disableConcurrentBuilds(),
|
||||||
|
@ -7,32 +10,34 @@ properties([
|
||||||
pipelineTriggers([
|
pipelineTriggers([
|
||||||
upstream(
|
upstream(
|
||||||
threshold: 'SUCCESS',
|
threshold: 'SUCCESS',
|
||||||
upstreamProjects: app4triqsProject
|
upstreamProjects: triqsProject
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
/* map of all builds to run, populated below */
|
||||||
def platforms = [:]
|
def platforms = [:]
|
||||||
|
|
||||||
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
|
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "centos-gcc"]
|
||||||
|
/* .each is currently broken in jenkins */
|
||||||
for (int i = 0; i < dockerPlatforms.size(); i++) {
|
for (int i = 0; i < dockerPlatforms.size(); i++) {
|
||||||
def platform = dockerPlatforms[i]
|
def platform = dockerPlatforms[i]
|
||||||
platforms[platform] = { -> stage(platform) {
|
platforms[platform] = { -> node('docker') {
|
||||||
timeout(time: 1, unit: 'HOURS') {
|
stage(platform) { timeout(time: 1, unit: 'HOURS') {
|
||||||
node('docker') {
|
|
||||||
checkout scm
|
checkout scm
|
||||||
/* construct a Dockerfile for this base */
|
/* construct a Dockerfile for this base */
|
||||||
sh """
|
sh """
|
||||||
( echo "FROM flatironinstitute/app4triqs:${app4triqsBranch}-${env.STAGE_NAME}" ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
|
( echo "FROM flatironinstitute/triqs:${triqsBranch}-${env.STAGE_NAME}" ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
|
||||||
mv -f Dockerfile.jenkins Dockerfile
|
mv -f Dockerfile.jenkins Dockerfile
|
||||||
"""
|
"""
|
||||||
/* build and tag */
|
/* build and tag */
|
||||||
def img = docker.build("flatironinstitute/app4triqs:${env.BRANCH_NAME}-${env.STAGE_NAME}")
|
def img = docker.build("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg BUILD_DOC=${platform==documentationPlatform} .")
|
||||||
/* but we don't need the tag so clean it up (alternatively, could refacter to run in container) */
|
if (!publish || platform != documentationPlatform) {
|
||||||
sh "docker rmi ${img.imageName()}"
|
/* but we don't need the tag so clean it up (except for documentation) */
|
||||||
}
|
sh "docker rmi --no-prune ${img.imageName()}"
|
||||||
}
|
}
|
||||||
} }
|
} }
|
||||||
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
def osxPlatforms = [
|
def osxPlatforms = [
|
||||||
|
@ -42,33 +47,26 @@ def osxPlatforms = [
|
||||||
for (int i = 0; i < osxPlatforms.size(); i++) {
|
for (int i = 0; i < osxPlatforms.size(); i++) {
|
||||||
def platformEnv = osxPlatforms[i]
|
def platformEnv = osxPlatforms[i]
|
||||||
def platform = platformEnv[0]
|
def platform = platformEnv[0]
|
||||||
platforms["osx-$platform"] = { -> stage("osx-$platform") {
|
platforms["osx-$platform"] = { -> node('osx && triqs') {
|
||||||
timeout(time: 1, unit: 'HOURS') {
|
stage("osx-$platform") { timeout(time: 1, unit: 'HOURS') {
|
||||||
node('osx && triqs') {
|
|
||||||
def srcDir = pwd()
|
def srcDir = pwd()
|
||||||
def tmpDir = pwd(tmp:true)
|
def tmpDir = pwd(tmp:true)
|
||||||
def buildDir = "$tmpDir/build"
|
def buildDir = "$tmpDir/build"
|
||||||
def installDir = "$tmpDir/install"
|
def installDir = "$tmpDir/install"
|
||||||
|
def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}"
|
||||||
dir(installDir) {
|
dir(installDir) {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
copyArtifacts(projectName: app4triqsProject, selector: upstream(fallbackToLastSuccessful: true), filter: "osx-${platform}.zip")
|
|
||||||
unzip(zipFile: "osx-${platform}.zip", dir: installDir)
|
|
||||||
/* fixup zip-stripped permissions (JENKINS-13128) */
|
|
||||||
sh "chmod +x $installDir/bin/*"
|
|
||||||
|
|
||||||
checkout scm
|
checkout scm
|
||||||
|
|
||||||
dir(buildDir) { withEnv(platformEnv[1]+[
|
dir(buildDir) { withEnv(platformEnv[1]+[
|
||||||
"PATH=$installDir/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin",
|
"PATH=$triqsDir/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin",
|
||||||
"CPATH=$installDir/include",
|
"CPATH=$triqsDir/include",
|
||||||
"LIBRARY_PATH=$installDir/lib",
|
"LIBRARY_PATH=$triqsDir/lib",
|
||||||
"CMAKE_PREFIX_PATH=$installDir/share/cmake"]) {
|
"CMAKE_PREFIX_PATH=$triqsDir/share/cmake"]) {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
sh "cmake $srcDir -DTRIQS_ROOT=$installDir"
|
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir"
|
||||||
sh "make -j2"
|
sh "make -j3"
|
||||||
try {
|
try {
|
||||||
sh "make test"
|
sh "make test"
|
||||||
} catch (exc) {
|
} catch (exc) {
|
||||||
|
@ -77,16 +75,45 @@ for (int i = 0; i < osxPlatforms.size(); i++) {
|
||||||
}
|
}
|
||||||
sh "make install"
|
sh "make install"
|
||||||
} }
|
} }
|
||||||
// zip(zipFile: "osx-${platform}.zip", archive: true, dir: installDir)
|
} }
|
||||||
}
|
|
||||||
}
|
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
parallel platforms
|
parallel platforms
|
||||||
|
if (publish) { node("docker") {
|
||||||
|
stage("publish") { timeout(time: 1, unit: 'HOURS') {
|
||||||
|
def commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||||
|
def workDir = pwd()
|
||||||
|
dir("$workDir/gh-pages") {
|
||||||
|
def subdir = env.BRANCH_NAME
|
||||||
|
git(url: "ssh://git@github.com/TRIQS/${projectName}.git", branch: "gh-pages", credentialsId: "ssh", changelog: false)
|
||||||
|
sh "rm -rf ${subdir}"
|
||||||
|
docker.image("flatironinstitute/${projectName}:${env.BRANCH_NAME}-${documentationPlatform}").inside() {
|
||||||
|
sh "cp -rp \$INSTALL/share/doc/${projectName} ${subdir}"
|
||||||
|
}
|
||||||
|
sh "git add -A ${subdir}"
|
||||||
|
sh """
|
||||||
|
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Generated documentation for ${env.BRANCH_NAME}' -m '${env.BUILD_TAG} ${commit}'
|
||||||
|
"""
|
||||||
|
// note: credentials used above don't work (need JENKINS-28335)
|
||||||
|
sh "git push origin gh-pages"
|
||||||
|
}
|
||||||
|
dir("$workDir/docker") { try {
|
||||||
|
git(url: "ssh://git@github.com/TRIQS/docker.git", branch: env.BRANCH_NAME, credentialsId: "ssh", changelog: false)
|
||||||
|
sh "echo '160000 commit ${commit}\t${projectName}' | git update-index --index-info"
|
||||||
|
sh """
|
||||||
|
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Autoupdate ${projectName}' -m '${env.BUILD_TAG}'
|
||||||
|
"""
|
||||||
|
// note: credentials used above don't work (need JENKINS-28335)
|
||||||
|
sh "git push origin ${env.BRANCH_NAME}"
|
||||||
|
} catch (err) {
|
||||||
|
echo "Failed to update docker repo"
|
||||||
|
} }
|
||||||
|
} }
|
||||||
|
} }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
emailext(
|
if (env.BRANCH_NAME != "jenkins") emailext(
|
||||||
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
|
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
|
||||||
body: """\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED
|
body: """\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user