improving the dockerfile and the building
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/processmaker
|
||||
docker:
|
||||
- image: devopsstacks/pm:n285-phpunit
|
||||
- image: cimg/mysql:8.0
|
||||
command: |
|
||||
mysqld --default-authentication-plugin='mysql_native_password' --optimizer-switch='derived_merge=off' --sql-mode='NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' --collation-server='utf8mb4_unicode_ci' --character-set-server='utf8mb4' --max_connections=500
|
||||
environment:
|
||||
MYSQL_HOST: 127.0.0.1
|
||||
MYSQL_ROOT_PASSWORD: 'password'
|
||||
MYSQL_ROOT_HOST: '%'
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install dockerize
|
||||
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
|
||||
environment:
|
||||
DOCKERIZE_VERSION: v0.6.1
|
||||
- run:
|
||||
name: Wait for DB
|
||||
command: dockerize -wait tcp://127.0.0.1:3306 -timeout 3m
|
||||
- run: mysql -u root -ppassword -h 127.0.0.1 -e "create database test;"
|
||||
- run: mysql -u root -ppassword -h 127.0.0.1 -e "create database testexternal;"
|
||||
- run: composer install
|
||||
- run:
|
||||
name: Run Test Units
|
||||
command: |
|
||||
mkdir -p coverage
|
||||
vendor/bin/phpunit --stop-on-error --testdox-html coverage/result.html --coverage-html coverage --verbose tests/unit/
|
||||
environment:
|
||||
XDEBUG_MODE: coverage
|
||||
- store_artifacts:
|
||||
path: coverage
|
||||
destination: coverage
|
||||
- store_test_results:
|
||||
path: coverage
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,7 +11,6 @@ update.sh
|
||||
# Ignore build artifacts and logs
|
||||
workflow/public_html/build-log.html
|
||||
workflow/public_html/mix-manifest.json
|
||||
workflow/public_html/index.html
|
||||
workflow/public_html/webapp/
|
||||
workflow/public_html/translations/
|
||||
workflow/public_html/files/
|
||||
|
||||
12
.gitlab-ci.yml
Normal file
12
.gitlab-ci.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
build_job:
|
||||
stage: build
|
||||
script:
|
||||
- bash docker/build.sh $VERSION
|
||||
|
||||
before_script:
|
||||
- VERSION=$(git describe | awk -F- '{ if( $2) {print $1 "." $2} else {print $1 ".0"} }' )
|
||||
- echo $VERSION
|
||||
|
||||
13
.travis.yml
13
.travis.yml
@@ -1,13 +0,0 @@
|
||||
language: php
|
||||
script: phpunit
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
|
||||
before_install:
|
||||
- composer install
|
||||
|
||||
branches:
|
||||
only:
|
||||
- michelangelo
|
||||
95
Jenkinsfile
vendored
95
Jenkinsfile
vendored
@@ -1,95 +0,0 @@
|
||||
#!groovy
|
||||
node {
|
||||
/**
|
||||
* Branch should be in gitflow format. If not, then we'll abort.
|
||||
*/
|
||||
if(!env.BRANCH_NAME.matches(/(feature|hotfix|bugfix|release|master|develop)\/.+/) && !env.BRANCH_NAME.matches(/^PR-.*$/)) {
|
||||
hipchatSend message: "${env.BRANCH_NAME} Build: Does not match gitflow naming. Aborted", room: 'engineering'
|
||||
error "Job does not follow gitflow naming format."
|
||||
}
|
||||
// Parse out our short name and potential jira ticket. Null if not associated. If null, then for now we won't notify
|
||||
// on jira ticket
|
||||
def jiraTicket = env.BRANCH_NAME.find(/HOR-\d+/)
|
||||
|
||||
def shortname = env.BRANCH_NAME.replace('/', '-').replace('.', '-').toLowerCase()
|
||||
def dbSuffix = shortname.replace('-', '')
|
||||
|
||||
echo "Building for ${env.BRANCH_NAME}"
|
||||
|
||||
// Checkout source
|
||||
checkout scm
|
||||
|
||||
try {
|
||||
stage('Start Notification') {
|
||||
if(jiraTicket) {
|
||||
jiraComment issueKey: jiraTicket, body: "Build ${env.BUILD_NUMBER} Starting.\nTicket will be updated once build is completed.\n\n${env.BUILD_URL}"
|
||||
}
|
||||
hipchatSend message: "${env.BRANCH_NAME} Build: ${env.BUILD_NUMBER} Starting.\n${env.BUILD_URL}", room: 'engineering'
|
||||
}
|
||||
|
||||
stage('Dependencies') {
|
||||
echo "Running Composer"
|
||||
sh 'composer install'
|
||||
echo "Running rake"
|
||||
sh 'rake'
|
||||
}
|
||||
|
||||
stage('Generate QA MySQL Databases') {
|
||||
withCredentials([string(credentialsId: 'qa-rds-hostname', variable: 'rdsHostname'), usernamePassword(credentialsId: 'qa-rds-credentials', passwordVariable: 'rdsPassword', usernameVariable: 'rdsUsername')]) {
|
||||
echo 'Dropping existing database and recreating.'
|
||||
sh "mysql -h ${rdsHostname} -u ${rdsUsername} -p${rdsPassword} -e 'drop database if exists qa205${dbSuffix}; create database qa205${dbSuffix}'"
|
||||
sh "mysql -h ${rdsHostname} -u ${rdsUsername} -p${rdsPassword} -e 'drop database if exists qa300${dbSuffix}; create database qa300${dbSuffix}'"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish to QA-205') {
|
||||
sshagent(['processmaker-deploy']) {
|
||||
echo 'Dropping existing files and recreating'
|
||||
sh "ssh processmaker@build-qa205.processmaker.net 'rm -Rf /home/processmaker/${shortname}'"
|
||||
sh "scp -r ./ processmaker@build-qa205.processmaker.net:~/${shortname}"
|
||||
echo 'Creating necessary directories'
|
||||
sh "ssh processmaker@build-qa205.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/engine/js/labels'"
|
||||
sh "ssh processmaker@build-qa205.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/public_html/translations'"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish to QA-300') {
|
||||
sshagent(['processmaker-deploy']) {
|
||||
echo 'Dropping existing files and recreating'
|
||||
sh "ssh processmaker@build-qa300.processmaker.net 'rm -Rf /home/processmaker/${shortname}'"
|
||||
sh "scp -r ./ processmaker@build-qa300.processmaker.net:~/${shortname}"
|
||||
echo 'Creating necessary directories'
|
||||
sh "ssh processmaker@build-qa300.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/engine/js/labels'"
|
||||
sh "ssh processmaker@build-qa300.processmaker.net 'mkdir -p /home/processmaker/${shortname}/workflow/public_html/translations'"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Success Notification') {
|
||||
withCredentials([string(credentialsId: 'qa-rds-hostname', variable: 'rdsHostname'), usernamePassword(credentialsId: 'qa-rds-credentials', passwordVariable: 'rdsPassword', usernameVariable: 'rdsUsername')]) {
|
||||
if(jiraTicket) {
|
||||
jiraComment issueKey: jiraTicket, body: "" +
|
||||
"Build ${env.BUILD_NUMBER} Completed.\n" +
|
||||
"5.6 Build: https://${shortname}.qa205.processmaker.net\n" +
|
||||
"Database Host: ${rdsHostname}\n" +
|
||||
"Username: ${rdsUsername}\n" +
|
||||
"Password: ${rdsPassword}\n" +
|
||||
"Database: qa205${dbSuffix}\n\n" +
|
||||
"7.0 Build: https://${shortname}.qa300.processmaker.net\n" +
|
||||
"Database Host: ${rdsHostname}\n" +
|
||||
"Username: ${rdsUsername}\n" +
|
||||
"Password: ${rdsPassword}\n" +
|
||||
"Database: qa300${dbSuffix}\n\n" +
|
||||
"${env.BUILD_URL}"
|
||||
}
|
||||
hipchatSend room: 'engineering', message: "" +
|
||||
"${env.BRANCH_NAME} Build: ${env.BUILD_NUMBER} Completed.\n" +
|
||||
"${env.BUILD_URL}"
|
||||
}
|
||||
}
|
||||
} catch(error) {
|
||||
if(jiraTicket) {
|
||||
jiraComment issueKey: jiraTicket, body: "Build ${env.BUILD_NUMBER} Failed: ${error}\n\n${env.BUILD_URL}"
|
||||
}
|
||||
hipchatSend message: "${env.BRANCH_NAME} Build: ${env.BUILD_NUMBER} Failed: ${error}\n${env.BUILD_URL}", room: 'engineering'
|
||||
}
|
||||
}
|
||||
33
docker/.dockerignore
Normal file
33
docker/.dockerignore
Normal file
@@ -0,0 +1,33 @@
|
||||
# Ignore temporary files
|
||||
tmp/
|
||||
temp/
|
||||
|
||||
# Ignore Docker-related files (if you don't want them in the context)
|
||||
Dockerfile
|
||||
docker/
|
||||
|
||||
# Ignore version control files
|
||||
/.git
|
||||
|
||||
# Ignore documentation and configuration files
|
||||
INSTALL.txt
|
||||
README.md
|
||||
Rakefile
|
||||
pmos.conf.example
|
||||
|
||||
# Ignore testing and feature files
|
||||
tests/
|
||||
features/
|
||||
phpunit.xml
|
||||
behat.yml.dist
|
||||
phpdox.xml
|
||||
env_unittest.sh
|
||||
|
||||
# Ignore patches and updates
|
||||
patch/
|
||||
update/
|
||||
|
||||
# Other files to ignore (customize as needed)
|
||||
apiary.apib
|
||||
processmaker.bat
|
||||
|
||||
10
docker/Dockerfile
Normal file
10
docker/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
# Use our base image
|
||||
FROM gitlab.luranasoft.com:5050/luos/docker/base-image:1.0.9-php8.3
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /code
|
||||
|
||||
# Copy the application code from the current directory to /code in the image
|
||||
COPY . .
|
||||
|
||||
RUN chown -R www-data:www-data /code
|
||||
26
docker/build.sh
Normal file
26
docker/build.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if the first parameter is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: Semantic version parameter is required."
|
||||
echo "Usage: $0 <semantic_version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building Lurana Open Source version $1"
|
||||
|
||||
# Update and install Composer dependencies
|
||||
composer update
|
||||
composer install
|
||||
|
||||
# Construct the Docker image tag name
|
||||
tagname="gitlab.luranasoft.com:5050/pm/processmaker:$1"
|
||||
echo "Docker tag name: $tagname"
|
||||
|
||||
# Build the Docker image using the new tag name
|
||||
docker build -t "$tagname" -f ./docker/Dockerfile .
|
||||
|
||||
# Push the Docker image to the repository
|
||||
docker push "$tagname"
|
||||
|
||||
echo "Build and push completed successfully."
|
||||
8
workflow/public_html/index.html
Normal file
8
workflow/public_html/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Redirector</title>
|
||||
<meta http-equiv="PRAGMA" content="NO-CACHE" />
|
||||
<meta http-equiv="CACHE-CONTROL" content="NO-STORE" />
|
||||
<meta http-equiv="REFRESH" content="0;URL=sys/en/neoclassic/login/login" />
|
||||
</head>
|
||||
</html>
|
||||
Reference in New Issue
Block a user