Giter Club home page Giter Club logo

Comments (25)

pipelight avatar pipelight commented on June 4, 2024 1

So! Let me rephrase in my own words.
If I understand, you want the pipeline to be attached when run through git-hooks.

So that, whenever something unexpected happens on a git push for example:

  • You can see the displayed logs.
  • The git operation is halted.

I like pipelines detached by default, because long running jobs can run without stopping or halting git commands.
But if this behavior is to unconventional and harm the users software quality, i will change asap default to attached.

I came to an option,
that could circumvent the issue.

A global and a per pipeline flag to override the default behavior.

const config: Config = {
  pipelines: [{
     steps:[],
     attach: true
  }],
  attach: true
};

In the case where attached becomes the default behavior:

const config: Config = {
  pipelines: [{
     steps:[],
     detach: true
  }],
  detach: true
};

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

The last option really looks good only if you also add the log settings.

I suggest some kind of option:

// Yes, java bit me
type additionOfConfigOrPipelines = {
  // true - attach, false - detach,failure - when an error occurs
  attach: boolean|"failure"
  // -v = 1,-vv = 2,-vvv=3,-vvvv=4
  logLevel: 1|2|3|4
}

If it is possible to do this, I will be very grateful and it will solve a lot of problems.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024 1

Nice! Let's do it!

I'll need some time!

I'll come back in 24h with something!

from pipelight.

pipelight avatar pipelight commented on June 4, 2024 1

I came to something that should satisfy us both...

The behavior on the command line for the run subcommand remains unchanged:

# run a pipeline in detached mode
pipeline run <pipeline_name>
# run a pipeline in attached mode
pipeline run <pipeline_name> --attach

The command executed by every git hooks is pipelight trigger.
Therefore the behavior of the trigger subcommand is the one that has evolved:

Now git hooks are by default attached:

# run pipelines in attached mode
pipeline trigger --attach
  1. For heavy workloads that should run in the background, one needs to specify.
pipelines: [
  {
    name: "run_in_bg"
    options: {
       attach:  false  // or detach: true?
    }
  }
]
  1. Pipelight logs are printed to stdout on git action (whether it succeeds or not)
    To change default pipeline log level(error) use the following option:
pipelines: [
  {
    name: "run_in_bg"
    options: {
       log_level:  "error" | "warn" | "info" | "debug" | "trace" 
    }
  }
]

Does it suits your needs ?

Maybe I shouldn't keep those names for the log levels as they does not make much sense for the tree view, but I prefer it to numbers.

What sounds more logic to you between the use of detach: true or attach: false to override the default attached behavior ?

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

Thank you very much, I hope this will improve the product and make it even more attractive.
Yes, if it is possible to define behavior for all pipelines at the same time, then it will be even better.
I don’t know about others, but it seems logical to me to use attach: false and not add another option in the configuration.

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

This is the fastest support I've seen so far!
After looking at the code, I may have missed it, but will it be possible to change logLevel globally?

from pipelight.

pipelight avatar pipelight commented on June 4, 2024 1

I am on it!

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

Thanks for your help and implementation

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

I checked and so far neither global config nor local pipelines options are working

const config: Config = {
  pipelines: [
    lint,
  ],
  options: {
    attach: true,
    log_level: "info",
  },
}

Here is my configuration, and the task executes, but does not display in the terminal.

WIth git-hooks, after fixing the typo, everything works fine

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

If there is such a possibility, then it would not be bad for run to have such settings.
I understand that it is possible to enter a long command each time.
But when working, it is more convenient to run it briefly and watch the output.
Use this tool like task runner.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024 1

Ah yes!

For the "info" log level, pipelight prints stdout on succes and stderr on fail.

Linters tend to avoid standards and print to both outputs.

I recommand setting the log level to "trace" to display stdout and stderr when linters are involved.

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024 1

Yes, I checked everything, it really works great.
Thank you very much again for such a prompt solution to the problem.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

It's here for you to test! On the feature/detach_flag branch!
I will merge it tomorow to the dev branch / then to master once it's polished and that the doc is updated.
It shouldn't take more than a day.

Thank you for your kind support!
I hope you'll appreciate the software even more!! πŸ˜„

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

Just merged the feature into master and updated the documentation:
version tag is v0.7.13

I indeed added the global properties.
Don't forget to regenerate your git-hooks πŸ˜‰ .

pipelight enable git-hooks

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

Indeed there's a bug in log levels.

Which command doesn't work as expected?

  • pipelight run
  • or pipelight trigger when using git commands

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024

Settings don't work in both version.
That is, they do not affect anything.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

I pushed the v0.7.14 to master! This should do the trick! πŸ™
The global settings were not retrieved properly.

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024

The settings do now work for git-hooks, but still do not work for the run command.
And, unfortunately, big output is not displayed.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

Ah! I am relieved it finally works!

This was intended to be as is:
I chose that pipelight run will not be overridden by those settings because they can be set on the command line.
only pipelight trigger is impacted because it is a mess to dig inside the git hook and modify it manually.

For the big output...
Does it displays at least something like the pipeline header?

● Succeeded - Fri, 1 Dec 2023 10:59:43 +0100
branch: master
action: pre-push
commit: 2efb5d211f575d651d0adc0cb5c5923fdfb5c244
pipeline: test_options (2s15ms)

or just nothing ?

maybe you'd want to set the log level to trace?
Ensure the global level is not overridden by the pipeline property.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

Ok! I'll modify the run command behavior

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024

For large ouptut, everything is displayed except the output itself.
24129

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

So! I don't know if this is easy for you to try it, but I made the changes available into the dev branch!
The configuration settings now inpact the pipelight run command! and the arguments of the command line can overridde these settings.

As I may not have the time needed for deeper code review today, the changes will only be merged to master tomorrow.

from pipelight.

kogeletey avatar kogeletey commented on June 4, 2024

Thank you for quickly introducing new features.
LogLevel doesn't work yet, but attach is ok.

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

I needed to better understand the clap.rs crate. All done and pushed to master under v0.7.15

from pipelight.

pipelight avatar pipelight commented on June 4, 2024

Fiiine! I am looking forward to read you for other improvement suggestions!!

from pipelight.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.