Issue with Hudson/Jenkins pulling from a CVS repo - hudson

I am trying to use Hudson to do CI on a CVS repository but I receive the following error when I try to run the build:
Started by user admin
[Pilot1] $ "C:\Program Files (x86)\CVS Suite\CVSNT\cvs.exe" -Q -z3 -d :sserver:login:_server:/CVSRepo co -P -d workspace -D "Thursday, March 3, 2011 2:20:08 PM UTC" ITitC/
cvs checkout: in directory .:
cvs checkout: cannot open CVS/Entries for reading: No such file or directory
java.io.IOException: No such directory exists. Did you specify the correct branch? Perhaps you specified a tag: c:\ path\workspace
at hudson.scm.CVSSCM.archive(CVSSCM.java:474)
at hudson.scm.CVSSCM.access$100(CVSSCM.java:123)
at hudson.scm.CVSSCM$1.invoke(CVSSCM.java:381)
at hudson.scm.CVSSCM$1.invoke(CVSSCM.java:374)
at hudson.FilePath.act(FilePath.java:753)
I am able to successfully do an update if I remove the "ITitC" (the module) at the end of the command and run it directly through the cmd prompt. I was also able to quickly create a folder with that name inside of the "workspace" directory at the start of the Hudson build but it is deleted with each new build.
Is there a way I can force Hudson or CVSNT to create folders as needed either before each build or by default? Is this a problem with CVSNT? I'm not too attached to CVSNT and am willing to replace it with a better option.

We encountered same issue wit CVS 1.11.xx and were not able to solve it. In result we moved to CVS 1.12.xx and Hudson works fine. Seems this issue is specific to some CVS server builds and has not relation to CVS client.

I encountered a similar issue
[workspace] $ cvs.exe -Q -z3 -d :pserver:user#server01:/cvsrepo/projectrepo co -P -N -d . -D "Thursday, June 13, 2013 9:24:00 PM UTC" Module1 Module2
cvs.exe checkout: cannot open CVS/Entries for reading: No such file or directory
With only one module specified, the checkout works and the contents of the module are directly beneath the workspace folder created by Hudson. (there is no Module1 folder created)
For multiple modules, the checkout only works if a directory name is specified in the -d. Using the default Hudson specified . is when the error occurs.
[workspace] $ cvs.exe -Q -z3 -d :pserver:user#server01:/cvsrepo/projectrepo co -P -N -d customDir -D "Thursday, June 13, 2013 9:53:46 PM UTC" Module1 Module2
$ computing changelog
Finished: SUCCESS
Specifying the customDir creates a customDir folder beneath workspace with Module1 and Module2 folders below it.
This behavior happens in the command line as well as inside Hudson so it must be a feature of CVS.

Related

How to deploy config.json on elastic beanstalk

I thought I could just copy it into .ebextensions and then go
config= require("../.ebextensions/config.json")
in my lib/server.js, but not so.
Do I have to subscribe to some native config game or can I just have my secret files copied over with
eb deploy
To add a file onto the list of files in git I have done the below. This is deploying what's on the file system, so I guess this should be improved to fetch a branch from git and zip that up
rm package.zip
zip package.zip `echo config/config.json; git ls-tree --full-tree -r HEAD | awk '{print $4}'`
eb deploy
and append to .elasticbeanstalk/config.yml
deploy:
artifact: package.zip
assuming you meant eb deploy and not eb debloy, make sure you committed these config files.

Mercurial hook exited with status 1

We use Mercurial (hg) for source control with a central repository (each developer has their own local as well). I am trying to set up a hook in the central repo such that it kicks off a Jenkins CI build.
The hook appears in the hgrc file as:
[hooks]
incoming.jenkins = java -jar C:/buildServerJar/jenkins-cli.jar -s http://ctc-jenkins:8080/ -i C:/buildServerJar/id_rsa build "All Working Projects"
[ui]
verbose = True
debug = True
Now, I have tested the command invoked from the hook on the command-line of the machine that hosts the central repository and it works as expected.
However, when I trigger the hook with a push to the central repository, I see the following output:
% hg --repository D:\dev\hg\******\source push W:\Repository\*********
pushing to W:\Repository\**********
searching for changes
adding changesets
add changeset 62784303122b
adding manifests
adding file changes
adding ****/CMakeLists.txt revisions
added 1 changesets with 1 changes to 1 files
updating the branch cache
running hook incoming.jenkins: java -jar C:/buildServerJar/jenkins-cli.jar -s http://ctc-jenkins:8080/ -i C:/buildServerJar/id_rsa build "All Working Projects"
warning: incoming.jenkins hook exited with status 1
[command completed successfully Fri Jul 26 15:24:58 2013]
The server in question is a Windows machine. Any ideas what could be going wrong or how to get more details on the error?
UPDATE:
So I modified the hook to get more info:
incoming.jenkins = java -jar C:/buildServerJar/jenkins-cli.jar -s http://ctc-jenkins:8080/ -i C:/buildServerJar/id_rsa build "All Working Projects" > hg_output.log 2> hg_errors.log
And it says it is unable to locate the jarfile, which is clearly in the location indicated. Makes me wonder if it is a permissions issue. Does anyone know what user account Mercurial runs its hooks under?
Error: Unable to access jarfile C:/buildServerJar/jenkins-cli.jar

mercurial diff + unxutil "patch"

How do you make the mercurial "diff" command produce output that is compatible with the unix or unxutil patch command?
I need to create a patch file that I can send to a coworker who doesn't have Mercurial installed.
I've tried using hg diff -r 3:5 > patch1.diff and I get an error from the patch command when applying it. (hold on, I will post the error message as soon as I have a chance....)
OK, here is a test case that I've uploaded to bitbucket:
hg clone https://bitbucket.org/jason_s/test-patch-apply P2base
hg update -r 2 -R P2base
hg diff -r 2:4 -R P2base > p2base.patch
rm -r P2base/.hg
cd P2base
patch < ../p2base.patch
I get this on my Windows PC:
C:\tmp\hg\P2base>patch < ../p2base.patch
patching file bar.txt
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Never mind, this is a documented problem (with a REALLY POOR ERROR MESSAGE) that can be overcome. From http://gnuwin32.sourceforge.net/packages/patch.htm :
On MS-Windows, the patchfile must be a text file, i.e. CR-LF must be
used as line endings. A file with LF may give the error: "Assertion
failed, hunk, file patch.c, line 343," unless the option '--binary' is
given.
I used --binary and it worked fine.

Mercurial keywords extension to expand on every commit

I need to use the hg keyword extension to embed the build date and revision into a source file. Leaving aside the whole "you really don't want to be doing that" argument, how can I do this?
Here's what my source file (lib/foo/version.rb) looks like (which happens to be Ruby, but that's only relevant from the point of view that I don't have a "compile" step in my build which I could do a -DREVISION="$(hg id)" in):
module Foo
VERSION = {
:date => "$Date$",
:changeset => "$Revision$"
}
end
The problem is that $Revision$ and $Date$ are expanded with the changeset and commit date of that file, whereas what I need is the tip changeset and commit date of the whole repository.
I don't see an obvious template I can use in hg help templates, nor does the keyword extension mention anything with global scope. Is what I'm trying to do possible?
You can install a post-commit hook that updates the file:
[hooks]
post-commit = sed -i lib/foo/version.rb \
-e "s|\$Date.*\$|\$Date: $(date)\$|" \
-e "s|\$Version.*\$|\$Version: $(hg id -i)\$|"
You should then probably add the version file to the .hgignore file -- it will change after every commit and thus always be dirty. You could also add a encode filter that will clean up the version file:
[encode]
lib/foo/version.rb = sed -e "s|\$Date.*\$|\$Date\$|" \
-e "s|\$Version.*\$|\$Version\$|"
This script will make Mercurial see the file as clean -- no matter what date and changeset has it really contains, Mercurial will see it as containing un-expanded $Date$ and $Version$ keywords:
$ hg commit -m test
$ hg tip
changeset: 7:df81c9ddc9ad
tag: tip
user: Martin Geisler
date: Wed Apr 06 14:39:26 2011 +0200
summary: test
$ hg status
$ hg cat version.py
date = "$Date$"
version = "$Version$"
$ cat version.py
date = "$Date: Wed Apr 6 14:39:26 CEST 2011$"
version = "$Version: df81c9ddc9ad$"
If you're running your code from a checkout you can invoke hg directly and cache the value. Something like:
module Foo
VERSION = {
:version => system("hg log --template '{note|short}-{latesttag}-{latesttagdistance}' -r .")
}
end
and if you're not running the code from inside a checkout on a system with Mercurial installed, then your deploy script can easily get/use the value -- perhaps by using hg archive to get the tarball to send which then automatically includes a .hg_archive.txt.
I guarantee you there's a prettier way to do this than the keywords extension no matter what your setup is.

Convert cvs to mercurial

I'm trying to convert a CVS repository to mercurial but can't get it to work.
I start with a clean checkout:
cvs -d :sspi;username=xxx;hostname=yyy.local:/cvsrepos checkout repo
Which works fine
I then do:
hg convert .
But it fails with:
assuming destination .-hg
initializing destination .-hg repository
connecting to :sspi;username=xxx;hostname=yyy.local:/cvsrepos
abort: unexpected response from CVS server (expected "Valid-requests", but got 'E cvs [server aborted]: Root :sspi;username=xxx;hostname=yyy.local:/cvsrepos must be an absolute pathname\n')
I'm running cvsnt on windows 7
Edit:
Investigated this a bit more and it seems like mercurial starts a local server cvs server and then communicates with that instance instead of the remote server.
I base this on the following observations:
I created a cvs.bat file that sends the command line arguments to a file. The file shows the argument "server".
process monitor shows that hg.exe tries to open the file
C:\cvstest\:sspi;username=xxx;hostname=yyy.local:\cvsrepos which of course fails.
Can it be that hg does not understand the sspi connection string?
Edit 2:
Not a solution but I found a workaround: Copy the complete remote repository to my machine and:
cvs -d :local:\localcopyofrepo checkout repo
hg convert repo
Everything worked fine
Looks like the error message is telling you to use an absolute pathname to the repository, try using
hg convert <full_path_including_drive>
rather than the . path on a checked out sandbox of your CVS repository. You could also try specifying the repository type in the convert command by adding -s cvs to the command, the result would look something like this:
hg convert -s cvs C:\sandbox\cvsrepos
It looks like you are using ConvertExtension. Can you try hg convert from the parent folder and specify the folder name, instead of . and see if it works?