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

PERFORCE: Do not output peforce syncing to console #10

Closed
v1v opened this issue Mar 4, 2014 · 5 comments
Closed

PERFORCE: Do not output peforce syncing to console #10

v1v opened this issue Mar 4, 2014 · 5 comments

Comments

@v1v
Copy link

v1v commented Mar 4, 2014

DESCRIPTION:
Our perforce projects and materials are huge, so for each job there are thousands of lines about the p4 updating phase, and it makes our Console tabs huge and hard to debug in case of any errors.

FEATURE:
As Developer I'd like to redirect that output to another tab

EXAMPLE:
URL: http://go.xxxxx.com/go/tab/build/detail/Project-0.0/95/Build/1/Build
Console tab:

[go] Start to prepare Project-0.0/285858/Build/1/Build on ci-cent5-019.xxxxx.com [/space/go-agent] at Tue Mar 04 12:16:45 GMT 2014
[go] Cleaning working directory "/space/go-agent/pipelines/Project-0.0" since stage is configured to clean working directory
[go] Start updating files at revision 285858 from perforce:1666
Client cruise-ci-cent5-019.xxxx.com-Project-0.0-LvmKLZEYMmUfkjm8kuVj2hA3gjc saved.
//Project/0.0/Lab/JavaAPI/.classpath#2 - deleted as /space/go-agent/pipelines/Project-0.0/Project/0.0/Lab/JavaAPI/.classpath
//Project/0.0/Lab/JavaAPI/.project#2 - deleted as /space/go-agent/pipelines/Project-0.0/Project/0.0/Lab/JavaAPI/.project
//Project/0.0/Lab/JavaAPI/.settings/org.eclipse.jdt.core.prefs#2 - deleted as /space/go-agent/pipelines/Project-0.0/Project/0.0/Lab/JavaAPI/.settings/org.eclipse.jdt.core.prefs
......
(another thousands lines about p4 sync output)
.....

FURTHER DETAILS:
I've already tried the suggested approach:
http://support.thoughtworks.com/entries/21577271-Is-it-possible-to-read-the-P4CLIENT-setting-that-an-agent-is-using-

But even using a p4 (p4.sh p4.cmd) wrapper, still got issues...

@arvindsv
Copy link
Member

arvindsv commented Mar 7, 2014

It might not have worked, because this information is coming from the agent-side. So, the p4 wrapper would need to be replaced on the agent-side and the PATH of the agent should be changed.

I think what you said makes sense. For smaller projects, though, they might appreciate that extra information. I'm wondering about a more generic solution. Maybe making the console logs more configurable (ability to hide lines, marking task start better, etc). Should be able to do that in Javascript.

@v1v
Copy link
Author

v1v commented Apr 30, 2014

Regarding your suggestion, we replaced those p4 scripts on the agent-side, but it didn't work as we expected it.

Finally, we took the below script: https://github.com/programmiersportgruppe/go-defrustrator and added the below snippet:

    // Perforce  
    applyRegex(/\/\/(?!artifactory).*\n/g, "");    
    applyRegex(/(Client .* not changed)/g,"<span style='color: blue;'>$1</span>\n");

To be honest, that snippet works, but it takes longer to present that information. It would be worth if we would have a way of enabling/disabling that verbose output.

Technically, there is a minor change in order to get rid of that verbose output, but I'm not sure if the community would be agree about it:

Source: com/thoughtworks/go/domain/materials/perforce/P4Client.java
https://github.com/gocd/gocd/blob/master/common/src/com/thoughtworks/go/domain/materials/perforce/P4Client.java

as it is:

  public void sync(long revision, boolean shouldForce, ProcessOutputStreamConsumer outputStreamConsumer) {
        if (shouldForce) {
            execute(p4("sync", "-f", clientView() + "@" + revision), "", outputStreamConsumer, true);
        } else {
            execute(p4("sync", clientView() + "@" + revision), "", outputStreamConsumer, true);
        }
    }

would be:

    public void sync(long revision, boolean shouldForce, ProcessOutputStreamConsumer outputStreamConsumer) {
        if (shouldForce) {
            execute(p4("sync", "-q", "-f", clientView() + "@" + revision), "", outputStreamConsumer, true);
        } else {
            execute(p4("sync", "-q", clientView() + "@" + revision), "", outputStreamConsumer, true);
        }
    }

Obviously, it would be great to have a flag (checkbox) under the materials configuration in order to enable/disable it, but likely it would affect some changes within the database. I would be happy to develop that feature but I need some tech advices about it. Let me know If you have any clues about it.

Cheers

@v1v
Copy link
Author

v1v commented May 23, 2014

Hi again,
any suggestions about this ticket?
Thanks

@arvindsv
Copy link
Member

Hey @v1v,

That sounds like a good idea. You seem to have found the right code as well. Making it configurable, is the important part here, as you mentioned. Luckily, in this case, we can make a change that affects only the configuration and not the database (with a caveat). So, I think it'll be good for you to try to do this. I can help you.

I wrote detailed steps to do this, but thought maybe you'll want to find it out yourself. :) So, I've written slightly high-level steps here. Let me know if you need more help or details. I'll be happy to provide them:

  1. Add a config migration to upgrade schema version. As a part of it, make a new flag (say, "quietOutput") part of the XSD for the P4 part of the configuration.
  2. Now that the XML can be saved with the flag, you need to connect it to the code. You should make changes here and here and then in P4Client (the place you mentioned earlier).
  3. Changing the UI (optional): This would be the file to look at.

Caveat:

This works for current runs, but since the flag is not stored in the database, it will not be used for reruns (if you rerun an older instance). It will then revert to the default (verbose output) for that run. I think it's a good tradeoff.

If you need more details, just let me know.

Cheers,
Aravind

@arvindsv arvindsv modified the milestone: Unknown - Needs interest from someone Jan 4, 2016
@arvindsv
Copy link
Member

Closing as stale.

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

No branches or pull requests

5 participants