diff --git a/Jenkinsfile b/Jenkinsfile index 8b68044..ba1a538 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,10 @@ pipeline { agent { docker { - image 'dillonngo/docker-based-image:poc' - args "--group-add 992 -v /var/run/docker.sock:/var/run/docker.sock" + 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" + registryUrl "https://303644228504.dkr.ecr.ap-southeast-1.amazonaws.com" } } environment { @@ -12,19 +14,16 @@ pipeline { stage('Download source code from Git') { steps { script{ + currentBuild.description = 'Step 1 of 6 Completed' + println("GIT GIT_BRANCH: " + GIT_BRANCH) switch(GIT_BRANCH) { case "vapor/production": - git( - url: 'https://gitlab.com/CIEFWorldwideSdnBhd/vapor-laravel-explore.git', - credentialsId: 'gitlab-jenkins-localhost', - branch: 'vapor/production' - ) - break case "vapor/staging": + case "vapor/development": git( url: 'https://gitlab.com/CIEFWorldwideSdnBhd/vapor-laravel-explore.git', credentialsId: 'gitlab-jenkins-localhost', - branch: 'vapor/staging' + branch: GIT_BRANCH ) break case "origin/test": @@ -35,6 +34,7 @@ pipeline { ) break } + currentBuild.description = 'Step 2 of 6 Completed' } } } @@ -42,12 +42,18 @@ pipeline { stage('Install') { steps { sh 'composer update' + script{ + currentBuild.description = 'Step 3 of 6 Completed' + } } } stage('Tests') { steps { sh 'vendor/bin/phpunit tests/Unit' + script{ + currentBuild.description = 'Step 4 of 6 Completed' + } } } @@ -56,6 +62,7 @@ pipeline { script{ String gitCommitMessage = getCommitMessage() println("GIT CommitMessage: " + gitCommitMessage) + println("GIT GIT_BRANCH: " + GIT_BRANCH) switch(GIT_BRANCH) { case "vapor/production": sh "vendor/bin/vapor deploy production --message='${gitCommitMessage}'" @@ -63,14 +70,30 @@ pipeline { case "vapor/staging": sh "vendor/bin/vapor deploy staging --message='${gitCommitMessage}'" break + case "vapor/development": + sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'" + break case "origin/test": sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'" break } + currentBuild.description = 'Step 5 of 6 Completed' } } } + stage('Cleanup') { + steps { + script { + try { + sh 'docker image prune -a -f' + } catch (Exception e) { + echo "Error during cleanup: ${e.message}" + } + currentBuild.description = 'Step 6 of 6 Completed' + } + } + } } } @@ -82,5 +105,6 @@ String getCommitMessage(){ commitMessage = entry.msg } } + commitMessage = commitMessage.replace("'", "`") return commitMessage } diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index b8b1b97..378209b 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -56,7 +56,7 @@
- Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end. + A. Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end.
diff --git a/vapor.yml b/vapor.yml index 8272115..b6e589f 100644 --- a/vapor.yml +++ b/vapor.yml @@ -5,7 +5,7 @@ environments: domain: production.vapor-explore.izyim.com memory: 1024 cli-memory: 512 - database: vapor-laravel-poc-db + database: cief-amazon-rds-mysql storage: vapor-laravel-explore-production runtime: 'docker' timeout: 180 @@ -20,7 +20,7 @@ environments: domain: staging.vapor-explore.izyim.com memory: 1024 cli-memory: 512 - database: vapor-laravel-poc-db + database: cief-amazon-rds-mysql storage: vapor-laravel-explore-staging runtime: 'docker' timeout: 180 @@ -35,7 +35,7 @@ environments: domain: dev.vapor-explore.izyim.com memory: 1024 cli-memory: 512 - database: vapor-laravel-poc-db + database: cief-amazon-rds-mysql storage: vapor-laravel-explore-development runtime: 'docker' timeout: 180