Skip to content

Commit

Permalink
More reliable way to get git branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Apr 17, 2019
1 parent 3cce57d commit e690a73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
20 changes: 4 additions & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,10 @@ def SphinxDoc() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Running sphinx-doc..."
def branch_name = sh (
script: 'git rev-parse --abbrev-ref HEAD',
returnStdout: true
).trim()
//container_type = "lint"
//docker_binary = "docker"
//sh """#!/bin/bash
//CI_DOCKER_EXTRA_PARAMS_INIT='-e SPHINX_GIT_BRANCH=${args.branch_name}' ${dockerRun} ${container_type} ${docker_binary} make -C doc html
//CI_DOCKER_EXTRA_PARAMS_INIT='-e SPHINX_GIT_BRANCH=${BRANCH_NAME}' ${dockerRun} ${container_type} ${docker_binary} make -C doc html
//"""
}
}
Expand Down Expand Up @@ -183,24 +179,16 @@ def BuildJVMSpark(args) {
def BuildJVMDoc() {
node('linux && cpu') {
unstash name: 'srcs'
def commit_id = sh (
script: 'git rev-parse HEAD',
returnStdout: true
).trim()
def branch_name = sh (
script: 'git rev-parse --abbrev-ref HEAD',
returnStdout: true
).trim()
echo "Building JVM doc..."
container_type = "jvm"
docker_binary = "docker"
s3Download file: 'tests/ci_build/maven-repo-cache.tar.bz2', bucket: 'xgboost-ci-jenkins-artifacts', force: true, path: 'maven-repo-cache.tar.bz2'
sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_jvm_doc.sh ${commit_id}
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_jvm_doc.sh ${BRANCH_NAME}
"""
archiveArtifacts artifacts: "jvm-packages/${commit_id}.tar.bz2", allowEmptyArchive: true
archiveArtifacts artifacts: "jvm-packages/${BRANCH_NAME}.tar.bz2", allowEmptyArchive: true
echo 'Deploying doc...'
s3Upload file: "jvm-packages/${commit_id}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "${branch_name}.tar.bz2"
s3Upload file: "jvm-packages/${BRANCH_NAME}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "${BRANCH_NAME}.tar.bz2"
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/ci_build/build_jvm_doc.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Usage: $0 [commit id]"
echo "Usage: $0 [branch name]"
exit 1
fi

Expand All @@ -13,7 +13,7 @@ set -x

cd jvm-packages

commit_id=$1
branch_name=$1

# Install JVM packages in local Maven repository
mvn install -DskipTests
Expand All @@ -30,8 +30,8 @@ cp -rv xgboost4j-spark/target/site/scaladocs/ ./tmp/scaladocs/xgboost4j-spark/
cp -rv xgboost4j-flink/target/site/scaladocs/ ./tmp/scaladocs/xgboost4j-flink/

cd tmp
tar cvjf ${commit_id}.tar.bz2 javadocs/ scaladocs/
mv ${commit_id}.tar.bz2 ..
tar cvjf ${branch_name}.tar.bz2 javadocs/ scaladocs/
mv ${branch_name}.tar.bz2 ..
cd ..
rm -rfv tmp/

Expand Down

0 comments on commit e690a73

Please sign in to comment.