-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
74 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,25 +75,25 @@ def runShellCommand(script, int retries = 1) { | |
} | ||
|
||
|
||
|
||
def buildImage(appName, appVersion, String type='CE') { | ||
// Type EE, CE, MID, EE-MID | ||
echo "Building ${appName}:${appVersion}" | ||
echo "Type: ${type}" | ||
echo "env: ${env}" | ||
return | ||
|
||
def appBuildOption = [ | ||
"core-xpack": [ | ||
"image": "xpack", | ||
"dependBy": ["jumpserver"] | ||
], | ||
"jumpserver": [ | ||
"image": "core" | ||
"image": "core", | ||
], | ||
"lina": [ | ||
"dependBy": ["docker-web"] | ||
], | ||
"luna": [ | ||
"beforeSh": "rm -rf dist luna" | ||
"beforeSh": "rm -rf dist luna", | ||
"dependBy": ["docker-web"] | ||
], | ||
"razor": [ | ||
"buildArgs": "-f docker/Dockerfile" | ||
|
@@ -102,6 +102,18 @@ def buildImage(appName, appVersion, String type='CE') { | |
"image": "web" | ||
] | ||
] | ||
|
||
// env.repo 是触发构建的仓库,如果不为空,只构建该仓库 | ||
// 但是如果构建的仓库依赖其他仓库,也需要构建依赖的仓库 | ||
// 比如说 env.repo = lina, 那么 docker-web 也需要构建 | ||
def depsBy = appBuildOption[env.repo]?.dependBy ?: [] | ||
def wasDepond = depsBy.contains(appName) | ||
|
||
if (env.repo && (env.repo !== appName || !wasDepond)) { | ||
echo "Skip ${appName} build, tigger is ${env.repo}, only deposBy ${depsBy}" | ||
return | ||
} | ||
|
||
def buildArgs = getDefaultBuildArgs() | ||
def passArgs = getDefaultPassArgs() | ||
buildArgs += " ${passArgs}" | ||
|
@@ -178,69 +190,68 @@ pipeline { | |
env.PIP_MIRROR="https://pypi.tuna.tsinghua.edu.cn/simple" | ||
env.MAVEN_MIRROR="https://maven.aliyun.com/repository/public" | ||
env.APK_MIRROR="mirrors.tuna.tsinghua.edu.cn" | ||
env.repo = params.repo | ||
|
||
env.each { key, value -> | ||
println "${key} = ${value}" | ||
sh "env" | ||
} | ||
} | ||
} | ||
stage('Checkout') { | ||
steps { | ||
script { | ||
ALL_APPS.each { app -> | ||
dir(app) { | ||
if (app == env.repo || env.repo == '') { | ||
git url: "[email protected]:jumpserver/${app}.git", branch: "${env.branch}" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Build pre apps') { | ||
steps { | ||
script { | ||
def ceStages = MID_APPS.collectEntries{ app -> | ||
["Build ${app}": { | ||
stage("Build ${app}") { | ||
dir(app) { | ||
script { | ||
def type = "MID" | ||
if (app == "core-xpack") { | ||
type = "EE-MID" | ||
} | ||
buildImage(app, env.release_version, type) | ||
} | ||
} | ||
} | ||
}] | ||
} | ||
parallel ceStages | ||
} | ||
} | ||
} | ||
stage('Build Apps') { | ||
steps { | ||
script { | ||
def buildStages = BUILD_APPS.collectEntries{ app -> | ||
["Build ${app}": { | ||
stage("Build ${app}") { | ||
dir(app) { | ||
script { | ||
if (app in CE_APPS) { | ||
buildImage(app, env.release_version, "CE") | ||
} | ||
buildImage(app, env.release_version, "EE") | ||
} | ||
} | ||
} | ||
}] | ||
} | ||
parallel buildStages | ||
} | ||
} | ||
} | ||
// stage('Checkout') { | ||
// steps { | ||
// script { | ||
// ALL_APPS.each { app -> | ||
// dir(app) { | ||
// if (app == env.repo || env.repo == '') { | ||
// git url: "[email protected]:jumpserver/${app}.git", branch: "${env.branch}" | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } | ||
// } | ||
// stage('Build pre apps') { | ||
// steps { | ||
// script { | ||
// def ceStages = MID_APPS.collectEntries{ app -> | ||
// ["Build ${app}": { | ||
// stage("Build ${app}") { | ||
// dir(app) { | ||
// script { | ||
// def type = "MID" | ||
// if (app == "core-xpack") { | ||
// type = "EE-MID" | ||
// } | ||
// buildImage(app, env.release_version, type) | ||
// } | ||
// } | ||
// } | ||
// }] | ||
// } | ||
// parallel ceStages | ||
// } | ||
// } | ||
// } | ||
// stage('Build Apps') { | ||
// steps { | ||
// script { | ||
// def buildStages = BUILD_APPS.collectEntries{ app -> | ||
// ["Build ${app}": { | ||
// stage("Build ${app}") { | ||
// dir(app) { | ||
// script { | ||
// if (app in CE_APPS) { | ||
// buildImage(app, env.release_version, "CE") | ||
// } | ||
// buildImage(app, env.release_version, "EE") | ||
// } | ||
// } | ||
// } | ||
// }] | ||
// } | ||
// parallel buildStages | ||
// } | ||
// } | ||
// } | ||
stage('Restart') { | ||
steps { | ||
script { | ||
|