1
+ lib = library(identifier: 'jenkins@3.0.0', retriever: modernSCM([
2
+ $class: 'GitSCMSource',
3
+ remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
4
+ ]))
5
+
1
6
pipeline {
2
7
options {
3
8
timeout(time: 4, unit: 'HOURS')
@@ -6,7 +11,6 @@ pipeline {
6
11
docker {
7
12
label 'Jenkins-Agent-Ubuntu2004-X64-M52xlarge-Docker-Builder'
8
13
image 'opensearchstaging/ci-runner:ubuntu2004-x64-docker-buildx0.6.3-qemu5.0-awscli1.22-jdk11-v2'
9
- args '-u root -v /var/run/docker.sock:/var/run/docker.sock'
10
14
alwaysPull true
11
15
}
12
16
}
@@ -40,20 +44,23 @@ pipeline {
40
44
checkout([$class: 'GitSCM', branches: [[name: PACKER_BUILD_GIT_REPOSITORY_REFERENCE ]], userRemoteConfigs: [[url: PACKER_BUILD_GIT_REPOSITORY ]]])
41
45
def packer_jenkins_agent_json = readJSON file: "./packer/$PACKER_AGENT_JSON_NAME"
42
46
withCredentials([
43
- string(credentialsId: " jenkins-agent-vpc-id" , variable: 'vpc_id'),
44
- string(credentialsId: " jenkins-agent-subnet-id" , variable: 'subnet_id'),
45
- string(credentialsId: " jenkins-agent-sg-id" , variable: 'sg_id')
47
+ string(credentialsId: ' jenkins-agent-vpc-id' , variable: 'vpc_id'),
48
+ string(credentialsId: ' jenkins-agent-subnet-id' , variable: 'subnet_id'),
49
+ string(credentialsId: ' jenkins-agent-sg-id' , variable: 'sg_id')
46
50
]){
47
51
packer_jenkins_agent_json["variables"]["build-vpc"] = vpc_id
48
52
packer_jenkins_agent_json["variables"]["build-subnet"] = subnet_id
49
53
packer_jenkins_agent_json["variables"]["build-secgrp"] = sg_id
50
54
}
51
- writeJSON file: "./packer/$PACKER_AGENT_JSON_NAME", json: packer_jenkins_agent_json, pretty: 2
55
+ def PACKER_AGENT_JSON_NAME_SUBSTITUTE = "SUBSTITUTE_" + "$PACKER_AGENT_JSON_NAME"
56
+ print("$PACKER_AGENT_JSON_NAME_SUBSTITUTE")
57
+ writeJSON file: "./packer/$PACKER_AGENT_JSON_NAME_SUBSTITUTE", json: packer_jenkins_agent_json, pretty: 2
52
58
53
- //Start to build packer
59
+ // Start to build packer
54
60
withCredentials([string(credentialsId: 'jenkins-aws-account-public', variable: 'AWS_ACCOUNT_PUBLIC')]) {
55
- withAWS(role: 'opensearch-bundle', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') {
56
- sh ("packer build ./packer/$PACKER_AGENT_JSON_NAME")
61
+ withAWS(role: 'opensearch-packer', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') {
62
+ // sh ("packer build ./packer/$PACKER_AGENT_JSON_NAME_SUBSTITUTE")
63
+ sh ("ls ./packer/")
57
64
}
58
65
}
59
66
@@ -62,7 +69,7 @@ pipeline {
62
69
post() {
63
70
always {
64
71
script {
65
- cleanWs disableDeferredWipeout: true, deleteDirs: true
72
+ postCleanup()
66
73
}
67
74
}
68
75
}
0 commit comments