|
@@ -8,6 +8,24 @@
|
|
|
* 39.105.153.68/alien_cloud/gateway:uat-build-<BUILD_NUMBER>
|
|
* 39.105.153.68/alien_cloud/gateway:uat-build-<BUILD_NUMBER>
|
|
|
* Production promote jobs use SOURCE_TAG=uat-build-<same number>.
|
|
* Production promote jobs use SOURCE_TAG=uat-build-<same number>.
|
|
|
*/
|
|
*/
|
|
|
|
|
+
|
|
|
|
|
+/** HARBOR_PUSH_SCOPE: all-java-services | <repo>-only */
|
|
|
|
|
+def filterHarborPushScope(List allServices, String scope) {
|
|
|
|
|
+ def s = (scope ?: 'all-java-services').trim()
|
|
|
|
|
+ if (s == 'all-java-services') {
|
|
|
|
|
+ return allServices
|
|
|
|
|
+ }
|
|
|
|
|
+ if (s.endsWith('-only')) {
|
|
|
|
|
+ def repo = s.substring(0, s.length() - '-only'.length())
|
|
|
|
|
+ def picked = allServices.findAll { it.repo == repo }
|
|
|
|
|
+ if (picked.isEmpty()) {
|
|
|
|
|
+ error("Unknown HARBOR_PUSH_SCOPE: ${scope}")
|
|
|
|
|
+ }
|
|
|
|
|
+ return picked
|
|
|
|
|
+ }
|
|
|
|
|
+ error("Unknown HARBOR_PUSH_SCOPE: ${scope}")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
pipeline {
|
|
pipeline {
|
|
|
agent any
|
|
agent any
|
|
|
|
|
|
|
@@ -33,8 +51,17 @@ pipeline {
|
|
|
)
|
|
)
|
|
|
choice(
|
|
choice(
|
|
|
name: 'HARBOR_PUSH_SCOPE',
|
|
name: 'HARBOR_PUSH_SCOPE',
|
|
|
- choices: ['gateway-only', 'all-java-services'],
|
|
|
|
|
- description: 'Only used when PUSH_TO_HARBOR=true'
|
|
|
|
|
|
|
+ choices: [
|
|
|
|
|
+ 'all-java-services',
|
|
|
|
|
+ 'gateway-only',
|
|
|
|
|
+ 'store-only',
|
|
|
|
|
+ 'second-only',
|
|
|
|
|
+ 'store-platform-only',
|
|
|
|
|
+ 'lawyer-only',
|
|
|
|
|
+ 'job-only',
|
|
|
|
|
+ 'dining-only',
|
|
|
|
|
+ ],
|
|
|
|
|
+ description: 'Only when PUSH_TO_HARBOR=true; default=all seven; *-only=one service'
|
|
|
)
|
|
)
|
|
|
string(name: 'HARBOR_REGISTRY', defaultValue: '39.105.153.68', trim: true)
|
|
string(name: 'HARBOR_REGISTRY', defaultValue: '39.105.153.68', trim: true)
|
|
|
string(name: 'HARBOR_PROJECT', defaultValue: 'alien_cloud', trim: true)
|
|
string(name: 'HARBOR_PROJECT', defaultValue: 'alien_cloud', trim: true)
|
|
@@ -161,7 +188,7 @@ pipeline {
|
|
|
def baseImage = "${reg}/${proj}/base/openjdk8-ffmpeg:v1"
|
|
def baseImage = "${reg}/${proj}/base/openjdk8-ffmpeg:v1"
|
|
|
def dockerfile = env.DOCKERFILE_JAVA
|
|
def dockerfile = env.DOCKERFILE_JAVA
|
|
|
|
|
|
|
|
- def harborServices = [
|
|
|
|
|
|
|
+ def allHarborServices = [
|
|
|
[module: 'alien-gateway', repo: 'gateway', port: '8000', withLib: false],
|
|
[module: 'alien-gateway', repo: 'gateway', port: '8000', withLib: false],
|
|
|
[module: 'alien-store', repo: 'store', port: '50014', withLib: true],
|
|
[module: 'alien-store', repo: 'store', port: '50014', withLib: true],
|
|
|
[module: 'alien-second', repo: 'second', port: '50015', withLib: false],
|
|
[module: 'alien-second', repo: 'second', port: '50015', withLib: false],
|
|
@@ -170,9 +197,8 @@ pipeline {
|
|
|
[module: 'alien-job', repo: 'job', port: '50108', withLib: false],
|
|
[module: 'alien-job', repo: 'job', port: '50108', withLib: false],
|
|
|
[module: 'alien-dining', repo: 'dining', port: '50019', withLib: false],
|
|
[module: 'alien-dining', repo: 'dining', port: '50019', withLib: false],
|
|
|
]
|
|
]
|
|
|
- if (params.HARBOR_PUSH_SCOPE == 'gateway-only') {
|
|
|
|
|
- harborServices = harborServices.findAll { it.repo == 'gateway' }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ def harborServices = filterHarborPushScope(allHarborServices, params.HARBOR_PUSH_SCOPE)
|
|
|
|
|
+ echo ">>> HARBOR_PUSH_SCOPE=${params.HARBOR_PUSH_SCOPE} repos=${harborServices*.repo.join(',')}"
|
|
|
|
|
|
|
|
withCredentials([usernamePassword(
|
|
withCredentials([usernamePassword(
|
|
|
credentialsId: env.HARBOR_CREDENTIALS,
|
|
credentialsId: env.HARBOR_CREDENTIALS,
|