Skip to content

Commit

Permalink
[#2625] prepare Jenkinsfile and Scripts for release builds
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Dietrich <[email protected]>
  • Loading branch information
cdietrich committed May 16, 2023
1 parent 18216f4 commit 7878194
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 0 deletions.
68 changes: 68 additions & 0 deletions jenkins/release-deploy/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
pipeline {
agent any

options {
buildDiscarder(logRotator(numToKeepStr:'15'))
disableConcurrentBuilds()
timeout(time: 120, unit: 'MINUTES')
}

parameters {
booleanParam(name: 'P2_DEPLOY_DRY_RUN', defaultValue: false, description:
'''
If set, the composite update site is created/updated locally (and archived), but it will
not be uploaded to the remote area: rsync will be executed with "--dry-run, -n"
''')
}

environment {
DOWNLOAD_AREA = '/home/data/httpd/download.eclipse.org/modeling/tmf/xtext'
REPOSITORY_PATH="${DOWNLOAD_AREA}/updates/releases"
}

tools {
maven "apache-maven-3.8.6"
jdk "temurin-jdk17-latest"
}

stages {
stage('Prepare download area') {
steps {
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh '''
echo ${REPOSITORY_PATH}
ssh [email protected] "mkdir -p $REPOSITORY_PATH"
'''
}
}
}
stage('Prepare versions for Release') {
steps {
sh './scripts/prepare-for-release.sh'
}
}
stage('Maven Tycho Build, Sign, Deploy') {
steps {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh 'gpg --batch --import "${KEYRING}"'
sh 'for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u); do echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust; done'
}
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
sh """
./full-deploy.sh -Peclipse-sign,sonatype-oss-release,release-release ${rsyncAdditionalArgs()}
"""
}
}
}
}

post {
success {
archiveArtifacts artifacts: 'build/**, org.eclipse.xtext.p2repository/target/checkout/**'
}
}
}

def rsyncAdditionalArgs() {
return params.P2_DEPLOY_DRY_RUN ? '-Dadditional-rsync-commit-args="-n"' : ''
}
70 changes: 70 additions & 0 deletions org.eclipse.xtext.p2repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -437,5 +437,75 @@
</plugins>
</build>
</profile>
<profile>
<!-- Activate this profile to perform a final release -->
<id>release-release</id>
<properties>
<remote-subdir>updates/releases</remote-subdir>
<!-- Note that for versions of final releases ${qualifiedVersion} == ${project.version} -->
<current-release-subdirectory>${qualifiedVersion}</current-release-subdirectory>
<zipFinalName>tmf-xtext-Update-${qualifiedVersion}</zipFinalName>
<site.label>TMF Xtext Update Site (Releases)</site.label>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<configuration>
<extraArtifactRepositoryProperties>
<p2.mirrorsURL>${p2.mirrorsURL}</p2.mirrorsURL>
</extraArtifactRepositoryProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>md5sum</id>
<phase>package</phase>
</execution>
<execution>
<id>rsync-update</id>
<phase>prepare-package</phase>
</execution>
<execution>
<id>rsync-commit</id>
<phase>verify</phase>
</execution>
<execution>
<id>rsync-commit-zip</id>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-repository</id>
<phase>package</phase>
</execution>
<execution>
<id>copy-zipped-repository</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
<executions>
<!-- add our new child repository -->
<execution>
<id>add-p2-composite-repository</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,22 @@
</plugins>
</build>
</profile>
<profile>
<!-- Activate it when performing a final release, so that
Tycho won't complain about different versions in OSGI and POM -->
<id>release-release</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<configuration>
<strictVersions>false</strictVersions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>replace-qualifier-with-timestamp</id>
<build>
Expand Down
50 changes: 50 additions & 0 deletions scripts/prepare-for-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh


# First, update the version of the BOM, which is disconnected from the parent.
# For example, 2.31.0-SNAPSHOT becomes 2.31.0

mvn -f org.eclipse.xtext.dev-bom \
build-helper:parse-version \
versions:set \
-DgenerateBackupPoms=false \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}

# The updated BOM must be installed, or the next runs will complain they can't find it.

mvn -f org.eclipse.xtext.dev-bom install

# Replace the property "xtext-dev-bom-version" in the parent POM, with the new version of the BOM.
# For example,
# <xtext-dev-bom-version>${project.version}</xtext-dev-bom-version>
# becomes
# <xtext-dev-bom-version>2.31.0</xtext-dev-bom-version>

mvn \
build-helper:parse-version \
versions:set-property \
-DgenerateBackupPoms=false \
-Dproperty=xtext-dev-bom-version \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}

# With Tycho, replace all versions (in POMs and Eclipse metadata) with the timestamp as the qualifier.
# For example, in POMs, 2.31.0-SNAPSHOT becomes 2.31.0.v2023...
# In MANIFEST and features, 2.31.0.qualifier becomes 2.31.0.v2023...

mvn \
-Preplace-qualifier-with-timestamp \
build-helper:parse-version \
build-helper:timestamp-property@timestamp \
org.eclipse.tycho:tycho-versions-plugin:set-version \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}.\${computedTimestamp} \
-DgenerateBackupPoms=false

# Update the versions in the POMs only with the release number as the qualifier
# For example, in POMs, 2.31.0.v2023... becomes 2.31.0
# In MANIFEST and features, 2.31.0.v2023... stays the same

mvn \
build-helper:parse-version \
versions:set \
-DgenerateBackupPoms=false \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}

0 comments on commit 7878194

Please sign in to comment.