My repository url was changed so I updated hgrc file with new url. I also updated new url in jenkins job.
Now when I am building the job, it hangs with the following output
-----------------Console Output-------------------
Started by user user123
Building in workspace D:\jenkins\jobs\api\workspace
[workspace] $ "C:\Program Files\TortoiseHg\hg.exe" showconfig paths.default
[workspace] $ "C:\Program Files\TortoiseHg\hg.exe" pull --rev branch
And it will never move forward. If i run the same command on cmd
"C:\Program Files\TortoiseHg\hg.exe" pull --rev branch
It works fine with following output
pulling from ssh://repos-url/repos-name
no changes found
But jenkins hangs on this command. Need some help to move forward.
Thank you
It sounds to me more a jenkins configuration question than a mercurial one :)
Are you talking about the identical clone of the repository? Does the jenkins user have read permissions on the repository it pulls from? Is it configured to pull via ssh, too and does it have the necessary ssh credentials? Or, if pulling via http, is hgweb running on the repo or another webserver to support hg?
Also, unless your project is called 'api', the URL looks strange to me: Jenkins (by default) has its clones in /jenkins-home-directory/jobs/projectname/workspace
As I mentioned in my question that I recently changed repository url. The issue was that new server's key was not cached in the registry where jenkins was hosted.
Resolution:
I logged in to the administrator account(same account used by jenkins) on my server through RDP and on the other side I started building the job in jenkins. When the console output came to this line
[workspace] $ "C:\Program Files\TortoiseHg\hg.exe" pull --rev branch
RDP window showed me an alert which was
Putty Security Alert
I pressed Yes and I saw jenkins console is now progressing and build was successful after that.
Related
I'm trying to configure the git repository in Jenkins, I followed all steps on github documentation but I had the bellow error on my application .
I've configured the agent, then I put the ssh url on jenkins.
I've configured the ssh on github as well.
Failed to connect to repository : Command "git ls-remote -h -- git#github.com:user/maven-project.git HEAD" returned status code 128:
stdout:
stderr: git#github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
The issue was solved that way
In windows, Jenkins will use the the SSH key of the user it is running as, which is located in the %USERPROFILE%.ssh folder ( on XP, that would be C:\Documents and Settings\USERNAME.ssh, and on 7 it would be C:\Users\USERNAME.ssh). Therefore, you need to force Jenkins to run as the user that has the SSH key configured. To do that, right click on My Computer, and hit "Manage". Click on "Services". Go to Jenkins, right click, and select "Properties". Under the "Log On" tab, choose the user Jenkins will run as, and put in the username and password (it requires one). Then restart the Jenkins service by right clicking on Jenkins (in the services window), and hit "Restart".
Jenkins does not support passphrases for SSH keys. Therefore, if you set one while running the initial Github configuration, rerun it and don't set one.
I'm going to say you don't have the credentials configured properly as you did not mention that.
A similar Stack Overflow response is here, for a slightly different worded error. Similar issue here.
The Jenkins site and others have good examples on setting up Jenkins with GitHub.
I'm setting up Jenkins to build and then send changed files to a remote server using SSH. However, using the Publish over SSH plugin, I can only find an option to specify files to send over. I only want to send over files that have changed on GitHub. Is there a way to achieve this?
What you want to do might be outside of the scope of the Publish Over SSH plugin, but it is doable as a shell script.
You can run a command like this to get the files changed between the current commit and the last commit: git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT
Then using the results of that you can run a shell scp command.
You can do this in a pipeline or in a execute script post-build action.
I installed Ansible plugin in Jenkins and I configured.
I created ansible.cfg, hosts and the playbook files.
I pushed those files with directory in Bitbucket.
The issue is when I start a build in Jenkins it says "skipping: no hosts matched" or I have already tested the directory manually and it works.
This is jenkins configuration:
This the error message:
When i execute the ansible-playbook command directly from the folder in Desktop it works.
This is when i executed the command in the jenkins directory
I think you need to provide a credentials owner. When you run it manually you are identified (with an attached ssh key) but Jenkins needs some permissions.
I'm using Git-parameter plugin into Jenkins to build specific tag/branches. It was correctly working but now (not sure it's following and update or something) it's failing in a strange way:
If I create a new job (or duplicate a failing one) add the git parameter to retrieve tag (or branch) and my build steps I can build right away. It shows me the full tag list and can build the one I select.
On the second run, when I click "build with parameter" again then no list provided for the tag and with the branch I have this error :
Command "git ls-remote -h ssh://jenkins#192.168.1.200/repo/git/xxx.git"
returned status code 128:
stdout:
stderr: /tmp/ssh3146539705442744984.sh: line 6: ssh: command not found
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Please look at the Log
So it looks like access issue to the git repo but it's working on first run and I still can build same project (so doing a git checkout too) without this git parameter so I assume my git configuration / credentials are ok.
If you have any idea where to look ?
ps: Jenkins is running on the same machine as the repository (a linux)
Jenkins 2.73.2
Git plugin 3.6.2
Git Parameter Plug-In 0.8.1
Thanks,
Nicolas.
I am completely new to Gitlab because previously I upload project to server using Filezilla. But now I have finished my Laravel projects in my local computer, and I would like to upload it to my could hosting. Currently my project is stored in c:\\xampp\htdocs\myproject.
Please tell me command line step-by-step to achieve this? I am using Putty on window. I can't understand it by reading existing tutorial.
I use DigitalOcean.com's server and yes I registered on gitlab.com to store/upload my project.
As a first approach, you can push directly to DigitalOcean, as describe in this tutorial:
clone your GitLab repo as a bare repo on your DigitalOcean instance (VPS: Virtual Private Server or Droplet)
cd
git clone --bare https://gitlab.com/<yourUsername>/<yourRepo.git>
add a post-receive hook similar to this auto-deploy article
That is:
cat > /home/rails/rails_project.git/hooks/post-receive
(Copy-paste the following lines)
#!/bin/sh
echo "-----------------------------------"
echo "Post receive hook: Updating website"
export GIT_WORK_TREE=/path/to/yourProject
export GIT_DIR=/home/yourUser/yourRepo.git
cd $GIT_WORK_TREE
git pull
git checkout master -f
(type Ctrl+D to exit)
Depending on your deployment path, you might have to execute the git commands as root, but it is best if you can keep your deployment as your username and not root.
But if you don't want to push to DigitalOcean, only to GitLab, you can use instead Git-Auto-Deploy.
Then you can push to GitLab, and that will trigger a deployment to your VPS.
When commits are pushed to your Git repository, the Git server will notify Git-Auto-Deploy by sending a HTTP POST request with a JSON body to a pre configured URL (your-host:8001).
The JSON body contains detailed information about the repository and what event that triggered the request.
Git-Auto-Deploy parses and validates the request, and if all goes well it issues a git pull.
Additionally, Git-Auto-Deploy can be configured to execute a shell command upon each successful git pull, which can be used to trigger custom build actions or test scripts.