Git Pull via REST in Lucee - cfml

Attempting to create a REST service in Lucee to pull down changes in the git repo.
Server is Lucee on Tomcat on Windows Server 2012
<cffunction name="gitPull"
access = "remote"
httpMethod="GET"
restPath="git/pull"
>
<cftry>
<cfexecute
name="C:\WINDOWS\SYSTEM32\cmd.exe"
arguments="/c c:\sites\git-pull-stadge.bat"
variable="batchOutput"
<!--- outputfile="c:\sites\stadge-pull-output.txt" --->
timeout="5000"
errorVariable="errorMessage"
>
Lucee documentation says this tag must have a body
</cfexecute>
<cfcatch>
<cfscript>
return cfcatch;
</cfscript>
</cfcatch>
</cftry>
<cfscript>
return {'output' = batchOutput, 'errors' = errorMessage};
</cfscript>
</cffunction>
Batch file is as follows:
c:
cd \repo_folder
git config --global credential.helper wincred
git fetch
git pull
The Lucee service is Log On As Local System
Batch file works when called from any folder on the server, but the batch file is not run and no output is returned by the function.
Introducing errors into the syntax successfully triggers the cftry/cfcatch and the error is returned as it should be.
What am I missing?

Related

Azcopy fails while executing thorugh powershell

Getting the below error while executing azcopy from powershell.
$args = "/Source:\\UNCservcer\env\older /Dest:https://1234env.blob.core.windows.net/folder1/folder2 /DestKey:hsyugf-*********== /S /XO /V:\\uncserver\SHARE\folderlog\log_123.log"
$exepath = "F:\Prgrm flss\azcopy\AzCopy.exe"
Start-Process $exepath $args-Wait
I used the above code and got this error.
Error parsing destination location "https://1234env.blob.core.windows.net/folder1/folder2": The request was aborted: Could not create SSL/TLS secure channel.
I removed the the log(/V) and tried. But no luck.
I could see some solutions like to disable the the firewall and run azcopy as an adminstrator. But I am restricted to do this stuffs.
Thanks.
I would recommend you use the AzCopy v10, it's a more convenient and currently supported version. When you use it, the command is simple and like this:
azcopy copy /path/to/folder "https://mystorage.blob.core.windows.net/data/sas_token" --recursive=true
Update:
Here is the screenshot that how to generate the SAS token:

Access denied error using vsts

I'm trying to create a wcf service in a lab using vsts.
I have created a build definition that works using a msbuild task. It then uses robocopy to copy the relevant dlls to a remote directory inside a lab using the Publish Artifacts step.
However, I need the content to be created as a windows service, and started after it has been published. It seems like something is running since I see a created log file about 9 minutes after a successful publish, but i cannot see my service inside the services menu, or in IIS.
When I try to run a bat script (using the run script step) that does an sc create, I get an access denied error even though on the vsts build definition I have given the step permission to modify the environment.
This is the full error:
2018-05-17T13:00:13.7702615Z ##[section]Starting: Run script GloBill/InstallBackEnd.bat
2018-05-17T13:00:13.7705444Z ==============================================================================
2018-05-17T13:00:13.7705561Z Task : Batch Script
2018-05-17T13:00:13.7705655Z Description : Run a windows cmd or bat script and optionally allow it to change the environment
2018-05-17T13:00:13.7705748Z Version : 1.1.3
2018-05-17T13:00:13.7705824Z Author : Microsoft Corporation
2018-05-17T13:00:13.7705924Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613733)
2018-05-17T13:00:13.7706023Z ==============================================================================
2018-05-17T13:00:13.7775377Z ##[command]C:\agent\_work\1\s\GloBill\InstallBackEnd.bat
2018-05-17T13:00:13.8030595Z
2018-05-17T13:00:13.8031049Z C:\agent\_work\1\s>sc create GloBillBackEnd ../Services/GloBill.WS.exe
2018-05-17T13:00:13.8048684Z [SC] OpenSCManager FAILED 5:
2018-05-17T13:00:13.8048781Z
2018-05-17T13:00:13.8048901Z Access is denied.
2018-05-17T13:00:13.8048957Z
2018-05-17T13:00:13.8064609Z ##[error]Process completed with exit code 5.
2018-05-17T13:00:13.8073202Z ##[section]Finishing: Run script GloBill/InstallBackEnd.bat
I'm running out of ideas.
The problem was that I was trying to deploy a release from a hosted agent that resided on another machine.
I had to configure a new agent solely for deploying, then i had to tweak my installation script a little by adding the -executionpolicy bypass command.
Here is the new script:
(%1 is the file path)
Powershell.exe -executionpolicy bypass -File %1 -username Username -password ****** -exepath *exe* -serviceName *svcName*

Import .prpt file in Pentaho Server using Command Line

I want to upload .prpt (Pentaho Report File) in Pentaho BI Server. I am using the following command:
./import-export.sh --import --url=https://server/pentaho/ --username=user --password=pass --source=file-system --type=files --charset=UTF-8 --path=/public--file-path=/home/kishan/folder/Clients/abc/Daily_Reports/Prpt/xyz.prpt --logfile=/home/user/upload.log --permission=true --overwrite=true --retainOwnership=true
So, I want to pick up the file located at the file-path value above and upload it to the BI server in the public folder. However, I am getting the following error:
CommandLineProcessor.ERROR_0001 - Missing Arguments: file-path
Why is it saying this even though I have this argument in the command above.
I got it working. Here's the command that worked for me:
./import-export.sh --import --url=http://localhost:8080/pentaho --username=admin --password=password --charset=UTF-8 --path=/public --file-path=/home/some_directoryN/Daily_Reports/Prpt/xyz.prpt --logfile=/home/kishan/upload.log --permission=true" + "--overwrite=true --retainOwnership=true
So, for this to work you need the file on the server file system (file-path argument) to which you want to upload the file. path argument is the path on BI server where you want to upload the report

how to handle api from Teamcity server itself after build is triggered for SVN

I have configured a SVN file in TeamCity server. And also set the property "Trigger a build on each check-in". So the file Build is triggered after every check-in is happened. Now I want to access the build information of configured SVN files while build is triggering.
I have a web space in Mediawiki. Mediawiki has some api to edit/create pages. I wish to call Mediawiki api with SVN build information from TeamCity server itself.
Is there any way to do this ?
what is the HSQL2 database in Teamcity server. Can we use this DB to access build information ?
You can use the TeamCity REST API to get the build changes, example:
curl /httpAuth/app/rest/changes?build=id:%teamcity.build.id%
As a command line build step will yield something like:
<changes count="3">
<change href="/httpAuth/app/rest/changes/id:217404" id="217404" version="b6b97a0d7789d97df6df908ab582ebb723235f43" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217404&personal=false"/>
<change href="/httpAuth/app/rest/changes/id:217403" id="217403" version="064ecef5552ec2fb7875d7c26fe54cdf94b67bec" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217403&personal=false"/>
<change href="/httpAuth/app/rest/changes/id:217402" id="217402" version="9bc3a34c952059bbfc7bebeb79ba5a3c894ef555" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217402&personal=false"/>
</changes>
Then you can loop through the change and hit its href which will yield like:
<change date="20130918T133404-0600" username="welsh" href="/httpAuth/app/rest/changes/id:217397" id="217397" version="51e925e354a83deccde881b30a76974b2ff745f4" webLink="http://teamcity.my-domain.com/viewModification.html?modId=217397&personal=false">
<comment>
My comments are here
</comment>
<files>
<file before-revision="90acd4da1972814094c22e3020c5073521a7b640#141323126c0" after-revision="51e925e354a83deccde881b30a76974b2ff745f4#1413290abe0" file="grails-app/views/layouts/global.gsp" relative-file="grails-app/views/layouts/global.gsp"/>
</files>
<user href="/httpAuth/app/rest/users/id:1" id="1" name="Welsh" username="welsh"/>
</change>
Then you can create something to take this information to push it to your media wiki.

MSDeploy, IIS 6, Is the Deploy context menu available

When using IIS6, should the 'Deploy' context menu item be available when right clicking on a web site?
I've installed the Web Deploy 2.1 (web installation tool) and rebooted but still it doesn't show. Maybe it doesn't show, and you just use the Web Deploy command line instead?
Any information appreciated.
No, The "deploy" context menu is only available in IIS 7 and 7.5. You'll have to do things via command line.
If you want to migrate from iis6 to iis7 you can follow the instructions here: http://learn.iis.net/page.aspx/427/migrate-a-web-site-from-iis-60-to-iis-7/ Note part 3 which goes into the actual web deploy commands.
Part 3 – Migrate your site to the
target by using a package file
Always make a backup of the destination server. Even if you are
just testing, it allows you to easily
restore the state of your server.
%windir%\system32\inetsrv\appcmd add backup “PreWebDeploy”
Run the following command on the source server to create a package
(compressed) file of the server:
msdeploy -verb:sync -source:metakey=lm/w3svc/1 -dest:package=c:\Site1.zip > WebDeployPackage.log
Copy the package file to the destination server.
Run the following command on the destination server to validate what
would happen if a sync operation were
run:
msdeploy -verb:sync -source:package=c:\Site1.zip -dest:metakey=lm/w3svc/1 -whatif > WebDeploySync.log
After verifying the output, run the same command again without the whatif
flag:
msdeploy -verb:sync -source:package=c:\Site1.zip -dest:metakey=lm/w3svc/1 > WebDeploySync.log