ERROR: /var/jenkins_home/workspace/gara-bo#script/Jenkinsfile not found - maven

I have a maven multi modules project.
I create a pipeline to clean and deploy my project.
When I run the pipeline I got the following output :
``Started by user XXXXX
Checking out git http://XXXX:9080/gara/gara-back-end.git into /var/jenkins_home/workspace/gara-bo#script to read Jenkinsfile
using credential XXXXXXXXXXX
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://XXXXXXX:9080/gara/gara-back-end.git # timeout=10
Fetching upstream changes from http://XXXXX:9080/gara/gara-back-end.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --force --progress http://XXXXXX:9080/gara/gara-back-end.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision c717022003b698421698238b13e1909f555172a0 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f XXXXXXXXXXXXXXX
Commit message: "Update Jenkinsfile"
> git rev-list --no-walk 7XXXXXXXXXXXXXXXXXXXXXXX # timeout=10
ERROR: /var/jenkins_home/workspace/gara-bo#script/Jenkinsfile not found
Finished: FAILURE``
Why the project is checked out under gara-bo#script instead of gara-bo ?
On the server, I have two folders : gara-bo and gara-bo#script
``gara-bo contains : Jenkinsfile pom.xml src target WEB-INF
gara-bo#script : gara-common gara-dao gara-model gara-service gara-web JenkinsFile pom.xml``
but file in the gara-bo#script are just symbolic link because when I try to read the content of JenkinsFile under gara-bo#script it is impossible.
Do you know, how could I correct it please ?

That is because there are many other branches which didn’t contain a Jenkins file yet.
Probably it it the first time you are using Jenkins. So the Jenkins file in only in your current developing branch (E.g: YOUR_BRANCH-79).
Here don't use :origin/YOUR_BRANCH-.*, you can use :origin/YOUR_BRANCH-79.

When I create the Jenkinsfile, i Add a space in the name. So please check that the name doesn't contain a space. You have to have "Jenkinsfile", not " Jenkinsfile" or "Jenkinsfile ", etc...

Related

commit and push generically with Jenkins in a Freestyle project

I'm trying to commit and push the changes to Bitbucket using a Jenkins Job
The job is a Freestsyle Project with "Execute Shell" as a build step.
What I currently did inside the build step of "Execute Shell" is the following:
python run.py
git config --global user.email "name#gmail.com"
git config --global user.name "name"
git add .
git commit -m 'jenkins.job : update...'
Then I push the changes with Git Publisher.
This works as expected in my local computer but is there a way to retrieve the credentials that I used in Source Code Management with Jenkins variables instead of using git config (because I'm not allowed to use git config error: could not lock config file //.gitconfig: Permission denied)
I fixed it using git -c user.name=".." -c user.email="..#.." commit -m ".."
This way I can set temporary configuration data.

How can i upload a Spring Java project to GitHub so i can show my work?

I've tried through various ways, directly uploading the files wont work. I've tried through bash and nothing.
Do you have git installed?
# Create a new repository on the command line
#Go to Project Directory on your Computer, Open git Bash here
# run the following 1 by 1
git init
git add .
git commit -m "Comment here"
git remote add origin https://github.com/YourRepoPrefixHere
git push -u origin master
If you have a git profile and a repository you can take these simple steps to get it online:
Open a terminal and go inside the folder of the project you want to push to your git repository
Check if you are on the right git branch: git checkout
git add .
git commit -m "your messagge to commit"
git push origin -u "yourbranchName
If you have never set up your origin branch, you should add it before using it:
git remote add origin "github link"
To see if everything went well you can do a simple: git status.
I hope it will be useful to you my friend!

Unable to clone from GitHub enterprise in Jenkins

Jenkins build process fails with the following GIT error. And this seems to fail only for this GitHub Enterprise repository. If I try to do the same for GitHub repository, all ends well.
Building in workspace D:\Program Files(x86)\Jenkins\workspace\pullcodefromgithub
Cloning the remote Git repository
Cloning repository https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe init D:\Program Files (x86)\Jenkins\workspace\pullcodefromgithub # timeout=10
Fetching upstream changes from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
ERROR: null
Finished: FAILURE
Note: This is not gitHub, but GitHub enterprise. Not sure how to fix it. No matter where I try - Mac or Windows, error is the same. Tried the same with SSH and that also fails
Started by user Ram
Building in workspace D:\Program Files (x86)\Jenkins\workspace\pullcodefromgithub
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://githubenterprise.grangeinsurance.com/hmb/sail-server.git # timeout=10
Fetching upstream changes from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
> git.exe --version # timeout=10
using GIT_SSH to set credentials
> git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://githubenterprise.grangeinsurance.com/hmb/sail-server.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:803)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1063)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress https://githubenterprise.grangeinsurance.com/hmb/sail-server.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1784)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1513)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:801)
... 11 more
ERROR: null
Finished: FAILURE
If I try to pull the contents of the repository from terminal or command prompt or git shell, it seems to work without any issues.
I am clueless to what is going on here. Any help or advice would be greatly helpful.
Thanks
This issue happens because of jenkins using "git" in stead of "jgit". This change will bring the universe back to sanity. Here's how we do it
Manage Jenkins-> Global configuration tool
Proceed to "git" section and Tap on "Add Git" drop down button, select JGit
Save your changes
Manage Jenkins -> Browse into your project/item -> Configure
Go into the repository configuration section
Git executable - change from default to jgit
Save your changes and proceed to build
This time, build should succeed. Happy building.

Jenkins error performing git command

Getting the following error while trying to build:
Building in workspace F:\BuildSource\SeleniumHTTPMonitoring
> F:\soft\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> F:\soft\Git\bin\git.exe config remote.origin.url https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git # timeout=10
Fetching upstream changes from https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git
> F:\soft\Git\bin\git.exe --version # timeout=10
using .gitcredentials to set credentials
> F:\soft\Git\bin\git.exe config --local credential.username master.builder # timeout=10
> F:\soft\Git\bin\git.exe config --local credential.helper store --file=\"C:\Windows\TEMP\git1527457549107748901.credentials\" # timeout=10
> F:\soft\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git +refs/heads/*:refs/remotes/origin/*
> F:\soft\Git\bin\git.exe config --local --remove-section credential # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://bitbucket.mycompany.io/scm/oi/seleniumhttpmonitoring.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:799)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1055)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1086)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Error performing git command
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1751)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1476)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:797)
... 11 more
Caused by: org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201
at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126)
at org.jvnet.winp.WinProcess.getCommandLine(WinProcess.java:102)
at hudson.util.ProcessTree$Windows$1.getArguments(ProcessTree.java:441)
at hudson.plugins.msbuild.MsBuildKillingVeto.vetoProcessKilling(MsBuildKillingVeto.java:55)
at hudson.util.ProcessTree$OSProcess.getVeto(ProcessTree.java:239)
at hudson.util.ProcessTree$Windows$1.killRecursively(ProcessTree.java:422)
at hudson.util.ProcessTree.killAll(ProcessTree.java:142)
at hudson.Proc$LocalProc.destroy(Proc.java:375)
at hudson.Proc$LocalProc.join(Proc.java:348)
at hudson.Proc.joinWithTimeout(Proc.java:164)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1736)
... 15 more
ERROR: null
Jenkins 2.7.1 is running on Windows Server 2012 R2 (the same error was occurring on Jenkins 2.7.4). I can clone the repo via git command line without any problems. When this happens I can see multiple git processes trees in task manager Screenshot and if I wait for a while I will see this in Jenkins.
The culprit was Git plugin. It started working after update.
I was using 2.5.3 version.

Push into master branch from Travis CI

I am switching from Jenkins to Travis CI.
In Jenkins, I did not have to write a script to push my Java/android library to Git master branch.
With Travis, all my research shows that I need to write a custom bash script to execute in after_success.
This is my deploy.sh:
#!/bin/bash
rev=$(git rev-parse --short HEAD)
git config user.name "uname"
git config user.password "password"
git add .
git commit -m "travis commit at ${rev}"
git push origin master
and my .travis.yml:
branches:
only:
- development
language: android
sudo: false
android:
components:
- build-tools-22.0.1
- android-22
script:
- cd appdir
- ./gradlew test
after_success:
- cd ..
- ./deploy.sh
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
Under the script section, I cd from root dir to my appdir and run tests from there (successfully) then in the after_success section, I cd back into root where my deploy.sh is located and call it.
My Travis CI console shows everything is successful but I don't see any changes in my master branch.
Am I doing anything wrong?
Thanks.
My experience is that Git doesn't appear know the branch your build is using and you want to push the current HEAD that has the additional commit.
In Travis CI you may have a log message just showing 'Everything up-to-date' as Git is pushing the same master branch.
You could change your script to add HEAD.
#!/bin/bash
rev=$(git rev-parse --short HEAD)
git config user.name "uname"
git config user.password "password"
git add .
git commit -m "committed at ${rev}"
git push origin HEAD:master
This is a similar answer that explains :- git-pushing-to-github-origin-master-does-nothing.

Resources