bash.exe not working on Jenkins (Windows) - windows

When running a build under "Execute Windows batch command" with the "C:\Windows\System32\bash.exe --version" it fails with the error "exit -1073741819".
If I run the same command on the windows command line on the same machine but locally, it works just fine.
Any inputs on where I am failing? I am trying to avoid using git or cygwin and just keep things equal as when I manually run it.
Prints:

Related

Trying to use ansible to Deploy 22H2, but my powershell script doesn't run on my target computer

I made an Ansible script to push out Windows 10 22H2 and I have the exe but anytime I try running this:
- name: Install 22H2 using powershell
ansible.windows.win_powershell:
script: C:\Temp\Windows10Upgrade9252.exe /skipeula /quietinstall /auto upgrade
Ansible just runs through the script and the PowerShell doesn't run. Yes I set my execution policy and no I don't get any errors back, again it just runs through it.
Also, when I run this script on the target computer in its own PowerShell session, it works great.
I also tried creating a script with that PowerShell command and then putting it on the target's C drive and then using the PowerShell module to run it, but to no avail.

Using WSL2 to execute jenkins scripts made for linux nodes

We have been using linux test bots so far in Jenkins and have made groovy scrpts that call bash scripts to execute tests. Now we need to add Windows test bots to the pool but we cant start WSL from the script.
Is there any way to use WSL instead of bat / powershell to run bash commands in jenkins pipelines?
using for example wsl -l or wsl + one command works, but just executing the command wsl from the code does not give any error.
Manually triggering wsl from cmd / powershell on the device directly works without any issues.

How to i execute bash commands on jenkins-slave (windows)?

I am checking out the codes from git-hub repo on windows machine.
Steps as follows:
1) launch the git-bash.exe
2) In bash mode, git clone location.
This windows machine will be as jenkins-slave.
I need to run these commands on slave machine.
I cannot run these commands as "Execute as windows batch command"
Could you please help me here.
What you need to do is:
Add a "Execute windows batch command" step in your Jenkins job's build step.
There cd to the bin folder (ex: C:\Program Files (x86)\Git\bin) in the git installation directory of your slave system.
Then execute your git clone command or any other gitcommands you wish to execute.

Running maven command remotely using ssh

Trying to execute a script on the remote aws centos machine using the command mentioned below
ssh root#hostname script
Everything works fine until the script comes to a maven command. For example "mvn package" in the script. Getting the error below.
bash: mvn: command not found

Jenkins not playing nice with a private GitHub repository (Windows)

I cannot for the life of me seem to get my Jenkins CI to work with Github.
I had failure on the clone command, but that was due to keys, so I logged in as service account (the user Jenkins runs under as a Windows Service) and ran the clone command. All good in the hood.
However, when I want to run the fetch to get latest, it won't finish. It just sits there. I have tried via the Git plugin for Jenkins, and also via a Windows commandline script. Neither work. However, if I open a command prompt and type the command in, it works!
So how do I get it to work via Jenkins?
I run this script:
set
"C:\Program Files (x86)\Git\bin\git.exe" fetch -t ssh://git#github.com/OrgName/MyRepo.git +refs/heads/*:refs/remotes/origin/*
exit 0
and it sticks on the fetch command, never exiting.
Does someone have any suggestion?
It looks like msysGit stuck trying to find one of its components, used during fetch operation.
The Git itself not a single executable actually. It's a set of small tools doing their job great only being put together. Running Git on Windows from bash prompt makes it happen, but when you're running via Windows command prompt or in batch-files, the Force may not be with you.
I think you should check wherever you installed msysGit with option "Run Git from Windows Command Prompt". In this case all needed parts of Git will be added to the system PATH variable and git.exe will be able to access it from batch files, thus it should fix your fetch statement.

Resources