0
0
Jenkinsdevops~10 mins

Matrix builds for multi-platform 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 define a matrix build with two platforms.

Jenkins
matrix {
    axes {
        axis {
            name 'PLATFORM'
            values [1]
        }
    }
}
Drag options to blanks, or click blank then click option'
A['linux', 'windows']
B'linux windows'
Clinux, windows
D'linux', 'windows'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around platform names
Using spaces instead of commas to separate values
2fill in blank
medium

Complete the code to run a shell command in the matrix build.

Jenkins
steps {
    sh '[1]'
}
Drag options to blanks, or click blank then click option'
Aecho Hello from $PLATFORM
Bprint Hello from $PLATFORM
Cecho Hello from PLATFORM
Decho 'Hello from PLATFORM'
Attempts:
3 left
💡 Hint
Common Mistakes
Using print instead of echo
Not using the $ sign before PLATFORM
3fill in blank
hard

Fix the error in the matrix axis definition.

Jenkins
matrix {
    axes {
        axis {
            name [1]
            values 'linux', 'windows'
        }
    }
}
Drag options to blanks, or click blank then click option'
A"PLATFORM"
B'PLATFORM'
CPLATFORM
Dplatform
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the axis name
Using double quotes inconsistently
4fill in blank
hard

Fill both blanks to define a matrix with OS and JDK versions.

Jenkins
matrix {
    axes {
        axis {
            name [1]
            values 'linux', 'windows'
        }
        axis {
            name [2]
            values 'jdk8', 'jdk11'
        }
    }
}
Drag options to blanks, or click blank then click option'
A'OS'
B'JDK'
C'PLATFORM'
D'JAVA_VERSION'
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent or unclear axis names
Not quoting the axis names
5fill in blank
hard

Fill all three blanks to run a shell command using both matrix variables.

Jenkins
steps {
    sh 'echo Building on [1] with [2] and version [3]'
}
Drag options to blanks, or click blank then click option'
A$OS
B$JDK
C$JAVA_VERSION
D$PLATFORM
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names or forgetting the $ sign
Using undefined variable names