Create jenkins file for new jenkins.

Change version scheme to tag based versions.
This commit is contained in:
LexManos 2018-11-12 19:54:39 -08:00
parent 64c8f67939
commit 1f65388118
2 changed files with 90 additions and 12 deletions

65
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,65 @@
@Library('forge-shared-library')_
pipeline {
agent {
docker {
image 'gradlewrapper:latest'
args '-v gradlecache:/gradlecache'
}
}
environment {
GRADLE_ARGS = --no-daemon' // No daemon for now as FG3 kinda derps. //'-Dorg.gradle.daemon.idletimeout=5000'
}
stages {
stage('fetch') {
steps {
git(url: 'https://github.com/MinecraftForge/MinecraftForge.git', changelog: true)
}
}
cache(maxCacheSize: 250/*MB*/, caches: [
[$class: 'ArbitraryFileCache', excludes: 'log.txt', includes: '**/*', path: '${WORKSPACE}/projects/forge/build/extractRangeMap'] //Cache the rangemap to help speed up builds
]){
stage('buildandtest') {
steps {
sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue build test'
script {
env.MYVERSION = sh(returnStdout: true, script: './gradlew properties -q | grep "version:" | awk \'{print $2}\'').trim()
}
}
post {
success {
writeChangelog(currentBuild, 'build/changelog.txt')
archiveArtifacts artifacts: 'build/changelog.txt', fingerprint: false
}
}
}
stage('publish') {
when {
not {
changeRequest()
}
}
environment {
FORGE_MAVEN = credentials('forge-maven-forge-user')
CROWDIN = credentials('forge-crowdin')
KEYSTORE = credentials('forge-jenkins-keystore-old')
KEYSTORE_KEYPASS = credentials('forge-jenkins-keystore-old-keypass')
KEYSTORE_STOREPASS = credentials('forge-jenkins-keystore-old-keypass')
}
steps {
sh './gradlew ${GRADLE_ARGS} forge:publish -PforgeMavenUser=${FORGE_MAVEN_USR} -PforgeMavenPassword=${FORGE_MAVEN_PSW} -PkeystoreKeyPass=${KEYSTORE_KEYPASS} -PkeystoreStorePass=${KEYSTORE_STOREPASS} -Pkeystore=${KEYSTORE} -PcrowdinKey=${CROWDIN}'
//We're testing so use the test group
sh 'curl --user ${FORGE_MAVEN} http://files.minecraftforge.net/maven/manage/promote/latest/net.minecraftforge.test.forge/${MYVERSION}'
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'build/libs/**/*.jar', fingerprint: true
junit 'build/test-results/*/*.xml'
jacoco sourcePattern: '**/src/*/java'
}
}
}

View file

@ -30,9 +30,6 @@ plugins {
} }
apply plugin: 'eclipse' apply plugin: 'eclipse'
group = 'net.minecraftforge'
version = '1.0.0'
project(':mcp') { project(':mcp') {
apply plugin: 'net.minecraftforge.gradle.forgedev.mcp' apply plugin: 'net.minecraftforge.gradle.forgedev.mcp'
mcp { mcp {
@ -92,9 +89,20 @@ project(':forge') {
} }
ext { ext {
MC_VERSION = '1.13' MC_VERSION = '1.13'
SPEC_VERSION = '15.24.0' SPEC_VERSION = '24.0' // This is overwritten by git tag, but here so dev time doesnt explode
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
// ForgeMC is a unique identifier for every MC version we have supported.
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
MCP_ARTIFACT = project(':mcp').mcp.config MCP_ARTIFACT = project(':mcp').mcp.config
MCP_VERSION = project(':mcp').mcp.config.version.split('-')[1] // The timestamp only. MCP_VERSION = project(':mcp').mcp.config.version.split('-')[1] // The timestamp only.
if (project.hasProperty('keystore')) {
jarsigner = [
storepass: project.properties.keystoreStorePass,
keypass: project.properties.keystoreKeyPass,
keystore: project.properties.keystore
]
}
} }
patcher { patcher {
parent = project(':clean') parent = project(':clean')
@ -122,17 +130,22 @@ project(':forge') {
} }
def getVersion = { def getVersion = {
def out = MC_VERSION.replace('-', '_') + '-' + SPEC_VERSION + '.' + (System.getenv('BUILD_NUMBER') ?: project.ext.properties.buildNumber ?: 0) //TAG-offset-hash
def raw = grgit.describe(longDescr: true)
def desc = (raw == null ? '0.0-0-unknown' : grgit.describe(longDescr: true)).split('-') as List
def hash = desc.remove(desc.size() - 1)
def offset = desc.remove(desc.size() - 1)
def tag = desc.join('-')
def branch = grgit.branch.current().name def branch = grgit.branch.current().name
if (branch != null && branch != 'master' && branch != 'HEAD' && branch != MC_VERSION && branch != MC_VERSION + '.0') { if (branch in ['master', 'HEAD', MC_VERSION, MC_VERSION + '.0'])
if (!(branch.endsWith('.x') && MC_VERSION.startsWith(branch.substring(0, branch.length() -2)))) branch = null
out += "-${branch}" if (branch != null && branch.endsWith('.x') && MC_VERSION.startsWith(branch.substring(0, branch.length() - 2))) //1.13.x
} branch = null
println('Version: ' + out) SPEC_VERSION = tag
return out return "${tag}.${offset}${t -> if (branch != null) t << '-' + branch}"
} }
group = 'net.minecraftforge' group = 'net.minecraftforge.test' //TODO: remove when we jenkins is working
version = getVersion() version = getVersion()
applyPatches { applyPatches {
canonicalizeAccess true canonicalizeAccess true