Skip to content

Commit 71d5d6f

Browse files
committed
Merge branch 'main' of github.com:eclipse-sumo/sumo into Netedit_dev
2 parents 02603f5 + 759544c commit 71d5d6f

File tree

780 files changed

+45842
-22693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

780 files changed

+45842
-22693
lines changed

.jenkins/sign-macos-installer.jenkinsfile

Lines changed: 132 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ spec:
1212
- name: jnlp
1313
resources:
1414
limits:
15-
memory: "1Gi"
15+
memory: "2Gi"
1616
cpu: "500m"
1717
requests:
18-
memory: "1Gi"
18+
memory: "2Gi"
1919
cpu: "500m"
2020
- name: ubuntu-sumo
2121
image: ghcr.io/eclipse/eclipse-sumo-build-ubuntu:latest
@@ -75,10 +75,7 @@ spec:
7575
script {
7676
// Step 1: Find the last successful workflow run
7777
def workflowRunsResponse = sh(
78-
script: """
79-
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -s \
80-
"https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/${WORKFLOW_ID}/runs?status=success"
81-
""",
78+
script: 'curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/${WORKFLOW_ID}/runs?status=success"',
8279
returnStdout: true
8380
).trim()
8481

@@ -87,14 +84,12 @@ spec:
8784
if (!workflowRuns.workflow_runs || workflowRuns.workflow_runs.size() == 0) {
8885
error("No successful workflow runs found for workflow: ${WORKFLOW_ID}")
8986
}
87+
9088
def lastRunId = workflowRuns.workflow_runs[0].id
9189

9290
// Step 2: Get the artifact list for the last successful run
9391
def artifactsResponse = sh(
94-
script: """
95-
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -s \
96-
"https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/runs/${lastRunId}/artifacts"
97-
""",
92+
script: 'curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/runs/' + "${lastRunId}" + '/artifacts"',
9893
returnStdout: true
9994
).trim()
10095

@@ -106,13 +101,136 @@ spec:
106101
}
107102

108103
// Step 3: Download the artifact
109-
sh """
110-
curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -L \
111-
"${artifact.archive_download_url}" --output ${ARTIFACT_NAME}.zip
112-
"""
104+
sh 'curl -H "Authorization: Bearer ${GITHUB_TOKEN}" -L "' + "${artifact.archive_download_url}" + '" --output ${ARTIFACT_NAME}.zip'
113105

114106
// Step 4: Extract the artifact
115107
sh "unzip -o ${ARTIFACT_NAME}.zip -d artifact"
108+
109+
// Step 5: Create the entitlements file
110+
def entitlementsFile = "sumo.entitlement"
111+
writeFile file: entitlementsFile, text: '''
112+
<?xml version="1.0" encoding="UTF-8"?>
113+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
114+
<plist version="1.0">
115+
<dict>
116+
<key>com.apple.security.cs.allow-jit</key>
117+
<true/>
118+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
119+
<true/>
120+
<key>com.apple.security.cs.disable-executable-page-protection</key>
121+
<true/>
122+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
123+
<true/>
124+
<key>com.apple.security.cs.disable-library-validation</key>
125+
<true/>
126+
<key>com.apple.security.cs.debugger</key>
127+
<true/>
128+
</dict>
129+
</plist>'''
130+
131+
// Step 6: Extract the .dmg file name dynamically
132+
def dmgFile = sh(
133+
script: "ls artifact/*.dmg",
134+
returnStdout: true
135+
).trim()
136+
137+
if (!dmgFile) {
138+
error("No .dmg file found in artifact directory")
139+
}
140+
141+
// Extract the base name of the .dmg file (without the extension)
142+
def baseName = dmgFile.replaceAll(/\.dmg$/, "")
143+
144+
// Define the signed DMG file name
145+
def signedDmgFile = "${baseName}-signed.dmg"
146+
147+
// Step 7: Upload for signing
148+
sh """
149+
curl -o ${signedDmgFile} -F file=@${dmgFile} -F entitlements=@${entitlementsFile} \
150+
https://cbi.eclipse.org/macos/codesign/sign
151+
"""
152+
153+
// Verify signed file
154+
if (!fileExists(signedDmgFile)) {
155+
error("Signed DMG file not created: ${signedDmgFile}")
156+
}
157+
158+
echo "Signed DMG file created successfully: ${signedDmgFile}"
159+
160+
// Step 8: Notarize the signed DMG
161+
def notarizedZip = "macos-14-installer.zip"
162+
def primaryBundleId = "org.eclipse.sumo"
163+
164+
// Regular expressions to extract UUID and status
165+
def uuidRegex = /"uuid"\s*:\s*"([^"]+)"/
166+
def statusRegex = /"status"\s*:\s*"([^"]+)"/
167+
168+
echo "Starting notarization process for ${signedDmgFile}"
169+
170+
// Initiate notarization
171+
def response = sh(
172+
script: """
173+
curl -X POST -F file=@${signedDmgFile} \
174+
-F 'options={"primaryBundleId": "${primaryBundleId}", "staple": true};type=application/json' \
175+
https://cbi.eclipse.org/macos/xcrun/notarize
176+
""",
177+
returnStdout: true
178+
).trim()
179+
180+
// Extract UUID and status from the response
181+
def uuidMatch = (response =~ uuidRegex)
182+
def statusMatch = (response =~ statusRegex)
183+
184+
if (!uuidMatch || !statusMatch) {
185+
error("Failed to extract UUID or status from notarization response: ${response}")
186+
}
187+
188+
def uuid = uuidMatch[0][1]
189+
def status = statusMatch[0][1]
190+
191+
echo "Notarization initiated with UUID: ${uuid}, initial status: ${status}"
192+
193+
// Polling notarization status
194+
while (status == "IN_PROGRESS") {
195+
sleep 60
196+
def pollResponse = sh(
197+
script: "curl -s https://cbi.eclipse.org/macos/xcrun/${uuid}/status",
198+
returnStdout: true
199+
).trim()
200+
201+
statusMatch = (pollResponse =~ statusRegex)
202+
if (!statusMatch) {
203+
error("Failed to extract status from notarization polling response: ${pollResponse}")
204+
}
205+
status = statusMatch[0][1]
206+
echo "Notarization progress: ${pollResponse}"
207+
}
208+
209+
if (status != "COMPLETE") {
210+
error("Notarization failed: ${response}")
211+
}
212+
213+
// Download the notarized result
214+
sh """
215+
curl -o ${notarizedZip} https://cbi.eclipse.org/macos/xcrun/${uuid}/download
216+
"""
217+
218+
echo "Notarization completed. Downloaded notarized ZIP: ${notarizedZip}"
219+
220+
// Step 9: Upload notarized ZIP back to the GitHub Actions workflow
221+
def uploadUrl = "https://uploads.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/runs/${lastRunId}/artifacts"
222+
def artifactName = "macos-14-installer"
223+
224+
// Upload the artifact
225+
sh """
226+
curl -X POST -H "Authorization: Bearer ${GITHUB_TOKEN}" \
227+
-H "Content-Type: application/json" \
228+
-F name=${artifactName} \
229+
-F file=@${notarizedZip} \
230+
${uploadUrl}
231+
"""
232+
233+
echo "Uploaded notarized artifact '${notarizedZip}' as '${artifactName}' to GitHub Actions workflow: ${lastRunId}"
116234
}
117235
}
118236
}

0 commit comments

Comments
 (0)