Jenkins Job Build Failure - jenkins

After job build starts in jenkins my git-lab server's memory becomes full. Job is successful after restarting the Jenkins server.Jenkins has become too slow Sometimes Error comes with signal 9 also. Thank-you in advance. I have attached the log of the failed build.
started by user ME
Building in workspace /var/lib/jenkins/workspace/my_Project
using credential ABC
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url git#myrepo:root/My_Project.git # timeout=10
Fetching upstream changes from git#myrepo:root/My_Project.git
> /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials
> /usr/bin/git fetch --tags --progress git#myrepo:root/My_Project.git +refs/heads/*:refs/remotes/origin/*
> /usr/bin/git rev-parse refs/remotes/origin/My_Project_Develop^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/My_Project_Develop^{commit} # timeout=10
Checking out Revision fbd8fcef97895366d1d08bccb22615712d1f9ef0 (refs/remotes/origin/My_Project_Develop)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f fbd8fcef97895366d1d08bccb22615712d1f9ef0
Commit message: "Update features of Software."
> /usr/bin/git rev-list --no-walk fbd8fcef97895366d1d08bccb22615712d1f9ef0 # timeout=10
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
[My_Project] $ /bin/sh -xe /tmp/jenkins6218118938138193412.sh
+ id -un
root
+ SSH_OPTS='-o StrictHostKeyChecking=no -o ConnectTimeout=5'
+ sudo git checkout My_Project_Develop
Previous HEAD position was fbd8fce... Update features of Software.
Switched to branch 'My_Project_Develop'
Your branch is behind 'origin/My_Project_Develop' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
Build step 'Execute shell' marked build as failure
Discard old builds...
#1040 is removed because status FAILURE is not to be kept
Checking for post-build
Performing post-build step
Checking if email needs to be generated
No emails were triggered.
Finished: FAILURE

You need to pull the My_Project_Develop branch, checkout is only switching to this branch. Your branch is locally behind the server.
The message is clear:
Your branch is behind 'origin/My_Project_Develop' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
Usually this is done by Jenkins. I need more info how you run this job.

Related

Unable to build a Jenkins project. prompting java issues

Running as SYSTEM
Building in workspace /Users/mac/.jenkins/workspace/trainSchedule
The recommended git tool is: NONE
No credentials specified
git rev-parse --resolve-git-dir /Users/mac/.jenkins/workspace/trainSchedule/.git # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins # timeout=10
Fetching upstream changes from https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins
git --version # timeout=10
git --version # 'git version 2.30.1 (Apple Git-130)'
git fetch --tags --force --progress -- https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 1603f84d1f50794623c71673920fc3111280045f (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 1603f84d1f50794623c71673920fc3111280045f # timeout=10
Commit message: "specify a newer version of node and npm"
First time build. Skipping changelog.
[Gradle] - Launching build.
[trainSchedule] $ /Users/mac/.jenkins/workspace/trainSchedule/gradlew build
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '19'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE

Jenkins - Couldn't find any revision to build

I have been using Jenkins for a few days, and before: I used the GITEA plugin
Now that I have switched my projects to GitBucket, I would like to use the "Build by Webhook" Feature.
I followed many tutorials, and now : i'm stuck on a simple/big problem.
In advance, I'm sorry to have to blur the sensitive links, I know it can be annoying.
Here is the full error :
using credential 10
Wiping out workspace first.
Contributing variables:
Cloning the remote Git repository
Cloning repository https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT
> git init /Jenkins/workspace/GitBUcket # timeout=10
Fetching upstream changes from https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT
> git --version # timeout=10
> git --version # 'git version 2.20.1'
using GIT_ASKPASS to set credentials Utilisateur GitBucket Perso
> git fetch --tags --force --progress -- https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url https://MY_GITBUCKET/git/MY_USERNAME/MY_PROJECT # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
Avoid second fetch
Seen 0 remote branches
> git show-ref --tags -d # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Here is my configuration on Jenkins : https://i.stack.imgur.com/jdlTt.png
Thank you very much in advance
EDIT : My only branche is master --> https://i.imgur.com/lXJ0xyN.png
This is what you can try:
Manage Jenkins -> Global Tool Configuration -> Git
Check if Path to Git executable is set: C:\PATH\git.exe
Dashboard -> select your job -> Configure -> Source Code Management -> select Git
Insert your Repository URL and Credentials(Optional) then under Branches to build change */master to */main.

How to run a command from the GitHub directory that Jenkins clones into?

I put "make" in Jenkins's Execute Shell, following the tutorial here https://github.com/jbankes/Hello_Jenkins, but Jenkins does not run the make from the underlying Github repository, as shown in the error message below.
What is the right way to demand Jenkins to run "make" from its monitored GitHub repository?
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/test003
The recommended git tool is: NONE
No credentials specified
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/zhoulaifu/Hello_Jenkins # timeout=10
Fetching upstream changes from https://github.com/zhoulaifu/Hello_Jenkins
> git --version # timeout=10
> git --version # 'git version 2.20.1'
> git fetch --tags --force --progress -- https://github.com/zhoulaifu/Hello_Jenkins +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision bc3931a313e4f3945c257ae3247e63265b1debb7 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f bc3931a313e4f3945c257ae3247e63265b1debb7 # timeout=10
Commit message: "Otherside (#5)"
> git rev-list --no-walk bc3931a313e4f3945c257ae3247e63265b1debb7 # timeout=10
[test003] $ /bin/sh -xe /tmp/jenkins2704537311990415428.sh
+ make
make: *** No targets specified and no makefile found. Stop.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
In the repository Make file located inside original folder. So to be able to run Make you need navigate to it.
After git clone execute cd original/ and then run Make.

Simple Jenkins application to show gcc version

I am after a simple Jenkin application to show gcc version after each push to bitbucket.
Here is the Jenkinsfile:
pipeline {
agent { docker { image 'kernelci/build-gcc-7_arm:3.3.3' } }
stages {
stage('build') {
steps {
sh 'gcc --version'
}
}
}
}
Bitbucket
Repository Settings/Post Webhooks:
http://jenkins.SOMEADDRESS:8080/bitbucket-scmsource-hook/notify
After each push, the build does not start automatically but not a problem. I starts the builds manually.
However, The Jenkin build output result looks like this
Started by user MY_USERNAME
[Office365connector] No webhooks to notify
Building on master in workspace c:\w\PROJECTNAME
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url http://bb.MYWEBSITE.COM/scm/bbb/MYREPO.git # timeout=10
Fetching upstream changes from http://bb.MYWEBSITE.COM/scm/bbb/MYREPO.git
> git.exe --version # timeout=10
using GIT_ASKPASS to set credentials Credentials for Jenkins in Bitbucket
> git.exe fetch --tags --progress http://bb.MYWEBSITE.COM/scm/bbb/MYREPO.git +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/feature/LAST_BRANCH
Seen branch in repository origin/feature/BRANCH_A
Seen branch in repository origin/feature/BRANCH_B
Seen branch in repository origin/feature/BRANCH_C
Seen branch in repository origin/feature/BRANCH_D
Seen branch in repository origin/feature/BRANCH_E
Seen branch in repository origin/feature/BRANCH_F
Seen branch in repository origin/feature/BRANCH_G
Seen 8 remote branches
> git.exe show-ref --tags -d # timeout=10
Checking out Revision e3152f566543dfb813c6e33ac0d1099da7ec26a6 (origin/LAST_BRANCH)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f e3152f566543dfb813c6e33ac0d1099da7ec26a6
Commit message: "Merge branch 'feature/BRANCH_A' into LAST_BRANCH"
First time build. Skipping changelog.
[Office365connector] No webhooks to notify
Finished: SUCCESS
It does not look like loading a dock in 4 seconds. I do not see any gcc version on the screen either. Where is the problem from?
Is it from Jenkinsfile?

Grails 3.1.2 project by Jenkins: Unknown command-line option '-n'

I copy-pasted jenkins job (which works in Grails 2.4.5) but it fails in new Grails 3.1.2 project:
Started by user Michal Szulc
Building in workspace <http://jenkins.example.com/job/project-server/ws/>
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.project-server_repository.url http://git.example.pl/scm/es/project-server.git # timeout=10
Fetching upstream changes from http://git.example.pl/scm/es/project-server.git
> /usr/bin/git --version # timeout=10
using .gitcredentials to set credentials
> /usr/bin/git config --local credential.helper store --file=/tmp/git6110612657385406031.credentials # timeout=10
> /usr/bin/git -c core.askpass=true fetch --tags --progress http://git.example.pl/scm/es/project-server.git +refs/heads/*:refs/remotes/project-server_repository/*
> /usr/bin/git config --local --remove-section credential # timeout=10
> /usr/bin/git rev-parse refs/remotes/project-server_repository/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/project-server_repository/project-server_repository/master^{commit} # timeout=10
Checking out Revision eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90 (refs/remotes/project-server_repository/master)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90
> /usr/bin/git rev-list eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90 # timeout=10
[project-server] $ /var/lib/jenkins/tools/com.g2one.hudson.grails.GrailsInstallation/3.1.2/bin/grails -Dgrails.work.dir=<http://jenkins.example.com/job/project-server/ws//target> -Dserver.port=40855 clean --non-interactive --plain-output
Error |
Command [clean] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.11-bin.zip'.
Problem with provided build arguments: [-non-interactive, --console, plain].
Unknown command-line option '-n'.
Either it is not a valid build option or it is not supported in the target Gradle version.
Not all of the Gradle command line options are supported build arguments.
Examples of supported build arguments: '--info', '-u', '-p'.
Examples of unsupported build options: '--daemon', '-?', '-v'.
Please find more information in the javadoc for the BuildLauncher class. (Use --stacktrace to see the full trace)
Build step 'Build With Grails' marked build as failure
If I run ./gradlew clean or ./gradlew war in local environment it works perfectly. How to run it by jenkins?
I'm still not sure why this situation has happened but I resolved an issue by changing Build -> Build With Grails -> Targets:
clean "war api.project-server.pl.war"
to:
"war api.project-server.pl.war"

Resources