remote svn update on server farm - deployment

I wrote an svn hook that triggers upon commit. The goal is to automatically
update multiple servers by running svn update on each.
So my server topology consists of (all running under Windows 2012):
a) SVN_server
b) server1,...,N
I use PsExec to invoke svn update from SVN_server to server1,...,N
As the updated directory is used by the web server (IIS) some files may be
in use at the time of the svn update, so I would expect it to fail occasionally.
What happens though, is that intermittently the svn update hangs! When inspecting with ProcessExplorer I see that psExec runs svn update which in turn runs a child process under the name of "conhost". I assume this would be some interactive prompt but I have no way of redirecting standard output to a file in order to investigate further.
FYI, the post-commit.bat hook (on repository mysite) looks like:
:: first update SVN_server working folder
svn update d:\websites\mysite
:: then update server1,..,N
cmd /c c:\tools\PsExec.exe -i -u Admin -p Passw \\swWeb01 -h c:\tools\svn update d:\websites\mysite
cmd /c c:\tools\PsExec.exe -i -u Admin -p Passw \\swWeb02 -h c:\tools\svn update d:\websites\mysite
how can I redirect stdout/stdin in the remote svn update?
after killing the blocked svn update process the svn directory becomes dirty.
I have to use svn cleanup to recover. Any ideas why this is happening and how can I resolve it?

Related

What results should I see from running initdb?

Running initdb looks pretty straightforward from the docs.
I created the data directory, checked the permisions on the folder, ran initdb as the postgres user, and entered the password.
It returns immediately.
C:\Program Files\PostgreSQL\12>runas /user:pgUser#domain "bin\initdb.exe -k -D \"C:\Program Files\PostgreSQL\12\data\""
Enter the password for pgUser#domain:
Attempting to start bin\initdb.exe -k -D "C:\Program Files\PostgreSQL\12\data" as user "pgUser#domain" ...
C:\Program Files\PostgreSQL\12>
Results:
The data dir is still empty, no errors in the event log, and the service won't start.
I expected it to populate data with the base directories, create the postgres and template databases, and be able to start the database engine as a service.
The resolution was three-fold.
First, as suspected, runas starts another process to run the command.
Redirecting, as such
runas /user:pgUser#domain "cmd" > output.txt
only redirects the output of runas.
To capture the output of the cmd, you need to redirect inside that process.
runas /user:pgUser#domain "cmd > output.txt 2>&1"
Second, installing postgres on windows includes initdb.
So, uninstalling and re-installing accomplished that.
Third, one of the things that I wanted to accomplish with the reset was enabling checksums and something I read said that you could only set that flag using initdb. But that's not true. You can enable checksums on an existing cluster.
So I didn't need to run initdb at all. In spite of so many recommendations to start with a freshly "initdb'd" installation.

How can I start GitKraken from the command line with a Git repository path on Windows?

I'd like to create a bunch of shortcuts to open Git repository
GitKraken starts like this:
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe"
I tried to just add the path like this, but nothing happened:
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe \"C:\<path to repo with spaces>\MyRepo1\""
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe \"C:\<path to repo with spaces>\MyRepo2\""
C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe \"C:\<path to repo with spaces>\MyRepo3\""
There could be multiple problems:
GitKraken might not support a path as parameter. Didn't find any documentation when I googled for "gitkraken from command line with repository path as parameter"
Quotes within quotes might be wrong, but I think it's correct: Command line passing quotes within quotes
The command line syntax might be different, but as mentioned above, I didn't find any documentation. I tried "-p" because I saw something similar while googling but it didn't work either C:\Users\<username>\AppData\Local\gitkraken\Update.exe --processStart "gitkraken.exe -p \"C:\<path to repo with spaces>\MyRepo1\""
GitKraken uses the Squirrel.Windows project for installation and update management for it's Windows installs. So the update.exe that is running when you click on the shortcut labeled "GitKraken" is running the Squirrel.Windows process that checks for and downloads updates and then runs the newest version of GitKraken. Once that check is complete, it launches the GitKraken.exe and starts the program.
To solve your issue you will need to pass a CLI option through the Squirrel call into the the gitkraken.exe. You are correct that gitkraken.exe accepts the -p | --path option for the repo to open at launch (e.g. gitkraken.exe -p "\path\to\repo"). If you run it from the app folder directly, you can see the options available at gitkraken.exe --help. Luckily, there are a couple of as-yet undocumented options you can pass that do the pass-through for you (referenced here) so your custom shortcut could now be:
..\Update.exe --processStart "gitkraken.exe" --process-start-args="--path \"d:\path with spaces\to\repo\""
Re: persistence through GitKraken executable updates- OP has confirmed in comments after GitKraken updated to v4.2 that the shortcuts they set up continued to work!
This is what working for me in Ubuntu Desktop
Define it
gkk() { # gkk aka gitkraken
repo_d=$1
if [ -z $repo_d ]; then repo_d=`pwd`; fi
if [ ! -d $repo_d ]; then echo "Invalid :repo_d at $repo_d"; exit 1; fi
/usr/bin/gitkraken -p $repo_d &
}
Use it
cd /path/to/your/repo
gkk
Note, calling the command again on 2nd repo will NOT work!
The workaround I can think of is to close and reopen GitKraken app

How to delete P4 client saved on my local workspace in Eclipse?

I want to delete the client dpi-sigs which I created on my windows machine, I tried to remove the directory but nothing happened.
From the command line this will do it:
p4 client -d dpi-sigs

Post-commit hook failed (exit code 3) with output

I'm trying to call a Jenkins job remotely using a post-commit script. I'm currently committing code through Eclipse Kepler/Subversive/SVNKit Connector.
post-commit script:
if svnlook dirs-changed -r "$REV" "$REPOS" | grep -qEe '^trunk/'; then
wget --post-data="job=APS-RemoteServerAction&token=SECRET&ACTION=deploy&ASSET_NAME=POST-COMMIT-TEST&DEPLOY_ENV=DEV&REVISION=$REV" "http://my.domain.com:8080/buildByToken/buildWithParameters"
fi
Screenshot of error through Eclipse:
Important notes:
Code does get committed properly, repository browser indicates a new version
The job runs on Jenkins, the history shows that
Everytime I commit, I get this error message
I tried adding the flag --quiet, but I got the same exit code.
I'm thinking it's due to wget and posting the values?
Edit #1
I would like to point out that I'm using the Jenkins Build Authorization Token Root Plugin. I switched to a POST instead of a GET (which works) due to eventually moving onto https and keeping the token out of the URL.
I interpret the error message to mean that wget can not write a file with the name buildWithParameters in its current directory. Use wget -O - to write the output to stdout.
The error is (I think) because it's trying to download the webpage to a local dir. You just need to ping the endpoint to make jenkins build, so I used the --spider (doesn't download), --no-proxy (I was getting cached responses sometimes) and -q (don't output, cuz svn will report it).
wget --post-data="job=APS-RemoteServerAction&token=SECRET&ACTION=deploy&ASSET_NAME=POST-COMMIT-TEST&DEPLOY_ENV=DEV&REVISION=$REV" "http://my.domain.com:8080/buildByToken/buildWithParameters" --spider --no-proxy -q

how to login and download file using perforce command line

I have to download a file daily from perforce depot.
Presently I do it manually by selecting that file and using "Get latest version" option.
I want to write a script which I will schedule in my windows task schedular to get the file daily.
Please help me/guide me how to do this task automatically.
I am using p4v client software in windows XP operating system.
Using P4V will make it hard to automate. I suggest you use the command-line client, p4.exe, instead. If there's only one file that you need the contents of you could simply use "p4 print" and avoid the need for creating a workspace (client) spec, e.g:
p4 print -o <local filename> //depot/path/to/file
Note that the above command requires you to be already logged on to the Perforce server. There's at least two ways around this:
1) Specify the username and password on the command-line (not really recommended for security reasons):
p4 -u myuser -P mypasswd print -o <local filename> //depot/path/to/file
2) Use a dedicated background user for the task, with an unlimited login expiration time (see p4 group and the Timeout field):
p4 -u backgrounduser print -o <local filename> //depot/path/to/file
A licensed "background user" designated for only performing automated tasks can be obtained at no further cost from Perforce Software. Try contacting Perforce support and ask them about this.
In a bat you can use the p4.exe commandline tool that comes with p4v and issue the sync command:
p4 sync myFileThatINeedToGetDaily.txt
Before Issuing Sync, make sure you have logged in and set the port and client view
p4 -u myuser -P mypasswd
p4 set P4PORT=server:nnnn
p4 sync file1.txt
The command you need is p4 sync.