Commit 8618d894 authored by Balazs Grill's avatar Balazs Grill
Browse files

Bug 574231 Added jenkinsfile to control build/release process

Change-Id: Ie66eba48d1fb7acb2033cd8fd4eece604538b311
parent 36001ebe
Loading
Loading
Loading
Loading

Jenkinsfile

0 → 100644
+68 −0
Original line number Diff line number Diff line
pipeline {
	agent {
        kubernetes {
            label 'centos7-6gb'
        }
    }
    
	parameters {
        choice choices: ['ci', 'integration', 'milestone', 'release'],
            description: 'Sets the build type. CI builds are used for testing reasons only; integration builds are periodic builds; milestones are considered more-or-less stable, while releases are Eclipse.org releases with a corresponding release review.',
            name: 'BUILD_TYPE'
        string defaultValue: '',
            description: 'If set, the tycho-versions plugin is used to update the versions of the Maven plugins before deployment for graduated plugins',
            name: 'RELEASE_VERSION'
	}
	options {
		buildDiscarder(logRotator(numToKeepStr: '5'))
        timeout(120 /*minutes*/) 
	}
	environment {
	   VERSION_MAVEN_PARAMETER = " ${params.RELEASE_VERSION ? '-Drepository.version=' + params.RELEASE_VERSION : ''} "
	   SIGN_BUILD_PARAMETER = " ${params.BUILD_TYPE == 'ci' ? '' : '-Peclipse-sign'} "
	}
	
	tools {
        maven 'apache-maven-latest'
        jdk 'oracle-jdk8-latest' //AdoptOpenJDK does not work because of JavaFX dependencies
    }

	stages {
		stage('Full build') { 
			steps {
                xvnc {
                    sh "mvn -B -f releng/org.eclipse.sphinx.releng.builds/parent/pom.xml ${SIGN_BUILD_PARAMETER} ${VERSION_MAVEN_PARAMETER} -Dmaven.repo.local=$WORKSPACE/.repository -Dmaven.test.failure.ignore=true clean install"
                }
			}
		}
		stage('download.eclipse.org') {
		  when {expression { return params.BUILD_TYPE != "ci" }}
		  steps {
		      sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
		          sh '''
                        export PROJECT=$WORKSPACE/releng/org.eclipse.sphinx.releng.builds/repository
                        export WORK_DIR=$PROJECT/work
                        export BUILD_DIR=/home/data/httpd/download.eclipse.org/sphinx/updates/$BUILD_TYPE
                        
                        export VERSION=$(<$PROJECT/target/classes/version)
                        mkdir $WORK_DIR
                        
                        # Upload repository to download.eclipse.org
                        ssh -o BatchMode=yes genie.sphinx@projects-storage.eclipse.org mkdir $BUILD_DIR/$VERSION
                        scp -o BatchMode=yes -r $PROJECT/target/repository/* genie.sphinx@projects-storage.eclipse.org:$BUILD_DIR/$VERSION
                        # Upload latest repository
                        scp -o BatchMode=yes -r $PROJECT/target/classes/latest genie.sphinx@projects-storage.eclipse.org:$BUILD_DIR
		          '''
		      }
		  }
		}
	}

	post {
		always {
			archiveArtifacts artifacts: 'releng/org.eclipse.sphinx.releng.builds/repository/target/repository/**'
            archiveArtifacts artifacts: 'releng/org.eclipse.sphinx.releng.builds/repository/target/org.eclipse.sphinx.updates-*.zip'
			junit testResults: '**/tests/**/target/surefire-reports/*.xml'
		}
    }
}
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -35,8 +35,8 @@
		<url>https://bugs.eclipse.org/bugs</url>
	</issueManagement>
	<ciManagement>
		<url>https://hudson.eclipse.org/sphinx</url>
		<system>Eclipse Hudson</system>
		<url>https://ci.eclipse.org/sphinx/</url>
		<system>Eclipse Jenkins</system>
	</ciManagement>
	<properties>
		<tycho.version>1.0.0</tycho.version>
+26 −0
Original line number Diff line number Diff line
@@ -12,4 +12,30 @@
	<artifactId>org.eclipse.sphinx.updates</artifactId>
	<version>0.11.2-SNAPSHOT</version>
	<packaging>eclipse-repository</packaging>
	<properties>
		<repository.version>${qualifiedVersion}</repository.version>
	</properties>
	<build>
		<!-- This block is used to create a file containing the qualified version of the build for the repository deployment script in the Jenkinsfile -->
        <resources>
            <resource>
                <directory>resources</directory>
                <includes>
                    <include>version</include>
                    <include>latest/*</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
        	<plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-repository-plugin</artifactId>
                <configuration>
                    <repositoryName>SPHINX</repositoryName>
                    <includePackedArtifacts>true</includePackedArtifacts>
                </configuration>
            </plugin>
        </plugins>
	</build>
</project>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
${repository.version}
 No newline at end of file