lab icon indicating copy to clipboard operation
lab copied to clipboard

pass a command and a job in parameter to lab ci view

Open MartinDelille opened this issue 7 years ago • 2 comments

What about adding a command and a job to lab ci?

Example: in my CI I have to job build and test. Let's say I want to trace the test job:

$ lab ci trace test

It would directly output the job trace and returning to the shell with a result of 0 or -1 if the job succeed or failed.

MartinDelille avatar Dec 04 '18 16:12 MartinDelille

Few thoughts here:

  1. lab supports passing in the job to lab ci trace
$ lab ci trace --help
If a job is not specified the latest running job or last job in the pipeline is used

Usage:
  lab ci trace [remote [[branch:]job]] [flags]

Aliases:
  trace, logs

Flags:
  -h, --help   help for trace

From you command probably something like

lab ci trace origin master:test
  1. The syntax is attempting to emulate some syntax from git. On another CI related issue, I'm questioning the decision myself: https://github.com/zaquestion/lab/issues/232#issuecomment-436389898 copying that here

the idea with branch:job was to emulate how git lets do stuff like git checkout origin branch:file -- A simple extension would just be to keep the colons going lab ci artifacts origin master:myjob:path/to/my/file, but mostly I'm wonder why colon separate at all and just do lab ci artifacts [remote [ branch [ job [ path ]]]

  1. The idea of adjust the exit code for job pass/fail is appealing. I'm not sure the trace command is the best place for it. Since a failed exit code would still indicate lab ci trace successfully printed logs. But I think the feature makes a lot of since for lab ci wait https://github.com/zaquestion/lab/issues/240

zaquestion avatar Dec 05 '18 20:12 zaquestion

IMHO the exit code of a command should reflect if it succeeded or not, and in the lab ci trace it shouldn't have any relation to the job failing or not. For it, you could use grep for grepping a successful message and then get the exit code of grep itself, which relates to "text found" or "text not found".

@MartinDelille, considering the command line mentioned by @zaquestion on his comment and the above statement, would that solve your concerns raised in this issue?

bmeneg avatar Jun 22 '21 17:06 bmeneg