Skip to content

feat: add quiet image pulls by default#665

Open
7h3-3mp7y-m4n wants to merge 1 commit into
urunc-dev:mainfrom
7h3-3mp7y-m4n:quite
Open

feat: add quiet image pulls by default#665
7h3-3mp7y-m4n wants to merge 1 commit into
urunc-dev:mainfrom
7h3-3mp7y-m4n:quite

Conversation

@7h3-3mp7y-m4n
Copy link
Copy Markdown

Description

This PR suppresses noisy image pull progress output during end-to-end tests by enabling quiet image pulls by default for supported tools (e.g. docker and nerdctl).

An optional URUNC_VERBOSE_PULL environment variable was added to allow verbose image pull logs when debugging is needed.

Related issues

How was this tested?

LLM usage

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

Signed-off-by: 7h3-3mp7y-m4n <emailtorash@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit aabbb67
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a038737cca066000823d6ec

Copy link
Copy Markdown
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @7h3-3mp7y-m4n ,

thank you for this. I am not sure if this works correctly (see a comment below). Please test your changes before opening a PR.

Comment thread tests/e2e/utils.go
switch testFunc {
case testCrictl:
cmd := crictlName + " pull " + image
output, err := commonCmdExec(cmd)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should not get removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I'll do the changes

Comment thread tests/e2e/utils.go

// Set URUNC_VERBOSE_PULL=true locally to see pull progress output
func verbosePull() bool {
v := os.Getenv("URUNC_VERBOSE_PULL")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use strcov.ParseBool for a better handling of the value.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you are right, it would be very handy for local debugging.

@7h3-3mp7y-m4n
Copy link
Copy Markdown
Author

Hello @7h3-3mp7y-m4n ,

thank you for this. I am not sure if this works correctly (see a comment below). Please test your changes before opening a PR.

The sad part is that I can't test it locally, because certain things can't work with my MacOS system :( , I do have a Rancher and I can run some nerdctl command and could verify the --quite flag, or I might need to do it via codesapce.

If there are other ways, then I would love to know about them.

@cmainas
Copy link
Copy Markdown
Contributor

cmainas commented May 14, 2026

Hello @7h3-3mp7y-m4n ,

Hello @7h3-3mp7y-m4n ,
thank you for this. I am not sure if this works correctly (see a comment below). Please test your changes before opening a PR.

The sad part is that I can't test it locally, because certain things can't work with my MacOS system :( , I do have a Rancher and I can run some nerdctl command and could verify the --quite flag, or I might need to do it via codesapce.

If there are other ways, then I would love to know about them.

you can use a VM for that and test at least whatever is possible (e.g. spt images).

@7h3-3mp7y-m4n
Copy link
Copy Markdown
Author

Hey @cmainas, I have an update on this.

While looking at commonCmdExec, I introduced a discardStdout bool parameter to control stdout behavior.

Earlier the function always captured stdout with no way to control it, which meant noisy progress bars from ctr always showed up in CI logs.

Now with this flag:

  • false — behaves exactly as before, stdout captured normally
  • true — stdout is piped to io.Discard, used for ctr to suppress noisy progress bars

The key point is stderr is always captured regardless of this flag, so even when we discard stdout for ctr, any network failures or errors still surface to the caller.

For the other tools:

Tool Strategy Reason
docker -q flag Natively supported, suppresses progress bars
nerdctl -q flag Natively supported, suppresses progress bars
ctr discardStdout=true No quiet flag, stdout discarded, errors via stderr
crictl No action needed A single flat line not much of noise
func commonCmdExec(command string, discardStdout bool) (output string, err error) {
    var stderrBuf bytes.Buffer
    params := strings.Fields(command)
    cmd := exec.Command(params[0], params[1:]...)
    cmd.Stderr = &stderrBuf  // always captured regardless of discardStdout
    if discardStdout {
        cmd.Stdout = io.Discard
        err = cmd.Run()
    } else {
        var outBytes []byte
        outBytes, err = cmd.Output()
        output = strings.TrimSpace(string(outBytes))
    }
    if err != nil {
        output += strings.TrimSpace(stderrBuf.String())
        return output, err
    }
    return output, nil
}

Tested locally, errors are visible for all four tools even in the failure case.
Screenshot 2026-05-20 at 3 32 37 AM

I might be wrong with my approach, but would love to get your thoughts on this.

@cmainas
Copy link
Copy Markdown
Contributor

cmainas commented May 20, 2026

Hello @7h3-3mp7y-m4n ,

this should not take place in the commonCmdExec function, but when the pull command is constructed (in https://github.com/urunc-dev/urunc/blob/154fc9edae370e3fd9aa7863052ecb565181b153/tests/e2e/utils.go#L81C6-L81C22 and https://github.com/urunc-dev/urunc/blob/main/tests/e2e/common.go#L125)

@cmainas
Copy link
Copy Markdown
Contributor

cmainas commented May 20, 2026

It would be better to introduce a new function with the stdout discard logic, rather than changing commonCmdExec which is used in various parts.

@7h3-3mp7y-m4n
Copy link
Copy Markdown
Author

It would be better to introduce a new function with the stdout discard logic, rather than changing commonCmdExec which is used in various parts.

Okay, I'll try to make a new function and share with you how it went.

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 this pull request may close these issues.

Make image pull ing less verbose in end-to-end testing

2 participants