Skip to content

Commit

Permalink
remove docker operations timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Devyatkin <[email protected]>
  • Loading branch information
Andrey9kin committed Aug 2, 2021
1 parent c930f90 commit 98cbade
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### v0.2.3

* Increased push timeout to 10 min
* Improved docker push output to reduce noise
* Remove timeout from Docker operations
* More compact docker push output to reduce noise

### v0.2.2

Expand Down
9 changes: 2 additions & 7 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"encoding/json"
"fmt"
"io"
"time"

dockerTypes "github.com/docker/docker/api/types"
"github.com/docker/docker/client"
Expand All @@ -43,15 +42,13 @@ func getDockerClient() (*dockerClient.Client, error) {
}

func imagePush(dockerClient *client.Client, authConfig dockerTypes.AuthConfig, repo string, tag string) (ImageId, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
defer cancel()

authConfigBytes, _ := json.Marshal(authConfig)
authConfigEncoded := base64.URLEncoding.EncodeToString(authConfigBytes)

target := repo + ":" + tag
opts := dockerTypes.ImagePushOptions{RegistryAuth: authConfigEncoded}
rd, err := dockerClient.ImagePush(ctx, target, opts)
rd, err := dockerClient.ImagePush(context.Background(), target, opts)
if err != nil {
return ImageId{}, err
}
Expand All @@ -72,10 +69,8 @@ func imagePush(dockerClient *client.Client, authConfig dockerTypes.AuthConfig, r
}

func imageTag(dockerClient *client.Client, imageId string, newImageId string) error {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*600)
defer cancel()

err := dockerClient.ImageTag(ctx, imageId, newImageId)
err := dockerClient.ImageTag(context.Background(), imageId, newImageId)
if err != nil {
return err
}
Expand Down

0 comments on commit 98cbade

Please sign in to comment.