"This repository is a Jenkins shared library"
The following packages must be installed on the system on which the pipepline will run (the Jenkins master or any slave):
- bash
- git
- nohup
- repo
This is the list of plugin's shortnames:
Importing and using this pipeline (or shared library) can be performed from a script which will be interpreted by Jenkins. That script can be written in two ways:
- written in a web textarea from a job configuration page
- written in a Jenkinsfile
It is generally considered a best practice to create a Jenkinsfile and check the file into the source control repository.
To import this shared library, write the following piece of code at the beginning of the script (or before using the pipeline):
library identifier: '@test', retriever: modernSCM([
$class: 'GitSCMSource',
credentialsId: '<private-key-id>',
remote: 'https://git.smile.fr/ecs-ci/jenkins-pipeline-aosp.git',
])
The credentialsId
parameter is an ID which refers to one of your credentials
in Jenkins whose users need permissions to use it (see
the credential table in the web UI: Jenkins > Credentials).
Add the following code to the script and complete it:
env = [
"NODE_LABEL=<node-label>"
]
withEnv(env) {
aospPipeline {
doClean = true
manifestUrl = "<git@git.domain.com:user/repository>"
repoBranch = "<repo-branch-name>"
targetProduct = "<target-name>" // ex: "aosp_x86_64"
buildVariant = "eng" // ex: "user" or "userdebug"
ccacheEnabled = true
ccacheSize = "50G"
jobCpus = 4
}
}
The withEnv
expression injects the env
Map's variables into
the Jenkins environment which enables the pipeline to read them. The pipeline
requires the NODE_LABEL
environment variable which will instruct Jenkins
to execute the pipeline on a specific agent/node.
For more details about arguments and options, look at the:
- Preparation (pre-pipeline);
- SCM - downloading the sources with repo;
- Build - building the AOSP;
- Static Analysis - only on the building's output not the sources;
- Unit Tests - using the Android CTS;
- SonarQube - send static analysis, unit testing and coverage results;
- Post (post-pipeline).
- Skip some stages as you please, using the
skipStages
option (ex: skip "SCM" and "Build" stages):
aospPipeline {
...
skipStages = [
scm : true,
build : true
]
}