forked from techjoomla/com_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge `Release 2.5.1` into `release-2.6.0`
- Loading branch information
Showing
3 changed files
with
343 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"com_api": { | ||
"2.5.0": { | ||
"com_api": { | ||
"version": "2.5.0", | ||
"repoUrl": "[email protected]:techjoomla/com_api.git", | ||
"branch": "release-2.5.0" | ||
} | ||
}, | ||
"2.4.0": { | ||
"com_api": { | ||
"version": "2.4.0", | ||
"repoUrl": "[email protected]:techjoomla/com_api.git", | ||
"branch": "master" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
//!/usr/bin/env groovy | ||
|
||
// Get / Set release name | ||
// TODO - remove hardcoded value | ||
def apiVersion = '2.5.0' //env.getProperty("apiVersion") | ||
echo apiVersion | ||
|
||
pipeline { | ||
agent any | ||
stages { | ||
stage('Cleanup') { | ||
steps { | ||
script { | ||
// Cleanup previous stuff | ||
// Files | ||
sh("rm -f .gitignore") | ||
|
||
// Folders - API job scm files | ||
sh("rm -rf .git/ .gitlab/ build/ code/ docs/ scripts/") | ||
|
||
// Folders - Remaining files | ||
sh("rm -rf builds/ builds@tmp/") | ||
sh("rm -rf com_api/ com_api@tmp/") | ||
sh("rm -rf com_api-scm/ com_api-scm@tmp/") | ||
|
||
// Make directories needed to generate build | ||
// mkdir -p is for creatingparents directories as needed | ||
sh("mkdir -p builds") | ||
sh("mkdir com_api-scm") | ||
} | ||
} | ||
} | ||
|
||
stage('Checkout') { | ||
steps { | ||
script { | ||
// This is important, we need clone into different folder here, | ||
// Because, as part of tag based pull, we will be cloning same repo again | ||
dir('com_api-scm') { | ||
checkout scm | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Init') { | ||
steps { | ||
script { | ||
// Define subextensions array having unique git repos | ||
// @TODO - move this to json itself? | ||
def subextensions = ['com_api'] | ||
|
||
// def props = readJSON text: '{}' // Add JSON here or specify file below | ||
def props = readJSON file: 'com_api-scm/build/version.json' | ||
|
||
subextensions.eachWithIndex { item, index -> | ||
// Do clone all subextensions repos by checking out corresponding release branch | ||
sh("git clone --branch " + props['com_api'][apiVersion][item]['branch'] + " --depth 1 " + props['com_api'][apiVersion][item]['repoUrl']) | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Copy files') { | ||
steps { | ||
script { | ||
// Copy com_api from com_api repo into builds folder | ||
sh("cp com_api/code/api.xml builds/") | ||
sh("cp com_api/code/script.api.php builds/") | ||
|
||
sh("cp -r com_api/code/admin builds/") | ||
sh("cp -r com_api/code/site builds/") | ||
sh("cp -r com_api/code/plugins builds/") | ||
} | ||
} | ||
} | ||
|
||
stage('Make zips') { | ||
steps { | ||
script { | ||
// Get commit id | ||
// @TODO - needs to define shortGitCommit at global level | ||
def gitCommit = '' | ||
def shortGitCommit = '' | ||
|
||
// For branch based build - we need the revision number of tag checked out, | ||
// So cd into `com_api` dir | ||
dir('com_api') { | ||
// gitCommit = env.getProperty('GIT_COMMIT') | ||
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(8) | ||
shortGitCommit = gitCommit[0..7] | ||
echo gitCommit | ||
echo shortGitCommit | ||
} | ||
|
||
// Now we are good to create zip for component, exclude unwanted folders | ||
// Cleanup build dir folders | ||
sh("rm -rf build/com_api") | ||
sh("rm -rf build/com_api@tmp") | ||
|
||
// Now we are good to create zip for package, pass folders to ignore as -x | ||
// @TODO - for some reasons above rm -rf commands not working, | ||
// So, need to skip those through -x param of zip command | ||
dir('builds/') { | ||
sh('zip -rq ../com_api_v' + apiVersion + '_' + shortGitCommit + '.zip . -x "com_api/*" "com_api@tmp/*"') | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Archive') { | ||
steps { | ||
script { | ||
// Get commit id | ||
// @TODO - needs to define shortGitCommit at global level | ||
def gitCommit = '' | ||
def shortGitCommit = '' | ||
|
||
// For branch based build - we need the revision number of tag checked out, | ||
// So cd into `com_api` dir | ||
dir('com_api') { | ||
// gitCommit = env.getProperty('GIT_COMMIT') | ||
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(8) | ||
shortGitCommit = gitCommit[0..7] | ||
echo gitCommit | ||
echo shortGitCommit | ||
} | ||
|
||
// Archive Artifact | ||
archiveArtifacts 'com_api_v' + apiVersion + '_' + shortGitCommit + '.zip' | ||
} | ||
} | ||
} | ||
|
||
stage('Cleanup folders') { | ||
steps { | ||
script { | ||
// Cleanup previous stuff | ||
// Files | ||
sh("rm -f .gitignore") | ||
|
||
// Folders - EB job scm files | ||
sh("rm -rf .git/ .gitlab/ build/ com_api/ scripts/ template_overrides/") | ||
|
||
// Folders - Remaining files | ||
sh("rm -rf builds/ builds@tmp/") | ||
sh("rm -rf com_api/ com_api@tmp/") | ||
sh("rm -rf com_api-scm/ com_api-scm@tmp/") | ||
sh("rm -rf scripts/ scripts@tmp/") | ||
sh("rm -rf docs/ docs@tmp/") | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
failure { | ||
mail to: '[email protected]', | ||
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}", | ||
body: "Something is wrong with ${env.BUILD_URL}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
//!/usr/bin/env groovy | ||
|
||
pipeline { | ||
agent any | ||
stages { | ||
stage('Cleanup') { | ||
steps { | ||
script { | ||
// Cleanup previous stuff | ||
// Files | ||
sh("rm -f .gitignore") | ||
|
||
// Folders - API job scm files | ||
sh("rm -rf .git/ .gitlab/ build/ code/ docs/ scripts/") | ||
|
||
// Folders - Remaining files | ||
sh("rm -rf builds/ builds@tmp/") | ||
sh("rm -rf com_api/ com_api@tmp/") | ||
sh("rm -rf com_api-scm/ com_api-scm@tmp/") | ||
|
||
// Make directories needed to generate build | ||
// mkdir -p is for creatingparents directories as needed | ||
sh("mkdir -p builds") | ||
sh("mkdir com_api-scm") | ||
} | ||
} | ||
} | ||
|
||
stage('Checkout') { | ||
steps { | ||
script { | ||
// This is important, we need clone into different folder here, | ||
// Because, as part of tag based pull, we will be cloning same repo again | ||
dir('com_api-scm') { | ||
checkout scm | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Init') { | ||
steps { | ||
script { | ||
// Get tag name | ||
def apiVersion = env.getProperty("apiVersion") | ||
echo apiVersion | ||
|
||
// Define subextensions array having unique git repos | ||
// @TODO - move this to json itself? | ||
def subextensions = ['com_api'] | ||
|
||
// def props = readJSON text: '{}' // Add JSON here or specify file below | ||
def props = readJSON file: 'com_api-scm/build/version.json' | ||
|
||
subextensions.eachWithIndex { item, index -> | ||
// Do clone all subextensions repos by checking out corresponding tag | ||
sh("git clone --branch " + "v" + props['com_api'][apiVersion][item]['version'] + " --depth 1 " + props['com_api'][apiVersion][item]['repoUrl']) | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Copy files') { | ||
steps { | ||
script { | ||
// Copy com_api from com_api repo into builds folder | ||
sh("cp com_api/code/api.xml builds/") | ||
sh("cp com_api/code/script.api.php builds/") | ||
|
||
sh("cp -r com_api/code/admin builds/") | ||
sh("cp -r com_api/code/site builds/") | ||
sh("cp -r com_api/code/plugins builds/") | ||
} | ||
} | ||
} | ||
|
||
stage('Make zips') { | ||
steps { | ||
script { | ||
// Get commit id | ||
// @TODO - needs to define shortGitCommit at global level | ||
def gitCommit = '' | ||
def shortGitCommit = '' | ||
|
||
// For branch based build - we need the revision number of tag checked out, | ||
// So cd into `com_api` dir | ||
dir('com_api') { | ||
// gitCommit = env.getProperty('GIT_COMMIT') | ||
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(8) | ||
shortGitCommit = gitCommit[0..7] | ||
echo gitCommit | ||
echo shortGitCommit | ||
} | ||
|
||
// Now we are good to create zip for component, exclude unwanted folders | ||
// Cleanup build dir folders | ||
sh("rm -rf build/com_api") | ||
sh("rm -rf build/com_api@tmp") | ||
|
||
// Now we are good to create zip for package, pass folders to ignore as -x | ||
// @TODO - for some reasons above rm -rf commands not working, | ||
// So, need to skip those through -x param of zip command | ||
dir('builds/') { | ||
sh('zip -rq ../com_api_v' + apiVersion + '_' + shortGitCommit + '.zip . -x "com_api/*" "com_api@tmp/*"') | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Archive') { | ||
steps { | ||
script { | ||
// Get commit id | ||
// @TODO - needs to define shortGitCommit at global level | ||
def gitCommit = '' | ||
def shortGitCommit = '' | ||
|
||
// For branch based build - we need the revision number of tag checked out, | ||
// So cd into `com_api` dir | ||
dir('com_api') { | ||
// gitCommit = env.getProperty('GIT_COMMIT') | ||
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim().take(8) | ||
shortGitCommit = gitCommit[0..7] | ||
echo gitCommit | ||
echo shortGitCommit | ||
} | ||
|
||
// Archive Artifact | ||
archiveArtifacts 'com_api_v' + apiVersion + '_' + shortGitCommit + '.zip' | ||
} | ||
} | ||
} | ||
|
||
stage('Cleanup folders') { | ||
steps { | ||
script { | ||
// Cleanup previous stuff | ||
// Files | ||
sh("rm -f .gitignore") | ||
|
||
// Folders - EB job scm files | ||
sh("rm -rf .git/ .gitlab/ build/ com_api/ scripts/ template_overrides/") | ||
|
||
// Folders - Remaining files | ||
sh("rm -rf builds/ builds@tmp/") | ||
sh("rm -rf com_api/ com_api@tmp/") | ||
sh("rm -rf com_api-scm/ com_api-scm@tmp/") | ||
sh("rm -rf scripts/ scripts@tmp/") | ||
sh("rm -rf docs/ docs@tmp/") | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
failure { | ||
mail to: '[email protected]', | ||
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}", | ||
body: "Something is wrong with ${env.BUILD_URL}" | ||
} | ||
} | ||
} |