Just on Friday I added the agent any section to the pipeline. My pipeline is what you have in total, I post here how it looks:
pipeline {
agent { any
}
}
stages {
stage('Postman tests') {
steps {
sh '''
npm init -y
npm install newman newman-reporter-html
npx newman run \
"/uusia/testy_administracja.json -e /uusia/DEV.postman.environment.json -k
" \
-r junit,html \
--reporter-junit-export var/reports/newman/junit/newman.xml \
--reporter-html-export var/reports/newman/html/index.html
'''
}
post {
always {
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: '/var/reports/newman',
reportFiles: 'index.html',
reportName: 'Testy automatyczne',
reportTitles: ''
])
junit allowEmptyResults: true, testResults: '/var/reports/newman/junit/newman.xml'
}
}
}
}
Log: java.lang.NoSuchMethodError: No such DSL method 'stages' found among steps [addBadge, addErrorBadge, addHtmlBadge, addInfoBadge, addShortText, addWarningBadge, archive, bat, build, catchError, checkout, createSummary, deleteDir, dir, echo, emailext, emailextrecipients, error, fileExists, getContext, git, input, isUnix, junit, load, lock, mail, milestone, node, parallel, powershell, publishChecks, publishHTML, pwd, pwsh, readFile, release, removeBadges, removeHtmlBadges, removeSummaries, retry, sh, sleep, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstable, unstash, waitUntil, warnError, withChecks, withContext, withCredentials, withEnv, withGroovy, wrap, writeFile, ws] or symbols [GitUsernamePassword, all, allBranchesSame, always, ant, antFromApache, antOutcome, antTarget, apiToken, architecture, archiveArtifacts, artifactManager, audit-trail, authorizationMatrix, batchFile, bitbucketServer, booleanParam, brokenBuildSuspects, brokenTestsSuspects, buildButton, buildDiscarder, buildDiscarders, buildRetention, buildTimestamp, buildTimestampExtraProperties, buildUser, builtInNode, caseInsensitive, caseSensitive, certificate, chlAtuoAction, choice, choiceParam, cleanWs, clock, command, configFile, configFileProvider, credentials, cron, crumb, culprits, default, defaultFolderConfiguration, defaultView, demand, developers, disableConcurrentBuilds, disableResume, dockerCert, dockerServer, dockerTool, downstream, dumb, durabilityHint, email-ext, envInject, envVars, envVarsFilter, executor, extendedEmailPublisher, file, fileParam, filePath, fingerprint, fingerprints, frameOptions, freeStyle, freeStyleJob, fromDocker, fromScm, fromSource, git, gitBranchDiscovery, gitHubBranchDiscovery, gitHubBranchHeadAuthority, gitHubExcludeArchivedRepositories, gitHubExcludeForkedRepositories, gitHubExcludePublicRepositories, gitHubForkDiscovery, gitHubIgnoreDraftPullRequestFilter, gitHubPullRequestDiscovery, gitHubSshCheckout, gitHubTagDiscovery, gitHubTopicsFilter, gitHubTrustContributors, gitHubTrustEveryone, gitHubTrustNobody, gitHubTrustPermissions, gitParameter, gitTagDiscovery, gitUsernamePassword, github, githubProjectProperty, githubPush, globalConfigFiles, groovy, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, javadoc, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobBuildDiscarder, jobName, junitTestResultStorage, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, mailer, masterBuild, maven, maven3Mojos, mavenErrors, mavenGlobalConfig, mavenMojos, mavenWarnings, myView, namedBranchesDifferent, nodeProperties, nodejs, nodejsci, nonInheriting, none, organizationFolder, overrideIndexTriggers, paneStatus, parameters, password, pattern, permanent, pipeline, pipelineTriggers, plainText, plugin, pollSCM, projectNamingStrategy, proxy, pruneTags, queueItemAuthenticator, quietPeriod, rateLimit, rateLimitBuilds, recipients, requestor, resourceRoot, retainOnlyVariables, run, runParam, sSHLauncher, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, security, shell, simpleBuildDiscarder, slave, sourceRegexFilter, sourceWildcardFilter, ssh, sshPublicKey, sshPublisher, sshPublisherDesc, sshTransfer, sshUserPrivateKey, standard, status, string, stringParam, suppressAutomaticTriggering, swapSpace, teamSlugFilter, text, textParam, timestamper, timestamperConfig, timezone, tmpSpace, toolLocation, unsecured, untrusted, upstream, upstreamDevelopers, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, weather, withAnt, workspace, x509ClientCert, zip] or globals [currentBuild, env, manager, params]
`