We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

11

As you guessed, build not necessarily means "compile". Building is a process of creating software from sources, which might include stuff like gathering dependencies, compiling, archiving, transforming code in any way, but also testing, deploying to different environments and promoting the artifacts between them.


7

Here is a short snippet you can just run from the jenkins script console, to dump all of your credentials to plain text. com.cloudbees.plugins.credentials.SystemCredentialsProvider.getInstance().getCredentials().forEach{ it.properties.each { prop, val -> println(prop + ' = "' + val + '"') } println("-----------------------") } A more ...


6

if you want just access the log and download it as a txt file to your workspace from the job's URL: ${BUILD_URL}/consoleText On Linux, you can use wget to download it to your workspace wget ${BUILD_URL}/consoleText The actual log file on the file system is in the Master machine. You can find it under: $JENKINS_HOME/jobs/$JOB_NAME/builds/...


5

You can use the "when" block combined with the built in "changeset" condition to conditionally run only certain stages of your monorepo's pipeline. From the when.changeset documentation: changeset- Executes the stage if the build’s SCM changeset contains one or more files matching the given string or glob. Example: when { changeset "**/*.js" } Here is an ...


5

You need to define variables before the pipeline block starts. Then it should be work. def foo = "foo" pipeline { agent none stages { stage("first") { sh "echo ${foo}" } } }


5

Yes, storing your ssh keys directly on a build node is a bad practice. Nodes can be replicated, deleted, or given access to from other systems, and you don't want to lose track of what systems have access to your secrets. You should also not pass them directly into the build job, either as a parameter or as an environment variable. This can cause a huge ...


5

What your are describing can typically be addressed with a correct inventory design. [zone1] serverA serverB serverC [zone2] server1 server2 server3 [zone3] serverX serverY serverZ [jenkins_master] serverA server1 serverX [jenkins_slave] serverB serverC server2 server3 serverY serverZ From there you can easily: create plays that will target a group or ...


4

If the job is a jenkins pipeline, open the failed build and select the Replay option. Otherwise select the Rebuild option. Sample Replay Option: Sample Rebuild Option:


4

This pipeline will run each day at 1 AM. It'll restart if the build fails. pipeline { agent any triggers { cron('0 1 * * *') } stages { stage ('Build') { when { expression { // When last build has failed !hudson.model.Result.SUCCESS.equals(currentBuild....


3

When using Declarative Pipelines you can achieve the goal of running some steps only for certain branches by using the when directive with the build-in condition branch: branch Execute the stage when the branch being built matches the branch pattern (ANT style path glob) given, for example: when { branch 'master' }. Note that this only works on a ...


3

It seems your have not opened your 8080 port in Security Groups in AWS. Steps: Go to AWS console Click Security Group and select the security group that you have assigned to your EC2 instance. Click Edit Inbound Rules Add a Custom TCP Rule and add 8080 in the Port Range. You will now see Jenkins rise from the grave :) i.e. first time installation screen. ...


3

You can try the thinBackup plugin (even though it is not actively maintained) [if taking a logical backup is all you want] (i.e. most of the config xml files, jobs, nodes etc). The backup size won't be huge.


3

Jenkins is better Because most users moving on to Jenkins, as well as other adoption metrics indicating clear shift in the userbase. the Hudson team has moved to develop Jenkins. So you can trust our expertise and the the passion to keep pushing the software forward. a large number of plugin authors have chosen to support their plugins on Jenkins. So you ...


3

To restart Jenkins manually, you can use either of the following commands (by entering their URL in a browser): (jenkins_url)/safeRestart - Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete. (jenkins_url)/restart - Forces a restart without waiting for builds to complete.


3

The variable must be defined in a script section. pipeline { agent none stages { stage("first") { script { foo = "bar" } sh "echo ${foo}" } } }


3

You need to use double quotes instead of single quotes. Single-quoted strings don't perform string interpolation. For instance: parameters { string( name: 'DEPLOY_BUILD_NUMBER', defaultValue: "${BUILD_NUMBER}", description: 'Fresh Build and Deploy OR Deploy Previous Build Number' ) }


3

Single responsibility principle (SRP) Martin defines a responsibility as a reason to change, and concludes that a class or module should have one, and only one, reason to be changed (i.e. rewritten). As an example, consider a module that compiles and prints a report. Imagine such a module can be changed for two reasons. First, the content of the ...


3

Use the Groovy trim() method. For instance, def myTrimmedParam = params.myParam.trim().


3

The Git Server It's best practice to setup a Git server for the team to access. This way you have a central server that can be maintained, backed up, and focus on serving the source code. While you could create your own, there are also several popular commercial options available that often have free private repositories (non-exhaustive list): Bitbucket ...


3

Simple one. You should either add ansible_ssh_extra_args="-o StrictHostKeyChecking=no" to inventory or disableHostKeyChecking: true into Jenkins pipeline script (inside ansiblePlaybook block). Like this: ansiblePlaybook( colorized: true, installation: 'ansible27' inventory: '[hostsfile]' playbook: '[playbook]' disableHostKeyChecking: true )


3

Depending on your use-case, you should look either: Establishing a persistent VPN connection to the AWS VPC using the Site-To-Site VPN as described here: https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html Using an OpenVPN client via the build jobs using the client VPN service as described here https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/...


2

Based on this PR, the repoSlug was added and now the status is sent to the right repository. When it was not working: post { success { bitbucketStatusNotify( buildState: 'SUCCESSFUL', commitId: env.GIT_COMMIT ) } failure { bitbucketStatusNotify( buildState: 'FAILED', ...


2

solutions is: OpenConnect Plugin See here: https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin OR also you can use below method: On Linux (Debian based) sudo apt-get install openconnect Add the following lines to the bottom of /etc/sudoers (ubuntu configuration) jenkins ALL=NOPASSWD:/usr/sbin/openconnect* jenkins ALL=NOPASSWD:/bin/kill* Then ...


2

I still dont see how starting an agent creates a clean image. Expanding on your setup would help us provide better answer. That said, from what I can gather here the following assumption comes to mind : You have agents pre-populated on a VM image. Starting this image will in turn start the agent in which you wish to start the build. So you now have a ...


2

The typical approach is to use a folder per environment that contains identically named files: conf/dev/application.properties conf/test/application.properties conf/uat/application.properties conf/prod/application.properties Then parameterize the @PropertySource to use an environment variable such as "env": @PropertySource("file:${catalina.base}/conf/${...


2

Yes, because Azure Pipelines can do what Jenkins does. However, you don't have to throw the baby out with the bathwater. Microsoft continues to position their platforms such that integrations can occur with existing installations of just about anything. Many orgs have huge investments in tooling that is difficult to change. Rather than taking an all-or-...


2

In answer to part 2 (maybe), it does seem like they're pitching it as an alternative to Jenkins, although there's plenty of documentation suggesting that it can all be used together (and here). When used with Jenkins though, it does seem to be more focussed on a deployment bridge. I was hoping that I could use it as a build agent with Jenkins as an ...


2

I would love to get some clarity too maybe from a more authoritative source than myself (I'm sure I'm guilty of FUD too). I've been looking to deploy to Azure using Kubernetes. I am similarly confused but I think that is because there isn't one clear path. I can't speak for Microsoft but their attitude to cloud seems to be they are happy to become "all ...


2

Below is sample groovy code for sending file or execute command over SSH in jenkins: node(master) { stage(Deploy) { sshPublisher(publishers: [sshPublisherDesc(configName: 'SERVER_NAME', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'apt-get update', execTimeout: 120000, flatten: false, makeEmptyDirs: false, ...


2

Have a look at the Summary Display plugin. Some more details about it (= quote from the linked page): ... allows an easy and fully customized build report display. Features Allow a rich summary report visible from both project and build page Reports must be written in an XML format according to the syntax described in section Syntax ...


Only top voted, non community-wiki answers of a minimum length are eligible