Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40418

Trigger validation for unknown trigger types isn't working

XMLWordPrintable

      With a pipeline like the below, we'd expect to get an error saying "hey, banana's not a trigger, here are the trigger types", but instead we get past parsing and validating and barf at runtime instead:

      pipeline {
          agent none
          triggers {
              banana('@daily')
          }
          stages {
              stage("foo") {
                  steps {
                      echo "hello"
                  }
              }
          }
      }
      

      Output:

      First time build. Skipping changelog.
      [Pipeline] End of Pipeline
      java.lang.NoSuchMethodError: No such DSL method 'banana' found among steps [archive, bat, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, envVarsForTool, error, fileExists, getContext, git, input, isUnix, libraryResource, load, mail, node, parallel, properties, pwd, readFile, readTrusted, retry, script, semaphore, sh, sleep, stage, stash, step, timeout, tool, unarchive, unstash, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, always, any, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, choice, choiceParam, clock, cloud, command, cron, crumb, defaultView, demand, disableConcurrentBuilds, docker, dockerfile, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jnlp, jobName, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, nonStoredPasswordParam, none, otherField, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, run, runParam, schedule, scm, scmRetryCount, search, security, shell, slave, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, viewsTabBar, weather, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm]
      

      We should be failing out at validation time, not runtime. I also suspect this may be the same for properties and parameters.

            abayer Andrew Bayer
            abayer Andrew Bayer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: