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

Pullimage sdk migration #1623

Merged
merged 2 commits into from
Oct 16, 2018
Merged

Conversation

yhlee-aws
Copy link
Contributor

@yhlee-aws yhlee-aws commented Oct 15, 2018

Summary

Migrating pull image to SDK

Implementation details

go-dockerclient used to handle a lot more including inactivity timeout and response "event" object from the image pull. These are handled in agent codebase now, reusing inactivity timeout from stats, and creating custom imagePullResponse object. There's an open issue for handling pull image response event on docker side (docker/engine-api#89) so I didn't want to add premature dependency on it.

Testing

  • Builds on Linux (make release)
  • Builds on Windows (go build -out amazon-ecs-agent.exe ./agent)
  • Unit tests on Linux (make test) pass
  • Unit tests on Windows (go test -timeout=25s ./agent/...) pass
  • Integration tests on Linux (make run-integ-tests) pass
  • Integration tests on Windows (.\scripts\run-integ-tests.ps1) pass
  • Functional tests on Linux (make run-functional-tests) pass
  • Functional tests on Windows (.\scripts\run-functional-tests.ps1) pass

New tests cover the changes: yes

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yhlee-aws yhlee-aws requested a review from a team October 15, 2018 18:23

pullFinished := make(chan error, 1)
// TODO Migrate Pull Image once Inactivity Timeout is sorted out
subCtx, cancelRequest := context.WithCancel(ctx)

go func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this go routine along with the select statement necessary since we now implement the full go routine with the sdk change? It seems the select statement was only to catch a premature error (if nothing was being pulled), but now we can handle the error within the go routine without the select statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

given that images can be large and take long time to download, I think go routine here is necessary so that it is handled in a separate thread. I'm sure that this can be cleaned up, but I'd like to limit changes in behavior between go-dockerclient and SDK, and prefer to come back to this to make any improvements.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're still using the goroutine for the pullBegan timeout. You could rework that, but I think its fine to only focus on translating the API for now.

Copy link
Contributor

@linkar-ec2 linkar-ec2 left a comment

Choose a reason for hiding this comment

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

LGTM

@yhlee-aws yhlee-aws merged commit c0d0209 into aws:moby Oct 16, 2018
@yhlee-aws yhlee-aws deleted the pullimage_sdk_migration branch October 16, 2018 18:06
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.

3 participants