pipeline {
agent { label 'ci21' }
environment {
VERSION = getVersion()
ECR_URI = '633349536424.dkr.ecr.cn-north-1.amazonaws.com.cn'
RELEASE_S3_BUCKET_NAME='flexgalaxy-test-docs'
DEPLOY_S3_BUCKET_NAME='flexgalaxy-ai-docs'
}
parameters {
string(name: 'JDKVERSION', defaultValue: '1.0.0.10108')
}
stages {
stage('Check parameters') {
when {
expression { params.JDKVERSION == '' || params.JDKVERSION == 'none' }
}
steps {
echo 'JDKVERSION:' + params.JDKVERSION
echo 'parameters is illegal, this build will return fail and exit'
sh 'exit 1'
}
}
stage('Checkout') {
steps {
checkout([$class : 'RepoScm',
repoUrl : 'ssh://jenkins@gerrit.syriusrobotics.cn:29418/git-repo',
manifestRepositoryUrl: 'ssh://jenkins@gerrit.syriusrobotics.cn:29418/manifests',
manifestBranch : 'master',
manifestFile : 'jurassic/templar/documents.xml',
currentBranch : false,
forceSync : true])
checkout([$class : 'GitSCM',
userRemoteConfigs: [[url: 'ssh://jenkins@gerrit.syriusrobotics.cn:29418/devops/continuous_integration']],
branches : [[name: '*/master']],
extensions : [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'continuous_integration']]
])
}
}
stage("Copy flagship-sdk artifacts") {
steps {
sh '''#!/bin/bash
set -xe
aws s3 cp s3://${RELEASE_S3_BUCKET_NAME}/sdk-zip/flagship-sdk-${JDKVERSION}.zip s3://${DEPLOY_S3_BUCKET_NAME}/sdk-zip/flagship-sdk-${JDKVERSION}.zip --acl public-read
'''
}
}
stage("Push docs to s3") {
steps {
withCredentials([usernamePassword
(
credentialsId: 'maven-credencials',
usernameVariable: 'username',
passwordVariable: 'password'
)]) {
sh '''#!/bin/bash
set -xe
aws ecr get-login-password --region cn-north-1 | docker login --username AWS --password-stdin ${ECR_URI}
langs=`ls ${WORKSPACE}/src/documents/flagship/v2/warehouse_business/ --ignore=doc --ignore=html`
echo "version is ${VERSION}"
for lang in ${langs};do
docker run --rm -v ${WORKSPACE}/src/documents/flagship/v2/warehouse_business/${lang}:/data -w /data hrektts/doxygen doxygen flagship_doc.doxyfile
done
'''
buildImageAndPush('./src/documents/', env.ECR_URI+"/flex-galaxy/flagship/flagship-documents")
}
}
}
}
}
def getVersion(){
def buildVersion = readFile(file: 'src/documents/flagship/v2/build.version')
println(buildVersion)
def version = String.format("%s.%s",buildVersion, env.BUILD_NUMBER)
echo version
return version
}
def buildImageAndPush(path,imageName) {
def version = getVersion()
echo version
def image = docker.build(imageName + ":" + version, path)
image.push()
}