Complete the code to define a matrix build with two platforms.
matrix {
axes {
axis {
name 'PLATFORM'
values [1]
}
}
}The values field expects a list of strings separated by commas and enclosed in quotes.
Complete the code to run a shell command in the matrix build.
steps {
sh '[1]'
}print instead of echoThe sh step runs shell commands. To use the matrix variable, use $PLATFORM inside the command.
Fix the error in the matrix axis definition.
matrix {
axes {
axis {
name [1]
values 'linux', 'windows'
}
}
}The name must be a quoted string. Single quotes are preferred in Jenkinsfiles.
Fill both blanks to define a matrix with OS and JDK versions.
matrix {
axes {
axis {
name [1]
values 'linux', 'windows'
}
axis {
name [2]
values 'jdk8', 'jdk11'
}
}
}The first axis is commonly named OS for operating system, and the second axis JDK for Java versions.
Fill all three blanks to run a shell command using both matrix variables.
steps {
sh 'echo Building on [1] with [2] and version [3]'
}Use $OS and $JDK for the first two variables, and $JAVA_VERSION for the version variable in the shell command.