Skip to content

Commit

Permalink
Simplify extraction of M2E_VERSION and fix archiving of m2e-repo
Browse files Browse the repository at this point in the history
Use xmllint and xpath to read the version of m2e.sdk/feature.xml in a
more robust and simpler way.

For the Jenkins archiveArtifacts plug-in the artifacts property has been
adjusted to the new name of the o.e.m2e.repository project.
  • Loading branch information
HannesWell committed Aug 29, 2022
1 parent 17503ce commit 472d0ed
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ pipeline {
}
stage('Build') {
steps {
sh 'mvn clean generate-sources -f m2e-maven-runtime/pom.xml -B -Dtycho.mode=maven -Pgenerate-osgi-metadata '
sh 'mvn clean generate-sources -f m2e-maven-runtime/pom.xml -B -Dtycho.mode=maven -Pgenerate-osgi-metadata'
wrap([$class: 'Xvnc', useXauthority: true]) {
sh 'mvn clean verify -f pom.xml -B -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Peclipse-sign,its -Dtycho.surefire.timeout=7200'
}
}
post {
always {
archiveArtifacts artifacts: 'org.eclipse.*.site/target/repository/**/*,org.eclipse.*.site/target/*.zip,*/target/work/data/.metadata/.log,m2e-core-tests/*/target/work/data/.metadata/.log,m2e-maven-runtime/target/*.properties'
archiveArtifacts artifacts: 'org.eclipse.m2e.repository/target/*.zip,\
*/target/work/data/.metadata/.log,\
m2e-core-tests/*/target/work/data/.metadata/.log,\
m2e-maven-runtime/target/*.properties'
archiveArtifacts (artifacts: '**/target/products/*.zip,**/target/products/*.tar.gz', onlyIfSuccessful: true)
junit '*/target/surefire-reports/TEST-*.xml,*/*/target/surefire-reports/TEST-*.xml'
}
Expand All @@ -48,17 +51,14 @@ pipeline {
scp -r org.eclipse.m2e.repository/target/repository/* genie.m2e@projects-storage.eclipse.org:${1}
}
# Read M2E branding version
regex='<feature id="org\\.eclipse\\.m2e\\.sdk\\.feature" label="%featureName" version="([0-9]\\.[0-9]\\.[0-9])\\.qualifier" '
content=$(echo $(<"org.eclipse.m2e.sdk.feature/feature.xml")) # replaces consecutive newline and tabs by single space
if [[ $content =~ $regex ]]
version=$(xmllint --xpath 'string(/feature/@version)' org.eclipse.m2e.sdk.feature/feature.xml)
if [[ $version =~ ([0-9]\\.[0-9]\\.[0-9])\\.qualifier ]] # backslash itself has to be escaped in Jenkinsfile
then
M2E_VERSION="${BASH_REMATCH[1]}"
echo M2E_VERSION=$M2E_VERSION
else
echo Failed to read M2E_VERSION. Abort deployment.
exit 1
fi
deployM2ERepository /home/data/httpd/download.eclipse.org/technology/m2e/snapshots/${M2E_VERSION}
deployM2ERepository /home/data/httpd/download.eclipse.org/technology/m2e/snapshots/latest
'''
Expand Down

0 comments on commit 472d0ed

Please sign in to comment.