Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wagoodman
Copy link
Contributor

@wagoodman wagoodman commented Aug 2, 2020

This PR adds:

  • docker pull for non-existent images, using standard docker config credentials
  • publishes the status on the event bus for detailed progress (by layer)

Closes #33

@wagoodman wagoodman merged commit 146f38f into master Aug 3, 2020
@wagoodman wagoodman deleted the add-docker-pull branch August 3, 2020 19:03
return "", nil, newPayloadErr(e.Type, "Source", e.Source)
}

prog, ok := e.Value.(*docker.PullStatus)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider renaming prog, it's a bit unclear to me what's going on, since we're sourcing the value from a docker.PullStatus and returning it as a docker.PullStatus. Is this a status value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is a reference to a object which the consumer can poll for status continually

return nil
}

func ParsePullDockerImage(e partybus.Event) (string, *docker.PullStatus, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is an exported lib function, it'd be good to write a short explanation of what the function does as a doc comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll follow up in general with better docs for all of these functions

"github.com/wagoodman/go-progress"
)

const (
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the case for int here, as opposed to string, since it looks like you use the values assigned via iota for marking progress later on. In this approach, you need the parsePhase function just to make sense of a given value. I think this is probably fine. At the same time, it's helping me to better think through my philosophy about this, and I might've approached it a bit differently. To me, the string values seem more directly associated with a phase's identity, whereas the progress values seem like a derivative use case. In that scenario, I think I'd define these values as strings, and then use a map or something similar to declare the associated progress values for a given phase (e.g. map[PullPhase]int64). Primary reason: this makes the identity of the value the first class citizen (i.e. doesn't require a specialized function like parsePhase) and the specific use within the progress/eventing system use one extra logic step. Secondary reason: this lets you decouple the scale of iota with how you want to scale progress. For example, maybe you want to make the WaitingPhase a lower value, since not much has been accomplished; maybe you want to me the PullingFsPhase take longer since it's I/O and represents more work; whatever, hopefully you get the idea 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to summarize our conversation: I'll leave the type of PullPhase alone and I'll translate the existing parse function for a map

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.

Should attempt to pull docker images if possible

3 participants