From 0924b2ba8760c94144899f8aabb83b9dd5b8cd78 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Sun, 18 Jan 2026 03:37:45 +0800 Subject: [PATCH] 1688 PO Automation Project --- Jenkinsfile | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed52bd70..af748c8a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { docker { args '--group-add 992 -v /var/run/docker.sock:/var/run/docker.sock' image '303644228504.dkr.ecr.ap-southeast-1.amazonaws.com/jenkins-pipeline-agent:latest' - registryCredentialsId "ecr:ap-southeast-1:aws-ec2-instance-iam-role" + registryCredentialsId "" registryUrl "https://303644228504.dkr.ecr.ap-southeast-1.amazonaws.com" } } @@ -19,10 +19,21 @@ pipeline { HOME = '.' } stages { + stage('Login to ECR') { + steps { + sh ''' + aws ecr get-login-password --region ap-southeast-1 | \ + docker login --username AWS --password-stdin 303644228504.dkr.ecr.ap-southeast-1.amazonaws.com + ''' + script{ + currentBuild.description = 'Step 1 of 7 Completed' + } + } + } stage('Download source code from Git') { steps { script{ - currentBuild.description = 'Step 1 of 6 Completed' + currentBuild.description = 'Step 2 of 6 Completed' def pusherKeyCredId def pusherCluster switch(GIT_BRANCH) { @@ -68,7 +79,7 @@ pipeline { println "Pusher cluster : ${env.MIX_PUSHER_APP_CLUSTER}" println "Pusher key set : ${env.MIX_PUSHER_APP_KEY}" } - currentBuild.description = 'Step 2 of 6 Completed' + currentBuild.description = 'Step 3 of 7 Completed' } } } @@ -77,7 +88,7 @@ pipeline { steps { sh 'composer update' script{ - currentBuild.description = 'Step 3 of 6 Completed' + currentBuild.description = 'Step 4 of 7 Completed' } } } @@ -86,7 +97,7 @@ pipeline { steps { sh 'vendor/bin/phpunit tests/Unit' script{ - currentBuild.description = 'Step 4 of 6 Completed' + currentBuild.description = 'Step 5 of 7 Completed' } } } @@ -111,7 +122,7 @@ pipeline { sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'" break } - currentBuild.description = 'Step 5 of 6 Completed' + currentBuild.description = 'Step 6 of 7 Completed' } } } @@ -124,7 +135,7 @@ pipeline { } catch (Exception e) { echo "Error during cleanup: ${e.message}" } - currentBuild.description = 'Step 6 of 6 Completed' + currentBuild.description = 'Step 7 of 7 Completed' } } }