I can run a BigQuery script interactively just fine:
But when i try with Jenkins on the same windows machine it fails:
Do i need to install BigQuery SDK on the Jenkins Localhost, or tinker with some PATH varibles? :)
Make sure the directory the bq executable is installed has been added to your PATH variable (that would be the PATH_TO/google-cloud-sdk/bin directory). But this is most definitely already true given that you're able to run commands from the C drive. Different users get different permissions, so also make sure the bq command is available for the users Jenkins is operating under .
I've had the same issue where I couldn't run bq commands using systemctl on linux. To go around this error, instead of running the command with bq, use the full path to the executable PATH_TO/google-cloud-sdk/bin/bq.
Related
I'm trying to change the permissions in a windows docker container to give admin access in the dockerfile so it can run some powershell scripts. In order to do this I'm using some commands found in the microsoft.powershell.localaccounts core module and I've found those commands to work in a base image that has that module installed in its version of powershell but sadly the base image I'm currently using doesn't have it and I need to use this version for size reasons.
I've tried running this line in the windows docker container via powershell but while it seems to run properly with no issues printing out it still isn't installed.
Find-Module -Name microsoft.powershell.localaccounts | Install-Module -SkipPublisherCheck
I have learned to use docker as development server (LAMP and MEAN) and now I feel I should take next step, By removing PHP and node binaries from system and use binaries from containers. So on a fresh Solus install, I setup containers for PHP, node, Ruby etc. Solus already recommends using containers for such tasks. But I got stuck on first day.
I installed vs code (Code-oss) on installed extensions (prettier, PHPCS etc) on it, and they need path of installed binaries (path/to/phpcs, path/to/node etc).
I initially set up configuration path as
docker run -it --rm herloct/phpcs phpcs
based on https://gist.github.com/barraq/e7f85262bc7a0af2d8d8884d27b62d2c but using more updated container. It didn't work, So I set it up as alias thinking it would fool VSCode into thinking it is native command, but it didn't work either. I have confirmed that using those command directly from terminal does work, But VSCode PHPIntellisense extension does not want to work.
Any suggestion?
P.S. Any tip to keep container running in background as to avoid container bootup delay everytime I use PHPCS or javac from container? I can keep LAMP server running but everytime I enter terminal tools, it loads up new container to execute command, and then kill container causing delay for bootup and closing.
In case it is still relevant to someone: You might want to create a VS Code development container to use dockerized binaries.
For this to work, a .devcontainer.json is required which could be as simple as:
{
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12"
}
I would like to silently install chocolatey on a series of test agents, and I'm trying to use a TFS build to do so. I have a build step that uses the "Run Powershell on Remote Machines" task. This in turn invokes the ps1 to install chocolatey, from https://chocolatey.org/install.ps1, and I supply the powershell switches as documented on the chocolatey website:
-NoProfile -InputFormat None -ExecutionPolicy Bypass
When I run the build, I receive this error:
System.Management.Automation.RuntimeException: A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows. ---> System.Management.Automation.RuntimeException: A command that prompts the user failed because the host program or the command type does not support user interaction. Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell workflows.
What am I doing wrong? Seems odd that the chocolatey installer required user interaction, I think the whole point of chocolately was silent installs?
It seems you have wrong settings in task "PowerShell on Target Machines". Follow the steps below:
Create a .ps1 file on the target machine and specify the text below:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
In "PowerShell on Target Machines" task, specify the location of the .ps1 file just created.
Queue the build.
Check the screenshot below:
What am I doing wrong? Seems odd that the chocolatey installer
required user interaction, I think the whole point of chocolately was
silent installs?
Typically it goes fully silent, unless there is something (like a proxy) that requires input. It would be best to determine what might be causing the issue by running the install directly on the machine and seeing what happens.
Details
The install.ps1 passes over to chocolateyInstall.ps1, which calls chocolateySetup.psm1.
As you look over that script, you may notice that the install.ps1 uses Write-Output, but that psm1 uses Write-Host in some places. This may or may not cause issues, but it's unlikely given that the script works fine with PowerShell DSC.
So it could be a few things:
Make sure whatever runs that script has Administrator privileges, otherwise you will get an access denied error (unless you specify a different Chocolatey installation location).
Make sure you are not getting hit by needing to put in proxy credentials (which is fixed by the Offline Recommendation below).
Make sure you are not getting hit with not being able to access internet resources (which is also fixed by using offline resources).
It could be something else causing a popup, like needing to install .NET 4.x. Recommend you have the latest .NET Framework in the 4.x series installed prior to installing Chocolatey.
Offline Recommendation
The best recommendation we can give - don't use the internet for any part of this script. If you want reliability, you should have everything internal. That includes the install.ps1 script you are going to use for Chocolatey and the chocolatey.nupkg itself.
Take a read over at https://chocolatey.org/install#completely-offline-install to understand our recommendations.
Jenkins is running on windows machine and I am trying to copy files from windows to unix as a build step.
SSH sever details has been configured in the global configuration and connected successfully.
kindly share the Exec command to copy files from windows to unix
You need some kind of ssh client on your windows. I suggest Winscp, which is simple, easy and fast.
Winscp is a GUI application but as you want to run something from Jenkins you need to have a command line tool. Good news is that you can run Winscp in command line. Then the following steps should answer your question:
Install Winscp on the Windows machine.
Add your Winscp installation path (sth like C:\Program Files (x86)\WinSCP) to your system environment path variable
Now you should be able to run winscp command in windows command prompt
The command below will copy the file, you should read winscp manual for more details:
winscp root:password#UNIX_MACHINE_IP /command "put c:/PATH_TO_FILE_ON_WINDOWS /home/PATH_TO_TARGET_ON_UNIX"
There is a Jenkins plugin that might fit your needs:
https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin
It uses Java SSH library so no need to install another SSH client.
To copy files using PuTTY or any unix shell powered with SSH from windows, run this command.
scp /path/to/file.ext user#m192.168.0.100:/Destiny/path
To run commands in your remote computer just connect to it with:
ssh user#192.168.0.100
Customize the user, the IP and authenticate with the properly password.
Frequenlty my work involves to VNC to a remote system and work on it. SInce i run command line apps on this remote system most of the time, i was wondering if there's an alternative software to command prompt which i could install on my local machine. Using this i should be able to create a session with the remote system and from then on all commands issued in command prompt should run in remote system.
localHost>dir --> should list the directory contents in remotehost active directory
localhost>app.exe should run app.exe in remote host and display its contents in localhost command prompt
I browsed a little and read about cmdlets in powershell. But it looks like i need to write a cmdlet for each app in the path (dir, mkdir, app.exe in the path). Correct me if am wrong. Once session is established, i simply need the commands invoked in local host to be run in the remote host and return the console output to local host. Please let me know if powershell + cmdlets are the only way
THanks
Just use PowerShell Remoting if it can be set up (requires a little preparation).
I'm not quite sure why you think of writing own cmdlets for stuff that's already there. dir is an alias to Get-ChildItem which does return the items in the current path (and—depending on options—some other stuff as well). And since PowerShell is a shell it has no problems running external programs too.
SSH is what you're looking for. Cygwin has a SSH server and client.
Unix people do this all the time with SSH. You can install the sshd server on your remote machine through Cygwin, then use PuTTY to connect to it.
As a bonus, PuTTY does not use the clunky Windows cmd.exe program; it's got a much nicer terminal of its own.
You could maybe even run PowerShell on the remote end, so you don't have to learn bash.
Depending upon on how you actuall access the machines PSExec may be an alternative that wont require you to install anything on the remote system.