'Getting CURL output during docker build

Is there a way of outputting a curl outcome from a RUN instruction during docker build?

I am doing:

RUN if [ "$ARG" = "yes" ] ; then curl -X 'GET' \
  'https://myAPI-test.com/route/TestStaatus' \
  -H 'accept: */*' ; else echo "API not called" ; fi

I know it works because I can see the actual api response in a different running pod:

Executing API by Status: TestStaatus
0

However, I cant see this output during the docker build execution. It outputs only the layers:

CACHED [builder  7/14] COPY package.json yarn.lock .npmrc contrast_security.yaml ./                                                                                     0.0s
 => [builder  8/14] RUN if [ "yes" = "yes" ] ; then curl -X 'GET'   'https://myAPI-test.com/route/TestStaatus'   -H 'accept: */  1.6s
 => [builder  9/14] RUN npm install --global yarn

I want to check if the api runs during build time and, depending on the response, abort the build.

E.g if don't get a 200 status out of

curl -X 'GET' \
  'https://myAPI-test.com/route/TestStaatus'

then abort docker build



Solution 1:[1]

In SQL using CTE

with cte as (
  select id, max(a) a from your_table_name group by id
),
cteb as (
  select row_number() over (partition by id order by b desc) sn , 
  id, b, c, d from your_table_name
)

select id, a, b, c, d 
from cte  a inner join cteb b using(id) 
where sn = 1 
order by cast(id as integer)

Solution 2:[2]

In Python:

(df.assign(A=df.groupby('ID')['A'].transform(max))
   .sort_values(by=['B'], ascending=False)
   .drop_duplicates(subset=['ID'])
)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gregor Thomas
Solution 2 Chris