Skip to content

Commit 93e94bc

Browse files
committed
tatic code analysis stage added
1 parent 9bbda7c commit 93e94bc

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

Jenkinsfile-ECR

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ pipeline{
77
parameters{
88

99
choice(name: 'action', choices: 'create\ndelete', description: 'Choose create/Destroy')
10-
string(name: 'ImageName', description: "name of the docker build", defaultValue: 'javapp')
11-
string(name: 'ImageTag', description: "tag of the docker build", defaultValue: 'v1')
12-
string(name: 'DockerHubUser', description: "name of the Application", defaultValue: 'vikashashoke')
10+
string(name: 'aws_account_id', description: " AWS Account ID", defaultValue: '496157679619')
11+
string(name: 'Region', description: "Region of ECR", defaultValue: 'us-east-1')
12+
string(name: 'ECR_REPO_NAME', description: "name of the ECR", defaultValue: 'vikashashoke')
1313
}
1414

1515
stages{
@@ -72,5 +72,41 @@ pipeline{
7272
}
7373
}
7474
}
75+
stage('Docker Image Build : ECR'){
76+
when { expression { params.action == 'create' } }
77+
steps{
78+
script{
79+
80+
dockerBuild("${params.aws_account_id}","${params.Region}","${params.ECR_REPO_NAME}")
81+
}
82+
}
83+
}
84+
stage('Docker Image Scan: trivy '){
85+
when { expression { params.action == 'create' } }
86+
steps{
87+
script{
88+
89+
dockerImageScan("${params.aws_account_id}","${params.Region}","${params.ECR_REPO_NAME}")
90+
}
91+
}
92+
}
93+
stage('Docker Image Push : ECR '){
94+
when { expression { params.action == 'create' } }
95+
steps{
96+
script{
97+
98+
dockerImagePush("${params.aws_account_id}","${params.Region}","${params.ECR_REPO_NAME}")
99+
}
100+
}
101+
}
102+
stage('Docker Image Cleanup : ECR '){
103+
when { expression { params.action == 'create' } }
104+
steps{
105+
script{
106+
107+
dockerImageCleanup("${params.aws_account_id}","${params.Region}","${params.ECR_REPO_NAME}")
108+
}
109+
}
110+
}
75111
}
76112
}

0 commit comments

Comments
 (0)