forked from opensearch-project/opensearch-build-libraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerCopy_Jenkinsfile
41 lines (40 loc) · 1.5 KB
/
DockerCopy_Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
pipeline {
agent none
stages {
stage("Image Copy") {
stages {
stage('Parameters Check') {
steps {
script {
currentBuild.description = "${SOURCE_IMAGE_REGISTRY}/${SOURCE_IMAGE} to ${DESTINATION_IMAGE_REGISTRY}/${DESTINATION_IMAGE}"
if( SOURCE_IMAGE.isEmpty() || DESTINATION_IMAGE.isEmpty()) {
currentBuild.result = 'ABORTED'
error('Make sure all the parameters are passed in.')
}
}
}
}
stage('Copy Image to ECR/DockerHub') {
steps {
script {
copyContainer(
sourceImage: "${SOURCE_IMAGE}",
sourceRegistry: "${SOURCE_IMAGE_REGISTRY}",
destinationImage: "${DESTINATION_IMAGE}",
destinationRegistry: "public.ecr.aws/opensearchstaging"
)
}
}
}
}
}
}
}