Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit d5033d4

Browse files
authored
Setting up nightly job with github-release helper (#95)
* Setting up nightly job with github-release helper * move jenkins stuff to own folder * Moving jenkinsfile around * integrating github-release * Testing complete process * Simplifying the setup * cleanup
1 parent 2f32153 commit d5033d4

File tree

5 files changed

+164
-72
lines changed

5 files changed

+164
-72
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trim_trailing_whitespace = true
1111
indent_style = space
1212
indent_size = 2
1313

14-
[Jenkinsfile]
14+
[*.Jenkinsfile]
1515
indent_style = space
1616
indent_size = 4
1717

Jenkinsfile

Lines changed: 0 additions & 70 deletions
This file was deleted.

ci.multibranch.Jenkinsfile

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
properties([
2+
parameters([
3+
booleanParam(name: 'Reset', defaultValue: false, description: 'clean workspace files'),
4+
booleanParam(name: 'Clobber', defaultValue: false, description: 'run mach clobber'),
5+
booleanParam(name: 'Linux64', defaultValue: true, description: ''),
6+
booleanParam(name: 'Windows64', defaultValue: true, description: ''),
7+
booleanParam(name: 'MacOSX64', defaultValue: true, description: ''),
8+
string(name: 'ReleaseName', defaultValue: '', description: ''),
9+
]),
10+
])
11+
12+
def buildmatrix = [:]
13+
def signmatrix = [:]
14+
def shouldRelease = params.ReleaseName?.trim()
15+
def helpers
16+
17+
node('master') {
18+
checkout scm
19+
20+
helpers = load "release/build-helpers.groovy"
21+
}
22+
23+
if (params.Linux64) {
24+
def name = 'Linux64'
25+
def artifactGlob = 'obj-x86_64-pc-linux-gnu/dist/Ghostery-*'
26+
27+
buildmatrix[name] = {
28+
node('docker && !magrathea') {
29+
helpers.build(name, 'Linux.dockerfile', 'linux.mozconfig', 'obj-x86_64-pc-linux-gnu/dist/Ghostery-*', params)()
30+
stage("${name}: publish artifacts") {
31+
archiveArtifacts artifacts: "mozilla-release/${artifactGlob}"
32+
}
33+
}
34+
}
35+
}
36+
37+
if (params.Windows64) {
38+
def name = 'Windows64'
39+
def artifactGlob = 'obj-x86_64-pc-mingw32/dist/install/**/*'
40+
41+
buildmatrix[name] = {
42+
// we have to run windows builds on magrathea because that is where the vssdk mount is.
43+
node('docker && magrathea') {
44+
helpers.build(name, 'Windows.dockerfile', 'win64.mozconfig', artifactGlob, params)()
45+
stage("${name}: publish artifacts") {
46+
archiveArtifacts artifacts: "mozilla-release/${artifactGlob}"
47+
stash name: name, includes: "mozilla-release/${artifactGlob},mozilla-release/browser/config/version.txt,mozilla-release/other-licenses/7zstub/firefox/*,mozilla-release/browser/installer/windows/*"
48+
}
49+
}
50+
}
51+
52+
if (shouldRelease) {
53+
signmatrix["Sign ${name}"] = helpers.windows_signing(name, artifactGlob)
54+
}
55+
}
56+
57+
if (params.MacOSX64) {
58+
def name = 'MacOSX64'
59+
def artifactGlob = 'obj-x86_64-apple-darwin/dist/Ghostery-*'
60+
buildmatrix[name] = {
61+
node('docker && !magrathea') {
62+
helpers.build(name, 'MacOSX.dockerfile', 'macosx.mozconfig', 'obj-x86_64-apple-darwin/dist/Ghostery-*', params)()
63+
stage("${name}: publish artifacts") {
64+
archiveArtifacts artifacts: "mozilla-release/${artifactGlob}"
65+
// files needed for packaging
66+
stash includes: "mozilla-release/${artifactGlob},mozilla-release/build/package/mac_osx/unpack-diskimage,mozilla-release/security/mac/hardenedruntime/*", name: name
67+
}
68+
}
69+
}
70+
71+
if (shouldRelease) {
72+
signmatrix["Sign MacOSX64"] = helpers.mac_signing(name, artifactGlob)
73+
}
74+
}
75+
76+
parallel buildmatrix
77+
parallel signmatrix
78+
79+
stage('release') {
80+
if (shouldRelease) {
81+
helpers.withGithubRelease() {
82+
sh 'rm -rf artifacts'
83+
84+
unarchive mapping: ["mozilla-release/" : "artifacts"]
85+
86+
def artifacts = sh(returnStdout: true, script: 'find artifacts -type f').trim().split("\\r?\\n")
87+
88+
for(String artifactPath in artifacts) {
89+
def artifactName = artifactPath.split('/').last()
90+
sh """
91+
github-release upload \
92+
--user human-web \
93+
--repo user-agent-desktop \
94+
--tag "${params.ReleaseName}" \
95+
--name "${artifactName}" \
96+
--file "${artifactPath}"
97+
"""
98+
}
99+
100+
sh 'rm -rf artifacts'
101+
}
102+
}
103+
}

ci.nightly.Jenkinsfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
def VERSION_NAME
2+
def helpers
3+
4+
node() {
5+
VERSION_NAME = sh(returnStdout: true, script: 'date +%Y-%m-%d').trim()
6+
7+
checkout scm
8+
9+
helpers = load "release/build-helpers.groovy"
10+
11+
sh "git tag $VERSION_NAME || true"
12+
13+
withCredentials([
14+
usernamePassword(
15+
credentialsId: 'd60e38ae-4a5a-4eeb-ab64-32fd1fad4a28',
16+
passwordVariable: 'GITHUB_TOKEN',
17+
usernameVariable: 'GITHUB_USERNAME'
18+
)
19+
]) {
20+
sh "git push https://$GITHUB_TOKEN@github.com/human-web/user-agent-desktop.git --tags"
21+
}
22+
}
23+
24+
helpers.withGithubRelease() {
25+
sh """
26+
github-release release \
27+
--user human-web \
28+
--repo user-agent-desktop \
29+
--tag $VERSION_NAME \
30+
--name $VERSION_NAME \
31+
--pre-release
32+
"""
33+
}
34+
35+
build job: 'user-agent/desktop/master', parameters: [
36+
booleanParam(name: 'Reset', value: false),
37+
booleanParam(name: 'Clobber', value: false),
38+
string(name: 'ReleaseName', value: VERSION_NAME),
39+
booleanParam(name: 'Linux64', value: true),
40+
booleanParam(name: 'Windows64', value: true),
41+
booleanParam(name: 'MacOSX64', value: true),
42+
], propagate: false, wait: false

release/build-helpers.groovy

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,21 @@ def mac_signing(name, artifactGlob) {
198198
}
199199
}
200200

201-
return this
201+
def withGithubRelease(Closure body) {
202+
node('docker') {
203+
docker.image('golang').inside("-u root") {
204+
sh 'go get github.com/human-web/github-release'
205+
withCredentials([
206+
usernamePassword(
207+
credentialsId: 'd60e38ae-4a5a-4eeb-ab64-32fd1fad4a28',
208+
passwordVariable: 'GITHUB_TOKEN',
209+
usernameVariable: 'GITHUB_USERNAME'
210+
)
211+
]) {
212+
body()
213+
}
214+
}
215+
}
216+
}
217+
218+
return this

0 commit comments

Comments
 (0)