0
0
Jenkinsdevops~10 mins

currentBuild variables in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the current build number.

Jenkins
def buildNumber = currentBuild.[1]
Drag options to blanks, or click blank then click option'
Anumber
Bstatus
Cresult
Dduration
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'result' instead of 'number' returns the build status, not the number.
Using 'duration' gives the build time, not the build number.
2fill in blank
medium

Complete the code to get the current build result status.

Jenkins
def buildStatus = currentBuild.[1]
Drag options to blanks, or click blank then click option'
Aresult
Bnumber
Cduration
DdisplayName
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'number' returns the build number, not the status.
Using 'duration' returns the build time, not the status.
3fill in blank
hard

Fix the error in the code to get the build duration in milliseconds.

Jenkins
def buildTime = currentBuild.[1]
Drag options to blanks, or click blank then click option'
AdurationString
Bduration
Ctime
Delapsed
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'durationString' returns a formatted string, not milliseconds.
Using 'time' or 'elapsed' are not valid properties.
4fill in blank
hard

Fill both blanks to get the build display name and the build result.

Jenkins
def name = currentBuild.[1]
def status = currentBuild.[2]
Drag options to blanks, or click blank then click option'
AdisplayName
Bresult
Cnumber
Dduration
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing 'number' with 'result' instead of 'displayName' and 'result'.
Using 'duration' instead of 'result' for status.
5fill in blank
hard

Fill all three blanks to get the build number, duration, and result.

Jenkins
def num = currentBuild.[1]
def time = currentBuild.[2]
def res = currentBuild.[3]
Drag options to blanks, or click blank then click option'
AdisplayName
Bduration
Cresult
Dnumber
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'displayName' with 'number' for the build number.
Using 'result' for duration or number.