Update: laravel 8 to 12, php 7.3 to php 8.3, Jenkinsfile, Unit/Feature testing, vapor, docker

This commit is contained in:
Dillon Ngo
2026-04-03 06:59:39 +08:00
parent 58de1017d7
commit b34b7c19d6
142 changed files with 3334 additions and 1101 deletions
Vendored
+43 -3
View File
@@ -9,8 +9,8 @@
pipeline {
agent {
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'
args '--network ci-net --group-add 992 -v /var/run/docker.sock:/var/run/docker.sock'
image '303644228504.dkr.ecr.ap-southeast-1.amazonaws.com/jenkins-pipeline-agent-php-8.3:latest'
registryCredentialsId "ecr:ap-southeast-1:aws-ec2-instance-iam-role"
registryUrl "https://303644228504.dkr.ecr.ap-southeast-1.amazonaws.com"
}
@@ -53,6 +53,15 @@ pipeline {
branch: GIT_BRANCH
)
break
case "vapor/test": //cief todo: 137
pusherKeyCredId = 'pusher-test-key'
pusherCluster = 'ap1'
git(
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git',
credentialsId: 'gitlab-jenkins-localhost',
branch: GIT_BRANCH
)
break
case "origin/dillon/34-jenkins-vapor":
git(
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git',
@@ -84,7 +93,35 @@ pipeline {
stage('Tests') {
steps {
sh 'vendor/bin/phpunit tests/Unit'
// sh 'vendor/bin/phpunit tests/Unit'
sh '''
set -e
export APP_ENV=testing
# export APP_KEY=$(php -r "echo 'base64:'.base64_encode(random_bytes(32));")
# export JWT_SECRET=$(php -r "echo bin2hex(random_bytes(32));")
# Show which PHP binary is used
which php
php -v
# List PHP modules to confirm pdo_mysql
php -m | grep pdo_mysql || echo "pdo_mysql not loaded"
# Show DB environment variables
echo "DB_CONNECTION=$DB_CONNECTION"
echo "DB_HOST=$DB_HOST"
echo "DB_PORT=$DB_PORT"
echo "DB_DATABASE=$DB_DATABASE"
echo "DB_USERNAME=$DB_USERNAME"
# Do NOT echo password in logs
php artisan migrate:fresh --force
vendor/bin/phpunit -c phpunit.ci.xml --group ok_to_run
# vendor/bin/phpunit --filter AuthenticationTest
# vendor/bin/phpunit -c phpunit.ci.xml --filter ListOrderTrackingLogicTest
'''
script{
currentBuild.description = 'Step 4 of 6 Completed'
}
@@ -107,6 +144,9 @@ pipeline {
case "vapor/development":
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
break
case "vapor/test":
sh "vendor/bin/vapor deploy test --message='${gitCommitMessage}'"
break
case "origin/dillon/34-jenkins-vapor":
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
break