Hi all, I have one master Jenkins CI server and four slaves is is possible to build a project on all agents simultaneously ? -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e974d160-b2b1-41ca-b23a-5f5ef296831en%40googlegroups.com. |
Yes. The Jenkins Pipeline can request to build on all available agents or on all agents that match a specific label. See nodesByLabel. Here's an example: def nodes = nodesByLabel label: '!windows' nodes = nodes.sort() Map tasks = [:] for (int i = 0; i < nodes.size(); i++) { def label = nodes[i] def stageName = 'Check git cache ' + label.replaceAll('(-jagent)|(-ssh)|(-mwaite)|(.markwaite.net)|(-beemarkwaite)|(-jenkins)', '') tasks[label] = { node(label) { stage(stageName) { if (isUnix()) { sh '[ -d /var/lib/git/mwaite ] || (echo /var/lib/git/mwaite directory not found; exit 1)' } else { bat 'echo git cache check not implemented for Windows' } } } } } timeout(time: 3, unit: 'MINUTES') { parallel(tasks) } Jenkins multi-configuration jobs can also build on all agents that match a particular label, using either the elastic axis plugin or the node label parameters plugin. Mark Waite
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFJsKhyfHmCFfb6Nt8ytJP-fXvfs6_rozRLUOHTimqfRQ%40mail.gmail.com. |
Thanks Mark, where do I run that code ?
On Tuesday, 6 April 2021 at 21:47:19 UTC+1 Mark Waite wrote:
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c8f9794a-9ece-4ff2-87db-ebe3b5afb23dn%40googlegroups.com. |
The sample that I provided would be placed in a file named 'Jenkinsfile' at the root of a git repository, then a Pipeline job should be defined in Jenkins for that git repository. Thanks Mark, where do I run that code ? You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtH9jqowSzVTFWKx-xqiUBak9WdQWqa1rd3Hpyyvrj%2BBww%40mail.gmail.com. |
Hi Mark I tried to run it and got
java.lang.NoSuchMethodError: No such DSL method 'nodesByLabel'
and a lot more errors
On Saturday, 10 April 2021 at 21:58:43 UTC+1 Mark Waite wrote:
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d095ae49-0a64-411d-92a0-03756aa24f3dn%40googlegroups.com. |
The complete error dump java.lang.NoSuchMethodError: No such DSL method 'nodesByLabel' found among steps [archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, findBuildScans, getContext, git, input, isUnix, junit, library, libraryResource, load, lock, mail, milestone, node, parallel, powershell, properties, publishChecks, pwd, pwsh, readFile, readTrusted, resolveScm, retry, script, sh, sleep, stage, stash, step, timeout, timestamps, tm, tool, unarchive, unstable, unstash, validateDeclarativePipeline, waitUntil, warnError, withChecks, withContext, withCredentials, withEnv, withGradle, wrap, writeFile, ws] or symbols [all, allBranchesSame, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, authorizationMatrix, batchFile, booleanParam, branch, brokenBuildSuspects, brokenTestsSuspects, buildButton, buildDiscarder, buildDiscarders, buildRetention, buildUser, buildingTag, caseInsensitive, caseSensitive, certificate, changeRequest, changelog, changeset, checkoutToSubdirectory, choice, choiceParam, cleanWs, clock, command, credentials, cron, crumb, culprits, defaultFolderConfiguration, defaultView, demand, developers, disableConcurrentBuilds, disableResume, downstream, dumb, durabilityHint, email-ext, envVars, envVarsFilter, environment, equals, expression, extendedEmailPublisher, file, fileParam, filePath, fingerprint, fingerprints, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, gitBranchDiscovery, gitHubBranchDiscovery, gitHubBranchHeadAuthority, gitHubExcludeArchivedRepositories, gitHubExcludePublicRepositories, gitHubForkDiscovery, gitHubPullRequestDiscovery, gitHubSshCheckout, gitHubTagDiscovery, gitHubTopicsFilter, gitHubTrustContributors, gitHubTrustEveryone, gitHubTrustNobody, gitHubTrustPermissions, gitTagDiscovery, github, githubPush, gradle, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, isRestartedRun, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobBuildDiscarder, jobName, junitTestResultStorage, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, mailer, masterBuild, maven, maven3Mojos, mavenErrors, mavenGlobalConfig, mavenMojos, mavenWarnings, modernSCM, myView, namedBranchesDifferent, node, nodeProperties, nonInheriting, none, not, overrideIndexTriggers, paneStatus, parallelsAlwaysFailFast, parameters, password, pattern, permanent, pipelineTriggers, plainText, plugin, pollSCM, preserveStashes, projectNamingStrategy, proxy, pruneTags, queueItemAuthenticator, quietPeriod, rateLimit, rateLimitBuilds, recipients, requestor, resourceRoot, retainOnlyVariables, run, runParam, sSHLauncher, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, security, shell, simpleBuildDiscarder, skipDefaultCheckout, skipStagesAfterUnstable, slave, sourceRegexFilter, sourceWildcardFilter, ssh, sshPublicKey, sshUserPrivateKey, standard, status, string, stringParam, suppressAutomaticTriggering, swapSpace, tag, teamSlugFilter, text, textParam, timestamper, timestamperConfig, timezone, tmpSpace, toolLocation, triggeredBy, unsecured, untrusted, upstream, upstreamDevelopers, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, weather, withAnt, zip] or globals [currentBuild, env, params, pipeline, scm] On Monday, 12 April 2021 at 16:36:38 UTC+1 [hidden email] wrote: Hi Mark I tried to run it and got java.lang.NoSuchMethodError: No such DSL method 'nodesByLabel' and a lot more errors You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/30d1b1c2-14d2-4e76-baac-2ff3261eb9c1n%40googlegroups.com. |
The Jenkins Pipeline DSL is extensible. It is extended by Jenkins plugins that you may choose to install. The nodesByLabel step is provided by the Pipeline utility steps plugin. You'll need to install
the Pipeline utility steps plugin in order to use that step.
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtH4vFmTVMvUJy73tRQcbatPGnWVWRJczaMwV_Vr%3DLdFDA%40mail.gmail.com. |
HI Mark your code now runs as expected, now that I have a collection of nodes how can I use them to build a specific job ?
On Monday, 12 April 2021 at 17:54:54 UTC+1 Mark Waite wrote:
You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2bb01f47-a79f-4c87-afd3-ff1b5da139d1n%40googlegroups.com. |
See the parallel step HI Mark your code now runs as expected, now that I have a collection of nodes how can I use them to build a specific job ? You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGG-1bKtwvKbLy2RassFXUQWJ2Yb45k2iAc7%2BFJ5RB-%2Bw%40mail.gmail.com. |
Free forum by Nabble | Edit this page |