Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitlab CI collapsible sections use unique section header name. #3787

Closed
fliespl opened this issue Mar 8, 2024 · 6 comments · Fixed by #3817
Closed

Gitlab CI collapsible sections use unique section header name. #3787

fliespl opened this issue Mar 8, 2024 · 6 comments · Fixed by #3817

Comments

@fliespl
Copy link
Contributor

fliespl commented Mar 8, 2024

Currently script uses unix timestamp ($start) as both start time + section name (same goes for section_end - using $start).

This causes collision within multiple tasks running in the same second cause it's used by gitlab for grouping.

           $this->output->writeln("\e[0Ksection_start:{$start}:{$start}[collapsed=true]\r\e[0K{$task->getName()}");
           $this->output->writeln("\e[0Ksection_end:{$endTime}:{$start}\r\e[0K");

I think better solution is to use slug of task name:

           $this->output->writeln("\e[0Ksection_start:{$start}:{$slug}[collapsed=true]\r\e[0K{$task->getName()}");
           $this->output->writeln("\e[0Ksection_end:{$endTime}:{$slug}\r\e[0K");

or to be more "unique" - combination of task name slug + startTime:

           $this->output->writeln("\e[0Ksection_start:{$start}:{$slug}_{$start}[collapsed=true]\r\e[0K{$task->getName()}");
           $this->output->writeln("\e[0Ksection_end:{$endTime}:{$slug}_{$start}\r\e[0K");
@mbrodala
Copy link
Contributor

Or make use of e.g. uniqid()

@mbrodala
Copy link
Contributor

mbrodala commented Aug 27, 2024

@antonmedv Can you make a new release with this change? I would like to test it but cannot apply it as patch since dep is a Phar in releases.

@antonmedv
Copy link
Member

Will do a release.

@mbrodala
Copy link
Contributor

mbrodala commented Oct 31, 2024

Unfortunately this still doesn't work well with tasks like this:

desc('Clean up old local releases');
task('local:cleanup', function () {
    on(localhost(), function (): void {
        invoke('deploy:cleanup');
    });
})->once();

Our deploy task:

task('deploy', [
    // ...
    'deploy:cleanup',
    'local:cleanup',
    // ...
]);

So strictly speaking the deploy:cleanup task is run twice but once for the remote host and once for the local host. So I assume that the section ID must be composed of the task and the current host?

@mbrodala
Copy link
Contributor

@antonmedv Would you accept an adjustment so that Messenger:startTask() and ::endTask() also get the processed host? Then the section should be unique.

@antonmedv
Copy link
Member

I think yes. I'm now in big refactoring so we can introduce those changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants