I'm following the this site.
And I'm in step 6(6. Deploy!).
So I executed below the command in turn.
$ git add .
$ git commit -am "add deployment configs"
$ git push master
$ cap deploy:setup
And all command was successfully executed.
Next, I tried to cap deploy command.
But I get some error.
$ cap deploy
* 2013-06-04 19:19:27 executing `deploy'
triggering before callbacks for `deploy'
* 2013-06-04 19:19:27 executing `deploy:check_revision'
WARNING: HEAD is not the same as origin/master
Run `git push` to sync changes.
$
So, I try git push and I get a message...
$ git push
Everything up-to-date
...
What is the problem??
I don't know that...
What should I do??
more informateion---
$ git branch
* master
$ git status
# On branch master
nothing to commit (working directory clean)
$ git remote
origin
Edit:
I also tried to $ git push origin master. And I get a same message that is nothing to commit (working directory clean)
Edit2:
$ git rev-parse HEAD
c3e758f2d47bb0bc126de91560905a1893fe08c6
$ git rev-parse origin/master
c3e758f2d47bb0bc126de91560905a1893fe08c6
Check your current branch and deploy.file.
In the deploy.file, it could exist the following code snippet:
task :check_revision, roles: :web do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
So you must be on the same branch set in this code.
To fix, change the following line:
unless `git rev-parse HEAD` == `git rev-parse origin/${YOUR_CURRENT_BRANCH}`
The following worked nice for/to me.
Try:
git remote show origin
If you get an error, ask for all remotes:
git remote -v
and set remote origin:
git remote add origin git#bitbucket.org:xyz/abc.git
Now 'show origin' will provide the correct answer:
git remote show origin
try:
git push origin master
Looks like you may not be pushing the code back to the remote repo.
You should be able to edit your .git/config file so in the future you can just type "git push"
I think your deploy.rb file is not set up correctly. Check line 14 where your repository is set up. Make sure it matches your github repo.
If that doesn't work, try this: after task :check_revision, roles: :web do add these lines:
puts `git rev-parse HEAD`
puts `git rev-parse origin/master`
Hopefully that will give you some more info and you can post the results.
Related
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
I have been running into an issue where most, but not all, of the jenkins jobs to build our branches are failing, when connecting by proxy, with:
> git fetch --tags --progress https://github.com/myorg/myrepo.git
> +refs/heads/*:refs/remotes/origin/* # timeout=60
> ERROR: Error cloning remote repo 'origin'
> hudson.plugins.git.GitException: Command "git fetch --tags --progress >
> https://github.com/myorg/myrepo.git +refs/heads/*:refs/remotes/origin/*" >
> returned status code 128:
> stdout:
> stderr: error: RPC failed; result=18, HTTP code = 200
> fatal: The remote end hung up unexpectedly
The Jenkins script that I have, started like so:
stage ( "Checkout" ) {
sh label: "Use proxy to access GitHub", script:
"""
git config --global http.proxy ${httpProxy}
"""
scmVars = checkout scm
... ^^ this call wraps the failing `git fetch --tags --progress` call
Reading various other stack articles (git bash: error: RPC failed; result = 18, HTP code = 200B | 1KiB/s Git clone return result=18 code=200 on a specific repository etc), the only thing I have found of note is to increase the postBuffer size. ie. git config --global http.postBuffer 524288000 # 500mb
This then looks like:
stage ( "Checkout" ) {
sh label: "Use proxy to access GitHub", script:
"""
git config --global http.postBuffer 524288000
git config --global http.proxy ${httpProxy}
"""
scmVars = checkout scm
...
This has no net effect. ~90%+ of the builds fail on fetch; ~10% will go through (independent of the branch being built).
This is where affairs become very hard to explain: after hours of banging my head against the wall, I eventually decided to invoke checkout scm twice, consecutively; first I call scm checkout in a try/catch. The second call, I assign scmVars. (nb. if the first call succeeds, the second is idempotent). This looks like:
stage ( "Checkout" ) {
sh label: "Use proxy to access GitHub", script:
"""
git config --global http.postBuffer 524288000
git config --global http.proxy ${httpProxy}
"""
try {
checkout scm
} catch (nil) {
println "Initial SCM CHECKOUT fails"
}
scmVars = checkout scm
Calling checkout scm twice, catching an error on the first call, succeeds every time, in over 50 runs.
Why?
Is git config --global http.postBuffer 524288000 being applied to both calls or only the second?
If http.postBuffer is only set on the second call, how do I correctly set the property for the first call?
In broad strokes, what is actually happening here?
long-time listener, first-time caller; I am not a dev-ops engineer, I just play one on T.V. - thank you in advance for any and all insights
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.
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.
I am writing a rake task for my rails app to do some stuff after I've determined what the current branch is, but I'm having trouble comparing the current branch to master. My rake task is bellow:
desc "TODO"
task repo: :environment do
branch = `git rev-parse --abbrev-ref HEAD`
if branch.eql? "master"
puts "On master!"
else
puts "Not on master!"
end
end
I've checked, and git rev-parse --abrev-ref HEAD returns "master". I also double checked that the class of branch is String. I'm pretty confused why this isn't working.
Any suggestions?