A plugin for Jenkins CI that gives you the ability to monitor successful build on a remote Jenkins server.
Build project and pull docker images on a remote server(having public ip), Customer didn't having a public ip and we dont want to share source code.
Manage Jenkins > Configure System > Remote Result Trigger Configuration > Remote Jenkins Server
Job > Build Triggers > Checked Remote Build Result Trigger
pubResult(result: '{"version": "1.0.0"}')
def remoteJobs = readRemoteJobs()
remoteJobs.each {
echo readRemoteResult(uid: "${it.uid}").version
// other
echo "${it.jobUrl}"
}
// only one trigger job
readRemoteResult().version
// more than one
readRemoteResult(uid: 'xxxxxx').version
ENV_NAME | description |
---|---|
REMOTE_BUILD_NUMBER | The remote build number, such as "153". |
REMOTE_BUILD_TIMESTAMP | The remote build timestamp, such as "1676017363424". |
REMOTE_BUILD_URL | Full URL of this build, like https://server:port/jenkins/job/foo/15/ (Jenkins URL must be set). |
REMOTE_BUILD_RESULT | The remote build result, such as "SUCCESS", "UNSTABLE", "FAILURE", "NOT_BUILT", "ABORTED". |
REMOTE_PARAMETER_${PARAMETER_NAME} | If remote job use buildWithParameters, use remote parameters replace ${PARAMETER_NAME}. |
REMOTE_RESULT_${PUB_RESULT_KEY} | If remote use pubResult, use result json key replace ${PUB_RESULT_KEY} |
If monitor more than one remote job
The Unique Identifier(Optional) used to replace injected envs
ENV_NAME | description |
---|---|
REMOTE_JOBS | ex: ["Unique Identifier(Optional)"] |
REMOTE_${uid}_BUILD_NUMBER | The remote build number, such as "153". |
REMOTE_${uid}_BUILD_TIMESTAMP | The remote build timestamp, such as "1676017363424". |
REMOTE_${uid}_BUILD_URL | Full URL of this build, like https://server:port/jenkins/job/foo/15/ (Jenkins URL must be set). |
REMOTE_${uid}_BUILD_RESULT | The remote build result, such as "SUCCESS", "UNSTABLE", "FAILURE", "NOT_BUILT", "ABORTED". |
REMOTE_${uid}_PARAMETER_${PARAMETER_NAME} | If remote job use buildWithParameters, use remote parameters replace ${PARAMETER_NAME}. |
REMOTE_${uid}_RESULT_${PUB_RESULT_KEY} | If remote use pubResult, use result json key replace ${PUB_RESULT_KEY} |