@@ -7,152 +7,47 @@ pipeline {
7
7
buildDiscarder(logRotator(numToKeepStr:'5'))
8
8
}
9
9
agent {
10
- label 'ubuntu-2404 '
10
+ label 'basic '
11
11
}
12
12
tools {
13
13
jdk 'temurin-jdk21-latest'
14
- }
15
- environment {
16
- ECLIPSE_EXE = installLatestReleasedEclipsePlatformProduct()
14
+ maven 'apache-maven-latest'
17
15
}
18
16
stages {
19
- stage('Check Composites Validity') {
20
- steps {
21
- sh '''
22
- for repo in ${add//,/ }; do
23
- if [[ $repo != http* ]]; then
24
- repo="https://download.eclipse.org/${repositoryPath}/${repo}"
25
- fi
26
- echo "Validate content consistency of: ${repo}"
27
- ${ECLIPSE_EXE} -application org.eclipse.equinox.p2.director -repository "${repo}" -list
28
- done
29
- '''
30
- // The resulting composite repository is not tested as it might not exist yet.
31
- }
32
- }
33
17
stage('Update composite repository') {
34
18
environment {
35
- ANT_TASK_NAME = 'modifyComposite'
36
19
OUTPUT_PATH = 'output-repository'
37
20
}
38
21
steps {
39
- script {
40
- def boolean sourceRepositoryExists = sh(script: "curl --fail -o compositeArtifacts.jar https://download.eclipse.org/${repositoryPath}/compositeArtifacts.jar", returnStatus: true) == 0
41
- def compositeChildren = []
42
- if (sourceRepositoryExists) {
43
- def childenXPathSet = sh(script: '''#!/bin/sh +xe
44
- unzip -p compositeArtifacts.jar compositeArtifacts.xml |\
45
- xmllint - --xpath '/repository/children/child/@location'
46
- exit 0
47
- ''', returnStdout: true).trim()
48
- compositeChildren = 'XPath set is empty' == childenXPathSet ? []
49
- : parseList(childenXPathSet, '\\s+')
50
- .collect{c -> c.startsWith('location="') && c.endsWith('"') ? c.substring(10, c.length() - 1) : null}
51
- .findAll{c -> c != null}
52
- }
53
-
54
- echo "Current children: ${compositeChildren}"
55
- def toAdd = parseList(params.add, ',').unique()
56
- def toRemove = parseList(params.remove, ',').unique()
57
- toRemove = toRemove.findAll{e -> compositeChildren.contains(e)}
58
- def repositoryName = params.repositoryName.trim()
22
+ sh """
23
+ git clone --depth=1 --filter=tree:0 --no-checkout --branch=${scm.branches[0].name} ${scm.userRemoteConfigs[0].url} repository
24
+ pushd repository
25
+ git sparse-checkout set --no-cone eclipse-platform-parent/pom.xml
26
+ git checkout
27
+ popd
59
28
60
- if (params.sizeLimit) {
61
- def sizeRestrictionRemovals = compositeChildren.size() + toAdd.size() - toRemove.size() - Integer.parseInt(params.sizeLimit)
62
- if (sizeRestrictionRemovals > 0) {
63
- toRemove += compositeChildren.subList(0, sizeRestrictionRemovals)
64
- }
65
- }
66
- echo "Children added: ${toAdd}"
67
- echo "Children removed: ${toRemove}"
68
- if (!toRemove.isEmpty() && compositeChildren.size() + toAdd.size() - toRemove.size() == 0) {
69
- error('All children are removed and composite repository becomes empty.')
70
- }
71
- def modifyComposite_xml = """\
72
- <?xml version="1.0" encoding="UTF-8"?>
73
- <project default="${ANT_TASK_NAME}" basedir=".">
74
- <target name="${ANT_TASK_NAME}">
75
- <p2.composite.repository>
76
- <repository location="${OUTPUT_PATH}" ${repositoryName ? ('name="' + repositoryName + '"') :''}/>
77
- """.stripIndent()
78
- if (sourceRepositoryExists) {
79
- modifyComposite_xml +=""" <source location="https://download.eclipse.org/${repositoryPath}" />"""
80
- }
81
- for (child in toAdd) {
82
- modifyComposite_xml += """ <add><repository location="${child}"/></add>\n"""
83
- }
84
- for (child in toRemove) {
85
- modifyComposite_xml += """ <remove><repository location="${child}"/></remove>\n"""
86
- }
87
- modifyComposite_xml+= '''\
88
- </p2.composite.repository>
89
- </target>
90
- </project>
91
- '''.stripIndent()
92
- writeFile(file: "${ANT_TASK_NAME}.xml", text: modifyComposite_xml)
93
-
94
- sh '''
95
- ${ECLIPSE_EXE} -debug -data ./eclipse-ws \
96
- -application org.eclipse.ant.core.antRunner -file "${ANT_TASK_NAME}.xml" "${ANT_TASK_NAME}"
97
- '''
98
- //TODO: Let p2 produce p2.index file
99
- writeFile(file: "${OUTPUT_PATH}/p2.index", text: """\
100
- #${new Date()}
101
- version=1
102
- metadata.repository.factory.order=compositeContent.xml,\\!
103
- artifact.repository.factory.order=compositeArtifacts.xml,\\!
104
- """.stripIndent())
105
-
106
- // The composite files are somehow not compressed if the repository is empty...
107
- sh '''
108
- cd "${OUTPUT_PATH}"
109
- if [[ -f compositeArtifacts.xml ]]; then
110
- zip compositeArtifacts.jar compositeArtifacts.xml
111
- rm compositeArtifacts.xml
112
- fi
113
- if [[ -f compositeContent.xml ]]; then
114
- zip compositeContent.jar compositeContent.xml
115
- rm compositeContent.xml
116
- fi
117
- '''
29
+ mvn tycho-p2-repository:modify-composite-repository -Pp2-repository-modification \\
30
+ --file ${WORKSPACE}/repository/eclipse-platform-parent/pom.xml \\
31
+ -Dp2.repository.location=https://download.eclipse.org/${params.repositoryPath}/ \\
32
+ -Dp2.repository.output=${WORKSPACE}/${OUTPUT_PATH} \\
33
+ -Dp2.composite.children.add=${params.add} \\
34
+ -Dp2.composite.children.remove=${params.remove} \\
35
+ -Dp2.composite.children.limit=${params.sizeLimit ?: 0} \\
36
+ ${params.repositoryName ? ("-Dp2.repository.name='" + params.repositoryName + "'") : ''} \\
37
+ """
118
38
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
119
39
sh '''
120
40
epDownloadsDir='/home/data/httpd/download.eclipse.org'
121
41
ssh
[email protected] mkdir -p "${epDownloadsDir}/${repositoryPath}"
122
42
scp -r ${OUTPUT_PATH}/* "
[email protected] :${epDownloadsDir}/${repositoryPath}"
123
43
'''
124
- }
125
44
}
126
45
}
127
46
}
128
47
}
129
48
post {
130
49
always {
131
- archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: 'tools/**/*'
50
+ archiveArtifacts allowEmptyArchive: true, artifacts: '**/*'
132
51
}
133
52
}
134
53
}
135
-
136
- @NonCPS
137
- def parseList(String str, String delimiterPattern) {
138
- return str !=null && !str.trim().isEmpty() ? str.trim().split(delimiterPattern).collect{c -> c.trim()} : []
139
- }
140
-
141
- def installLatestReleasedEclipsePlatformProduct() {
142
- sh 'curl -o buildproperties.txt https://download.eclipse.org/eclipse/relengScripts/cje-production/buildproperties.txt'
143
- def eclipseURL = sh(script: '''#!/bin/sh +xe
144
- source ./buildproperties.txt
145
- #TODO: Remove this after the next release!
146
- PREVIOUS_RELEASE_ID='S-4.37M3-202508141800'
147
- PREVIOUS_RELEASE_VER='4.37M3'
148
- echo "https://download.eclipse.org/eclipse/downloads/drops4/${PREVIOUS_RELEASE_ID}/eclipse-platform-${PREVIOUS_RELEASE_VER}-linux-gtk-x86_64.tar.gz"
149
- ''', returnStdout: true).trim()
150
- return install('eclipse-platform', eclipseURL) + '/eclipse -nosplash --launcher.suppressErrors -consolelog'
151
- }
152
-
153
- def install(String toolType, String url) {
154
- dir("${WORKSPACE}/tools/${toolType}") {
155
- sh "curl -L ${url} | tar -xzf -"
156
- return "${pwd()}/" + sh(script: 'ls', returnStdout: true).trim()
157
- }
158
- }
0 commit comments