Tambah Jenkinsfile untuk pipeline CI/CD
- Menambahkan file Jenkinsfile baru - Memasukkan tahap-tahap pipeline seperti Checkout dan Build Assets - Menyertakan konfigurasi environment untuk PHP dan Composer - Membersihkan workspace setelah pipeline selesai
This commit is contained in:
36
Jenkinsfile
vendored
Normal file
36
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PHP_VERSION = '8.1'
|
||||||
|
COMPOSER_HOME = "${WORKSPACE}/.composer"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build Assets') {
|
||||||
|
steps {
|
||||||
|
sh "cd /var/www/lpj"
|
||||||
|
sh "npm install"
|
||||||
|
sh "npm run build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
success {
|
||||||
|
echo 'The pipeline has succeeded!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'The pipeline has failed.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user