I am trying to get branch name of the last commit pushed to git that triggered my post-commit groovy script, anybody has an idea that how can I do this??
There are many examples of how to get that info. Try this one: https://github.com/gitblit/gitblit/blob/master/src/main/distrib/data/groovy/blockpush.groovy
The important thing to remember is that git can push multiple refs (branches & tags) simultaneously so it's easy to receive more than one.
Related
I am running Multibranch pipeline jobs using Github plugin with the option below
and periodical polling (5 mins) to look for open pull requests (new feature branches in our case). Open pull request is identified, job is triggered and on successful completion am able to update the status. would like to add a PR status message with URL using
pullRequest.comment('This is a comment sent from the Pipeline').
But pipeline job fails with
"No such property: pullRequest for class: groovy.lang.Binding".
on further inspection, env.CHANGE_ID is set to NULL (means it is not a PR build job which is a prerequisite to use pullRequest module). can anyone suggest some idea to get CHANGE_ID set or means to post/update comments to PR other than success or Fail
I am using a Jenkinsfile to build build pull requests (declarative pipeline) , I want to push test results (one line) , code coverage(cobertura) and if possible SONAR back into the pull request in a fairly simple fashion.
I looked at some docs and added
junit 'target/surefire-reports/*.xml
but it doesn't post anything back to the pull request in github.
As far as I know, you cannot push test results back to GitHub without actually using git commit/push. What you can actually do is to create a webhook (setup guide) on GitHub and on Jenkins so that the build result is showed on GitHub and clicking on that link can redirect you to the Jenkins server.
Example
For Sonar I am sure there is a webhook as well, but I haven't used it personally.
When I try to push using TortoiseGit to Bitbucket for initial source code, I got error:
Remote name must not be empty.
I've used TortoiseGit a lot of time and never got any problem with this error even though I never input any remote name. It happens only when I try to push. I could commit just fine.
How to solve this?
I solved it myself! I didn't follow the tutorial thoroughly.
Since this is a new repository, I have to add origin remote name first. If you use command line, this will do:
git remote add origin https://yourusername#bitbucket.org/yourteam/yourrepo.git
If you want to do it in TortoiseGit, do this instead:
Click manage on the right of dropdown remote name choices
Add a remote name origin with URL https://yourusername#bitbucket.org/yourteam/yourrepo.git
Choose it as a remote name then push!
This indicates that no remote repositories are set up or selected right now for pushing/fetching. As all commits are only local in git you only notice this on push/pull/fetch.
Click on the "Manage" button behind the "Remote" combobox in order to set bitbucket up (see https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html#tgit-dug-settings-remote). Afterwards "origin" will show up in the combobox and you can push/pull/fetch.
Other way to do it via the Interface is to add the origin using the dialog box as follows,
Although I set up my xcode swift file to create a repository when I click SourceControl -> Make a Working Copy I receive the error window "All projects are already under source control. Then when I to Window -> Welcome to Xcode -> "Check out an existing project" I get the error "Unexpected HTTP status code: 404(-1).
Does anyone have an idea on how to solve this please? Thank you
When you use Welcome to XCode > Check out an existing project you need to enter the github repository url as provided on the <> Code tab in github. It will look something like
https://github.com/username/MyRepository.git
In my case I got -401 with the following premises:
The URL was OK
The user credentials were OK
However, the user was not approved for downloading from that repository
Using the correct user solved the issue.
I got this issue when using xcode with bitbucket service.
Not entirely sure if I changed something or bitbucket changed something but I noticed that my domain in the URI for the remote had changed in bitbucket and xcode was no longer attempting to push to the correct path.
eg.
domain/repo.git
for some reason now was:
domaincom/repo.git
again, I do not remember changing anything but perhaps something changed in bitbucket to alter how the usernames are formed?
I think my team ( username ) was domain.com and they always worked with the first part up until the first . but perhaps changes have allowed for their service to remove all dots and use the full team name ( username )
I removed and re added the remote using the correct URI and it worked.
In my case, the issue was with my bitbucket plan which had exceeded the free plan tier and was restricted to read-only. Fixed my plan in bitbucket, and the issue was solved after a while.
I was trying to set up my Xcode 5 connecting to my github repository. The procedure stopped like this
It could never get through it. What else can I do to get it done? Thanks!
I ran into the same issue, and it turned out to be because I was using a lowercase username in the URL when my actual GitHub username is mixed-case (!). It seems that missing or invalid credentials sometimes simply cause it to hang on the "Verifying" step.
This is a long shot, but go to your GitHub profile and double-check the actual case of your username. Also try copying the clone URL from GitHub's web page for the repository, then adding the (username)# portion, to make sure there are no typos in your URL.