Jenkins Agent

    Built-in podTemplate

    The podTemplate is a template of a pod that will be used to create agents, users can define a podTemplate to use in the kubernetes plugin.

    At the same time, in order to reduce the user’s learning cost, we have built in some podTemplate, so that users can avoid writing yaml files.

    You can use the built-in podTempalte by specifying the Agent’s label. For example, to use the nodejs podTemplate, you can specify label as nodejs when creating the Pipeline, as shown in the example below.

    1. pipeline {
    2. agent {
    3. label 'nodejs'
    4. }
    5. }
    6. stages {
    7. stage('nodejs hello') {
    8. steps {
    9. sh 'node -v'
    10. sh 'docker version'
    11. sh 'docker images'
    12. }
    13. }
    14. }
    15. }