Skip to content

Commit 4f069ee

Browse files
yueyehmyueye@agora.ioLichKing-2234
authored
Ci landing/release/4.1.0 (#934)
* [Rehoboam]: Init workflow pipeline Init workflow electron-sdk-build-windows-release.bat edited online with Bitbucket * init pipeline * init pipeline * build: fix failed on Windows Co-authored-by: sdk-bitbucket <sdk-bitbucket> Co-authored-by: [email protected] <[email protected]> Co-authored-by: HUI <[email protected]>
1 parent 2f49a4e commit 4f069ee

7 files changed

+440
-1
lines changed

Jenkinsfile_bitbucket.groovy

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
@Library('agora-build-pipeline-library') _
3+
4+
pipelineLoad(this, "ELECTRON", "workflow", "", "", "electron-sdk")
5+

ci/build/build_all_platforms.groovy

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
properties([
2+
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '7', numToKeepStr: '100')),
3+
parameters([
4+
string(name: 'electron_sdk_branch', defaultValue: '', description: 'Electron branch', trim: true),
5+
string(name: 'ad_continuous_branch', defaultValue: 'master', description: 'CI branch', trim: true),
6+
string(name: 'network_path', defaultValue: '', description: '', trim: true),
7+
string(name: 'package_version', defaultValue: 'package_version', trim: true),
8+
string(name: 'example_sdk_mode', defaultValue: '', description: '', trim: true),
9+
string(name: 'example_electron_version', defaultValue: '', description: '', trim: true),
10+
booleanParam(name: 'Upload_CDN', defaultValue: false),
11+
booleanParam(name: 'isBuildDemo', defaultValue: false),
12+
]),
13+
[$class: 'ThrottleJobProperty',
14+
categories: [],
15+
limitOneJobWithMatchingParams: false,
16+
maxConcurrentPerNode: 1,
17+
maxConcurrentTotal: 0,
18+
paramsToUseForLimit: '',
19+
throttleEnabled: false,
20+
throttleOption: 'project']
21+
])
22+
23+
timestamps {
24+
def commonBuildParams = [
25+
string(name: 'electron_sdk_branch', value: params.electron_sdk_branch),
26+
string(name: 'ad_continuous_branch', value: params.ad_continuous_branch),
27+
string(name: 'network_path', value: params.network_path),
28+
string(name: 'example_sdk_mode', value: params.example_sdk_mode),
29+
string(name: 'example_electron_version', value: params.example_electron_version),
30+
string(name: 'package_version', value: params.package_version),
31+
booleanParam(name: 'Package_Publish', value: true),
32+
booleanParam(name:'Clean_Clone', value: true),
33+
booleanParam(name:'isBuildSdk', value: true),
34+
booleanParam(name:'isBuildDemo', value: params.isBuildDemo),
35+
booleanParam(name: 'Upload_CDN', value: params.Upload_CDN)
36+
]
37+
38+
def buildJobs = [
39+
"electron_mac_build": {
40+
build job: 'ELECTRON/build_mac', parameters: commonBuildParams + [
41+
string(name: 'arch', value: 'x64')
42+
]
43+
},
44+
"electron_windows_x86_build": {
45+
build job: 'ELECTRON/build_windows', parameters: commonBuildParams + [
46+
string(name: 'arch', value: "ia32"),
47+
]
48+
},
49+
"electron_windows_x64_build": {
50+
build job: 'ELECTRON/build_windows', parameters: commonBuildParams + [
51+
string(name: 'arch', value: "x64"),
52+
]
53+
}
54+
]
55+
parallel buildJobs
56+
}

ci/build/build_mac.groovy

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// -*- mode: groovy -*-
2+
// vim: set filetype=groovy :
3+
@Library('agora-build-pipeline-library') _
4+
import groovy.transform.Field
5+
6+
buildUtils = new agora.build.BuildUtils()
7+
8+
compileConfig = [
9+
"sourceDir": "electron-sdk",
10+
"non-publish": [
11+
"command": "./ci/build/build_mac.sh",
12+
"extraArgs": "",
13+
],
14+
"publish": [
15+
"command": "./ci/build/build_mac.sh",
16+
"extraArgs": "",
17+
]
18+
]
19+
20+
def doBuild(buildVariables) {
21+
type = params.Package_Publish ? "publish" : "non-publish"
22+
command = compileConfig.get(type).command
23+
preCommand = compileConfig.get(type).get("preCommand", "")
24+
postCommand = compileConfig.get(type).get("postCommand", "")
25+
extraArgs = compileConfig.get(type).extraArgs
26+
extraArgs += " " + params.getOrDefault("extra_args", "")
27+
commandConfig = [
28+
"command": command,
29+
"sourceRoot": "${compileConfig.sourceDir}",
30+
"extraArgs": extraArgs
31+
]
32+
loadResources(["config.json", "artifactory_utils.py"])
33+
buildUtils.customBuild(commandConfig, preCommand, postCommand)
34+
}
35+
36+
def doPublish(buildVariables) {
37+
if (!params.Package_Publish) {
38+
return
39+
}
40+
(shortVersion, releaseVersion) = buildUtils.getBranchVersion()
41+
def archiveInfos = [
42+
[
43+
"type": "ARTIFACTORY",
44+
"archivePattern": "*.zip",
45+
"serverPath": "ELECTRON/${shortVersion}/${buildVariables.buildDate}/${env.platform}",
46+
"serverRepo": "AD_repo" // ATTENTIONS: Update the artifactoryRepo if needed.
47+
]
48+
]
49+
archiveUrls = archive.archiveFiles(archiveInfos) ?: []
50+
archiveUrls = archiveUrls as Set
51+
if (archiveUrls) {
52+
def content = archiveUrls.join("\n")
53+
writeFile(file: 'package_urls', text: content, encoding: "utf-8")
54+
}
55+
archiveArtifacts(artifacts: "package_urls", allowEmptyArchive:true)
56+
sh "rm -rf *.zip || true"
57+
}
58+
59+
pipelineLoad(this, "ELECTRON", "build", "mac", "electron_mac")

ci/build/build_mac.sh

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# --------------------------------------------------------------------------------------------------------------------------
2+
# =====================================
3+
# ========== Guidelines ===============
4+
# =====================================
5+
#
6+
# -------------------------------------
7+
# ---- Common Environment Variable ----
8+
# -------------------------------------
9+
# ${Package_Publish} (boolean): Indicates whether it is build package process, e.g. If you want to get one CI SDK package.
10+
# ${Clean_Clone} (boolean): Indicates whether it is clean build. If true, CI will clean ${output} for each build process.
11+
# ${is_tag_fetch} (boolean): If true, git checkout will work as tag fetch mode.
12+
# ${is_official_build} (boolean): Indicates whether it is official build release.
13+
# ${arch} (string): Indicates build arch set in build pipeline.
14+
# ${short_version} (string): CI auto generated short version string.
15+
# ${release_version} (string): CI auto generated version string.
16+
# ${build_date} (string(yyyyMMdd)): Build date generated by CI.
17+
# ${build_timestamp} (string (yyyyMMdd_hhmm)): Build timestamp generated by CI.
18+
# ${platform} (string): Build platform generated by CI.
19+
# ${BUILD_NUMBER} (string): Build number generated by CI.
20+
# ${WORKSPACE} (string): Working dir generated by CI.
21+
#
22+
# -------------------------------------
23+
# ------- Job Custom Parameters -------
24+
# -------------------------------------
25+
# If you added one custom parameter via rehoboam website, e.g. extra_args.
26+
# You could use $extra_args to get its value.
27+
#
28+
# -------------------------------------
29+
# ------------- Input -----------------
30+
# -------------------------------------
31+
# ${source_root}: Source root which checkout the source code.
32+
# ${WORKSPACE}: project owned private workspace.
33+
#
34+
# -------------------------------------
35+
# ------------- Output ----------------
36+
# -------------------------------------
37+
# Generally, we should put the output files into ${WORKSPACE}
38+
# 1. for pull request: Output files should be zipped to test.zip, and then copy to ${WORKSPACE}.
39+
# 2. for pull request (options): Output static xml should be static_${platform}.xml, and then copy to ${WORKSPACE}.
40+
# 3. for others: Output files should be zipped to anything_you_want.zip, and then copy it to {WORKSPACE}.
41+
#
42+
# -------------------------------------
43+
# --------- Avaliable Tools -----------
44+
# -------------------------------------
45+
# Compressing & Decompressing: 7za a, 7za x
46+
#
47+
# -------------------------------------
48+
# ----------- Test Related ------------
49+
# -------------------------------------
50+
# PR build, zip test related to test.zip
51+
# Package build, zip package related to package.zip
52+
#
53+
# -------------------------------------
54+
# ------ Publish to artifactory -------
55+
# -------------------------------------
56+
# [Download] artifacts from artifactory:
57+
# python3 ${WORKSPACE}/artifactory_utils.py --action=download_file --file=ARTIFACTORY_URL
58+
#
59+
# [Upload] artifacts to artifactory:
60+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --project
61+
# Sample Code:
62+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --project
63+
#
64+
# [Upload] artifacts folder to artifactory
65+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --project --with_folder
66+
# Sample Code:
67+
# python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=./folder --project --with_folder
68+
#
69+
# ========== Guidelines End=============
70+
# --------------------------------------------------------------------------------------------------------------------------
71+
72+
echo Package_Publish: $Package_Publish
73+
echo is_tag_fetch: $is_tag_fetch
74+
echo arch: $arch
75+
echo source_root: %source_root%
76+
echo output: /tmp/jenkins/${project}_out
77+
echo build_date: $build_date
78+
echo build_time: $build_time
79+
echo release_version: $release_version
80+
echo short_version: $short_version
81+
echo pwd: `pwd`
82+
83+
echo isBuildSdk: $isBuildSdk
84+
echo isBuildDemo: $isBuildDemo
85+
echo Upload_CDN: $Upload_CDN
86+
echo example_electron_version: $example_electron_version
87+
echo example_sdk_mode: $example_sdk_mode
88+
echo package_version: $package_version
89+
90+
91+
pushd /tmp/jenkins/Electron-SDK
92+
93+
rm -rf *.zip || true
94+
rm -rf Electron-SDK || true
95+
rm -rf example/dist || true
96+
97+
if [ "$isBuildSdk" = true ]
98+
then
99+
sh /tmp/jenkins/Electron-SDK/ci/electron-sdk-build-mac-release.sh
100+
101+
# electron.zip
102+
# 执行上传到artifactory
103+
echo 执行上传electron.zip到artifactory
104+
cp -f electron.zip $WORKSPACE/${build_time}_${package_version}_mac.zip
105+
if [ "$Upload_CDN" = true ]
106+
then
107+
# electron.zip
108+
# 执行上传SDK到CDN
109+
echo 执行上传electron.zip到CDN
110+
fi
111+
112+
if [ "$example_sdk_mode" = 1 ]
113+
then
114+
unzip electron.zip -d ./Electron-SDK/
115+
fi
116+
fi
117+
118+
if [ "$isBuildDemo" = true ]
119+
then
120+
https_proxy=http://10.80.1.174:1080 sh /tmp/jenkins/Electron-SDK/ci/packager-mac.sh $example_sdk_mode $example_electron_version
121+
# electronDemo.zip
122+
# 执行上传到artifactory
123+
echo 执行上传electronDemo.zip到artifactory
124+
cp -f electronDemo.zip $WORKSPACE/${build_time}_mac_${package_version}_electron_demo.zip
125+
fi
126+
popd

ci/build/build_windows.bat

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
REM --------------------------------------------------------------------------------------------------------------------------
2+
REM ========== Guidelines ===============
3+
REM
4+
REM -------------------------------------
5+
REM ---- Common Environment Variable ----
6+
REM -------------------------------------
7+
REM ${Package_Publish} (boolean): Indicates whether it is build package process, e.g. If you want to get one CI SDK package.
8+
REM ${Clean_Clone} (boolean): Indicates whether it is clean build. If true, CI will clean ${output} for each build process.
9+
REM ${is_tag_fetch} (boolean): If true, git checkout will work as tag fetch mode.
10+
REM ${is_official_build} (boolean): Indicates whether it is official build release.
11+
REM ${arch} (string): Indicates build arch set in build pipeline.
12+
REM ${short_version} (string): CI auto generated short version string.
13+
REM ${release_version} (string): CI auto generated version string.
14+
REM ${build_date} (string(yyyyMMdd)): Build date generated by CI.
15+
REM ${build_timestamp} (string (yyyyMMdd_hhmm)): Build timestamp generated by CI.
16+
REM ${platform} (string): Build platform generated by CI.
17+
REM ${BUILD_NUMBER} (string): Build number generated by CI.
18+
REM ${WORKSPACE} (string): Working dir generated by CI.
19+
REM
20+
REM -------------------------------------
21+
REM ------- Job Custom Parameters -------
22+
REM -------------------------------------
23+
REM If you added one custom parameter via rehoboam website, e.g. extra_args.
24+
REM You could use $extra_args to get its value.
25+
REM
26+
REM -------------------------------------
27+
REM ------------- Input -----------------
28+
REM -------------------------------------
29+
REM ${source_root}: Source root which checkout the source code.
30+
REM ${WORKSPACE}: project owned private workspace.
31+
REM
32+
REM -------------------------------------
33+
REM ------------- Output ----------------
34+
REM -------------------------------------
35+
REM Generally, we should put the output files into %WORKSPACE%
36+
REM 1. for pull request: Output files should be zipped to test.zip, and then copy to %WORKSPACE%.
37+
REM 2. for pull request (options): Output static xml should be static_%platform%.xml, and then copy to %WORKSPACE%.
38+
REM 3. for others: Output files should be zipped to anything_you_want.zip, and then copy it to %WORKSPACE%.
39+
REM
40+
REM -------------------------------------
41+
REM --------- Avaliable Tools -----------
42+
REM -------------------------------------
43+
REM Compressing & Decompressing: 7z a, 7z x
44+
REM
45+
REM -------------------------------------
46+
REM ----------- Test Related ------------
47+
REM -------------------------------------
48+
REM PR build, zip test related to test.zip
49+
REM Package build, zip package related to package.zip
50+
REM
51+
REM -------------------------------------
52+
REM ------ Publish to artifactory -------
53+
REM -------------------------------------
54+
REM [Download] artifacts from artifactory:
55+
REM python3 ${WORKSPACE}/artifactory_utils.py --action=download_file --file=ARTIFACTORY_URL
56+
REM
57+
REM [Upload] artifacts to artifactory:
58+
REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --project
59+
REM Sample Code:
60+
REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=*.zip --project
61+
REM
62+
REM [Upload] artifacts folder to artifactory
63+
REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=FILEPATTERN --project --with_folder
64+
REM Sample Code:
65+
REM python3 ${WORKSPACE}/artifactory_utils.py --action=upload_file --file=./folder --project --with_folder
66+
REM
67+
REM ========== Guidelines END==============
68+
REM --------------------------------------------------------------------------------------------------------------------------
69+
70+
echo Package_Publish: %Package_Publish%
71+
echo is_tag_fetch: %is_tag_fetch%
72+
echo arch: %arch%
73+
echo source_root: %source_root%
74+
echo output: C:\\tmp\\%project%_out
75+
echo build_date: %build_date%
76+
echo build_time: %build_time%
77+
echo release_version: %release_version%
78+
echo short_version: %short_version%
79+
echo pwd: %cd%
80+
81+
82+
echo isBuildSdk: %isBuildSdk%
83+
echo isBuildDemo: %isBuildDemo%
84+
echo Upload_CDN: %Upload_CDN%
85+
echo example_electron_version: %example_electron_version%
86+
echo example_sdk_mode: %example_sdk_mode%
87+
echo arch: %arch%
88+
echo package_version: %package_version%
89+
90+
git config --system core.longpaths true
91+
call npm config delete ELECTRON_MIRROR
92+
call npm config delete electron_mirror
93+
call npm config delete artifactory_api_key
94+
call npm config delete ARTIFACTORY_API_KEY
95+
96+
echo npm config list
97+
call npm config list
98+
99+
del /a /f /s *.zip
100+
del /a /f /s Electron-SDK
101+
del /a /f /s example\dist
102+
103+
pushd ..\Electron-SDK
104+
105+
if %isBuildSdk% == true (
106+
107+
call ci\electron-sdk-build-windows-release.bat %arch%
108+
echo 执行上传electron.zip到artifactory
109+
echo path:%WORKSPACE%\\%build_time%_windows_%arch%.zip
110+
copy electron.zip %WORKSPACE%\%build_time%_windows_%package_version%_%arch%.zip
111+
112+
if %Upload_CDN% == true (
113+
@REM electron.zip
114+
@REM 执行上传SDK到CDN
115+
echo 执行上传electron.zip到CDN
116+
)
117+
)
118+
119+
if %example_sdk_mode% == 1 (
120+
7z x electron.zip -o.\Electron-SDK\ -y
121+
)
122+
123+
if %isBuildDemo% == true (
124+
echo isBuildDemo: %isBuildDemo%
125+
call powershell.exe -executionpolicy remotesigned -File ci\packager-win.ps1 %arch% %example_sdk_mode% %example_electron_version%
126+
@REM electronDemo.zip
127+
@REM 执行上传到artifactory
128+
echo 执行上传electronDemo.zip到artifactory
129+
copy electronDemo.zip %WORKSPACE%\\%build_time%_windows_electron_demo_%package_version%_%arch%.zip
130+
)
131+
132+
echo 全部完成
133+
134+
popd

0 commit comments

Comments
 (0)