Executing script even if they are failures in yml file - aws-codebuild

Hi All I am tying to setup a RestAPI pipeline in aws codebuild. I have custom Newman docker. I have a build command that will failure but I want to execute the rest of the commands as well. but shell stops executions other commands when the Newman command fails. how to execute other commands in yml file.

One simple way would be:
You can create a custom shell script (mycommand.sh) with your command that can cause error inside a try catch statement (so that it will not result in an error)
In your Code build's yml file under commands section, just execute the ./mycommand.sh
Source:
https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-cmd.html

Related

How to run a karate script using power-shell command prompt

In power-shell window command prompt how to run a karate script. can you briefly explain the process on this.
Download the standalone JAR file: https://github.com/intuit/karate/tree/master/karate-netty#standalone-jar
Assuming you have the JAR and feature file in the same directory, you can trigger the script from the command prompt using the following command:
> karate.jar testscript.feature
Since you are new to stack overflow, please do read the following to best get help:
https://stackoverflow.com/help/how-to-ask
https://stackoverflow.com/help/someone-answers

Is there a way to run command lines asynchronously in Azure-DevOps Build Pipeline?

I'm setting up an Azure-DevOps pipeline in which I want to include automated tests via the Newman CLI.
Imagine a pipeline like this.
Build Project
Copy build to test folder
Run the application => (API-Server)
Run Newman
Kill API Server Process
On Success Copy Build to another folder.
My Problem is that my server application is in a waiting state after it's initialization.
The next Task in my build pipeline won't start.
Is there a way to run multiple command lines asynchronously in Azure-DevOps?
Starting the process in via "start" won't work since it throws me an
ERROR: Input redirection is not supported, exiting the process immediately.
start "%TESTDIR%\foo\bar.exe"
timeout 10

Browsing IE via its COM object in Powershell

I've written a Powershell script to automate a Web UI test using IE. The script runs fine when I execute it from PowerShell. However, I have run into an obscure problem and that is when I run my Web UI test script from another powershell script, it fails. I tried to debug it and found that it fails on the following line.
$button = $ie.Document.getElementsByTagName("button")
$button.Item().Click() # $button.Item() evaluates to null when the script is executed from another script.
Can anyone help me figure this out? It appears that when I run the script, the script has no issues locating the element, but when it is run from another script the element I am looking for cannot be located.
EDIT
I get the same error when I run the PS script through Task Scheduler. The script only works when I invoke it directly. If I invoke via another script/program, it doesn't work.

How to pass argument to another jenkins build step

In Jenkins job i need to execute shell on jenkins machine. I use Execute shell step from there i get value, which have to be used in another step Execute shell script on remote host using ssh. I can't find way to pass that value...
Here is my jenkins job configuration:
I appreciate any help.
Content of the file which constains the script:
echo "VERSION=`/data/...`"> env.properties
Path of the properties file:
env.properties
In shell script using ssh:
echo"... $VERSION"
Something like this works for the build, maybe here works too.

Apache Synapse custom Mediator to execute system command

I create a custom mediator in apache synapse to invoke some system command such as java -jar, execute shell script, etc.. But i have no luck to this, i tried these codes :
Process process =runtime.exec("touch /opt/FILE.txt");
and
Process p = runtime.exec(new String[]{"java","-jar","/opt/MyMediator.jar"});
both of them were runnable when i create the jar and run the jar manually, but when i deploy it to the synapse lib, it wont work. So can anybody tell me how to do this properly?
Thanks,