The following ant script used in ant deploy.xml to connect remote windows server and to
call the import.bat in write tag which is currently calling the unix environment and I changed
to call the bat instead of sh.
It is not calling the import cmd in the windows server.
Please help on this how to change this.
<telnet userid = "${remote_username}" password = "${remote_password}" server = "${remote_host}">
<read>></read>
<write>cd ${remote_ws_path}xx/testSystem</write>
<read>></read>
<!-- <write>./import.sh -u ${remote_ws_user} -p ${remote_ws_password} -f ${remote_temp}${rddp_file} | tee ${remote_ws_path}ws/logs/impor_${cu_drop}.log</write> -->
<write>import.bat -u ${remote_ws_user} -p ${remote_ws_password} -f ${remote_temp}${rddp_file} | tee ${remote_path}ws/logs/import_${cu_drop}.log</write>
<read>></read>
</telnet>
Thanks
Related
I need to remotely run a command on my window's workstation from my osx workstation using docker.
Works locally:
docker run -it mcr.microsoft.com/powershell pwsh -c "Write-Host 'Hello, World'"`
Hello, World
Doesn't work remote:
docker run -it mcr.microsoft.com/powershell pwsh -c Invoke-Command -ComputerName VM-CHIP -ScriptBlock { Write-Host 'Hello, World' }
Invoke-Command: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
When I try within the container
docker run -it mcr.microsoft.com/powershell
PowerShell 7.2.8
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS /> Install-Module -Name PSWSMan
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
PS /> Install-WSMan
WARNING: WSMan libs have been installed, please restart your PowerShell session to enable it in PowerShell
PS /> Invoke-Command -ComputerName VM-CHIP -ScriptBlock { Write-Host 'Hello, World' }
it fails with
OpenError: [VM-CHIP] Connecting to remote server VM-CHIP failed with the following error message : MI_RESULT_FAILED For more information, see the about_Remote_Troubleshooting Help topic.
I'm confused what the structure is to run this within a single command intead of having to open interactive, and more importantly what am I missing to successfully execute the command on the remote machine instead of this MI_RESULT_FAILED error. Or is this not possible/supported?
Running
docker run -t -i -w=[absolute_work_dir] [docker_image] [executable]
is fine. However when I set the workdir using variable in a PowerShell script (.ps1):
$WORKDIR = [absolute_work_dir]
docker run -t -i -w=$WORKDIR [docker_image] [executable]
it gave the error:
docker: Error response from daemon: the working directory '$WORKDIR' is invalid, it needs to be an absolute path.
What is possibly wrong?
You could assemble a string with your variable, then execute the string as a command.
$DOCKRUNSTR = "docker run -t -i -w=" + $WORKDIR + " [docker_image] [executable]"
& $DOCKRUNSTR
The & will tell powershell to run that string as a command.
Edit: Inside a .ps1 file try Invoke-Expression instead of &
Maybe there's a better powershell super user solution, but this seems like it could get the job done for you.
I'm stuck with this problem and I have no idea to solve it.
I have written a Shell script which will invoke my job using Jenkins CLI by passing my private key.Jenkins version is 2.121.1
java -jar jenkins-cli.jar -s http://localhost:8080 -i ~/.ssh/id_rsa build RTT/RTT-CI-Tools/RTT-CI-Tools-Distribute -s -p SLAVE_REGEX=testserver
Getting Error message as :
ERROR: anonymous is missing the Overall/Read permission
The same script works in another Jenkins (2.7.4). How to fix this issue.
You can also use auth param but you should to type your password in console
java -jar jenkins-cli.jar -s http://localhost:8080/ -auth myLoggin:myPassword list-jobs
Please check for below points
1) USER exist on jenkins server as same on linux machine.
2) SSH Public key shared on Jenkins server is correct.(manage jenkins --> manage user --> click on ${USER} --> click on configure --> then check ssh public key is correct).
3) CMD i used(working) --> java -jar jenkins-cli.jar -ssh -user ${USER} -i ~/.ssh/id_rsa -s http://localhost:8080/jenkins/ build ${JOB_NAME}
please check if you are executing cmd from same user.
4) SSH port should be enable on Jenkins (go to manage Jenkins--> configure Global security --> SSH Server... set SSHD Port Fixed eg 38844)
This issue cropped up for me, too, recently (using the cli to automate installing jenkins). I was able to work around it by setting the denyAnonymousReadAccess flag to false in jenkins' config.xml file, and restarting jenkins:
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy">
<denyAnonymousReadAccess>false</denyAnonymousReadAccess>
</authorizationStrategy>
I would like to use this docker container apiaryio/dredd instead of the npm package dredd. I am not familiar with running and debugging npm based docker images. How can I run the basic usage example of the npm package "Quick Start" section
$ dredd init
$ dredd
if I have a Swagger file instead of the api-description.apib in $PWD/api/api.yaml or $PWD/api/api.json?
TL;DR
Run dredd image as a command line. Dredd Image at Docker Hub
docker run -it -v $PWD:/api -w /api apiaryio/dredd init
[Optional] Turn it into a script:
#!/bin/bash
echo '***'
echo 'Root dir is /api'
export MYIP=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
echo 'Host ip is: ' $MYIP
echo 'Configure URL of tested API endpoint: http://api-srv::<enpoint-port>. Set api-srv to point to your server.'
echo 'This script will set api-srv to docker host machine - ' $MYIP
echo '***'
docker run -it --add-host "api-srv:$MYIP" -v $PWD:/api -w /api apiaryio/dredd dredd $1
[Optional] And put this script in a folder that is in your PATH variable and create an alias for short it
alias dredd='bash ./scripts/dredd.sh'
Code at Github gist.
my problem is that i want to execute an script inside my jenkins pipeline plugin, and the 'perf script' command do not work.
My script is:
#! /bin/bash
if test $# -lt 2
then
sudo perf record -F 99 -a -g -- sleep 20
sudo perf script > info.perf
echo "voila"
fi
exit 0
My Jenkins can execute sudo so this is not the problem, and in my own Linux Shell this script works perfectly..
How can i solve this?
I solved this adding the -i option to perf script command:
sudo perf record -F 99 -a -g -- sleep 20
sudo perf script -i perf.data > info.perf
echo "voila"
Seems like Jenkins is not able to read perf.data without -i option
If the redirection does not work within the script, try and see if it is working within the DSL Jenkinsfile.
If you call that script with the sh step supports returnStdout (JENKINS-26133):
res = sh(returnStdout: true, script: '/path/to/your/bash/script').trim()
You could process the result directly in res, bypassing the need for a file.