Skip to content

Commit 325b993

Browse files
authored
fix: how docker image name defined (temporary solution)
1 parent 508cb72 commit 325b993

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Jenkinsfile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ pipeline {
9393
}
9494
script {
9595
env.METADATA_FILE = "ai4-metadata.yml"
96+
println("[INFO] Using ${env.METADATA_FILE} metadata file")
9697
sh "ai4-metadata validate --metadata-version 2.0.0 ai4-metadata.yml"
9798
}
9899
}
@@ -221,23 +222,25 @@ pipeline {
221222
docker_tag = env.BRANCH_NAME
222223
}
223224
docker_tag = docker_tag.toLowerCase()
224-
225+
226+
println("[INFO] (2) Using ${env.METADATA_FILE} metadata file")
227+
image_name = env.REPO_NAME
228+
// get docker image name from ai4-metadata.yml
229+
//if (env.METADATA_FILE == "ai4-metadata.yml") {
230+
//meta = readYAML file: env.METADATA_FILE
231+
//image_name = meta["links"]["docker_image"].split("/")[1]
232+
//}
233+
225234
// get docker image name from metadata.json
226-
if (env.METADATA_FILE == "metadata.json") {
235+
if (env.METADATA_FILE == "metadata.json" && fileExists("metadata.json")) {
227236
meta = readJSON file: env.METADATA_FILE
228237
image_name = meta["sources"]["docker_registry_repo"].split("/")[1]
229238
}
230239
// get docker image name from ai4-metadata.json
231-
if (env.METADATA_FILE == "ai4-metadata.json") {
240+
if (env.METADATA_FILE == "ai4-metadata.json" && fileExists("ai4-metadata.json")) {
232241
meta = readJSON file: env.METADATA_FILE
233242
image_name = meta["links"]["docker_image"].split("/")[1]
234243
}
235-
// get docker image name from ai4-metadata.yml
236-
if (env.METADATA_FILE == "ai4-metadata.yml") {
237-
image_name = env.REPO_NAME
238-
//meta = readYAML file: env.METADATA_FILE
239-
//image_name = meta["links"]["docker_image"].split("/")[1]
240-
}
241244

242245
// use preconfigured in Jenkins docker_repository
243246
// XXX may confuse users? (e.g. expect xyz/myimage, but we push to ai4hub/myimage)

0 commit comments

Comments
 (0)