Setup playground for laravel vapor with jenkins

This commit is contained in:
Dillon
2023-10-21 00:48:09 +08:00
parent b619632faf
commit 9d81c0de84
3 changed files with 59 additions and 5 deletions
+1 -1
View File
@@ -12,4 +12,4 @@ deploy:
- npm run build - npm run build
- vapor deploy production --message="$CI_COMMIT_MESSAGE" - vapor deploy production --message="$CI_COMMIT_MESSAGE"
only: only:
- development - master
Vendored
+49
View File
@@ -0,0 +1,49 @@
// Webhook + Gitlab git pull + Vapor
def payload = readJSON text: "${payload}"
String userName = payload.user_name
String userEmail = payload.user_email
String httpUrl = payload.project.http_url
pipeline {
agent {
docker {
image 'dillonngo/docker-based-image:poc'
args "--group-add 992 -v /var/run/docker.sock:/var/run/docker.sock"
}
}
environment {
HOME = '.'
}
stages {
stage('Download source code from Git') {
steps {
git(
url: httpUrl,
credentialsId: 'gitlab-jenkins-localhost',
branch: 'test'
)
}
}
stage('Install') {
steps {
sh 'composer update'
}
}
stage('Tests') {
steps {
sh 'vendor/bin/phpunit tests/Unit'
}
}
stage('Deploy') {
steps {
sh 'vendor/bin/vapor deploy production --message="Test Jenkins"'
}
}
}
}
+9 -4
View File
@@ -1,13 +1,18 @@
id: 46540 id: 48019
name: vapor-laravel-poc name: vapor-laravel-poc
separate-vendor: true
environments: environments:
production: production:
memory: 1024 memory: 1024
cli-memory: 512 cli-memory: 512
database: vapor-laravel-poc-db database: vapor-laravel-poc-db
runtime: 'php-8.2:al2' storage: vapor-laravel-poc
runtime: 'docker'
timeout: 180
build: build:
- 'composer install --no-dev' - 'composer update'
- 'php artisan event:cache' - 'npm install'
- 'npm run dev'
# - 'gulp build'
deploy: deploy:
- 'php artisan migrate --force' - 'php artisan migrate --force'