GNU parallel returning retired options error - gnu-parallel

I'm trying to understand how to use GNU parallel, specifically the followin
echo "dir/*" | parallel "./run_script"
but it returns the following errors
parallel: Error: -g has been retired. Use --group.
parallel: Error: -B has been retired. Use --bf.
parallel: Error: -T has been retired. Use --tty.
parallel: Error: -U has been retired. Use --er.
parallel: Error: -W has been retired. Use --wd.
parallel: Error: -Y has been retired. Use --shebang.
parallel: Error: -H has been retired. Use --halt.
parallel: Error: --tollef has been retired. Use -u -q --arg-sep -- and --load for -l.
Does it require input parameters for these options? Seems like these all have default values.

Related

Percentage sign is not working for curl in jenkins pipeline

I have below code in my jenkins pipline
def code = bat(returnStdout: true, script: 'curl -s -o /dev/null http://www.example.org/ -w "\\n STATUS:%{http_code}"')
but when jenkins run this code it is evaluated it as
curl -s -o /dev/null http://www.example.org/ -w "\n STATUS:{http_code}"
Here you can see that it is excluding % and hence it is giving me the error
I tried to escape this % using % or % but it is not working

Python doit module: How to choose which shell to run task actions?

I am using python doit module as a GNU make replacement.
Seems that doit is running actions on /bin/sh:
pedro#Gen83-ubuntu:~$ echo $SHELL
/bin/bash
pedro#Gen83-ubuntu:~$ doit merge_phased
. phase_dataset:15
/bin/sh: 1: [[: not found
TaskError - taskid:phase_dataset:15
Command error: '[[ ! -d phasing ]] && mkdir phasing' returned 127
########################################
phase_dataset:15 <stdout>:
I would like to use /bin/bash. I could not find how to accomplish that in the documentation.
if its a sh file then you can add this at the top to run with bash
#!/bin/bash
or
#!/bin/ksh
to run with ksh

script.sh: Syntax error: "(" unexpected script returned exit code 2

Trying to set body parameter for post method in jenkins, build fails because of error unexpected "(" script returned with error status 2.
Following is the attached code stage in jenkins:
script{
sh ("pip install semgrep")
semgrep_result = sh(script:"semgrep --config=p/r2c-ci src --json",
returnStdout:true).trim()
echo "semgrep_res $semgrep_result"
sh"""
curl -X POST \
-d "result":"$semgrep_result" \
-d "discovery_source":"SAST" \
-d "reponame":"v*****" \
'https://dev************/get_scan_data'
"""
}
It gives error as [2021-09-08T02Z] /home//ace/pi-changes-for-tools-integration#tmp/durabl*/script.sh: 1: /home/j*/***pi-changes-for-tools-integration#tmp/durable-/script.sh: Syntax error: "(" unexpected
script returned exit code
Tried trim along with sh script still gives same error
Can anybody tell what is wrong?

Health check - web

Currently I am trying to check if a webservice running inside a docker container is healthy and if its HTTP status code is 200.
But dockers built in healthcheck only checks for exit codes.
I am running this command via terminal:
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:8080/api/health
And check if the returned status code is 200.
How can I embed this one inside dockers healthcheck?
You can work with the fact that HEALTHCHECK only checks the exit code values of a command as follows:
Use the -w and -s options in curl to only output the http status code of the api request
Use bash test expressions to check the status code
The HEALTHCHECK in your Dockerfile might look like this:
HEALTHCHECK --interval=20s --retries=2 CMD \
[[ "$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:8080/api/health)" == "200" ]]
See documentation here

oh-my-zsh installation returns non zero code

I'm trying to install oh-my-zsh as part of a Docker build (using a Dockerfile). Here's the dockerfile line in question:
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh`
and the error I get is:
The command [/bin/sh -c wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh] returned a non-zero code: 1
Full error gist here
To debug, I've run the command manually and it works. Did anyone have luck installing oh-my-zsh as part of a docker build? any idea why it behaves differently if run this way?
Build failing because install.sh return non zero code, when you execute script manually you are ignoring return code, but docker failing build. Usually non-zero return code indicate error, but if in this case everything ok you could ignore this error:
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true

Resources