Merge pull request #445 from docker/acr_login_cleanup

Use existing oauth Token struct rather than create our own
This commit is contained in:
Guillaume Tardif 2020-08-10 14:45:26 +02:00 committed by GitHub
commit 3c7e551940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -30,6 +30,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
ecstypes "github.com/docker/ecs-plugin/pkg/compose"
"github.com/docker/api/aci/convert" "github.com/docker/api/aci/convert"
"github.com/docker/api/aci/login" "github.com/docker/api/aci/login"
"github.com/docker/api/backend" "github.com/docker/api/backend"
@ -39,7 +41,6 @@ import (
"github.com/docker/api/context/cloud" "github.com/docker/api/context/cloud"
"github.com/docker/api/context/store" "github.com/docker/api/context/store"
"github.com/docker/api/errdefs" "github.com/docker/api/errdefs"
ecstypes "github.com/docker/ecs-plugin/pkg/compose"
) )
const ( const (

View File

@ -23,10 +23,11 @@ import (
"github.com/Azure/azure-sdk-for-go/profiles/latest/containerinstance/mgmt/containerinstance" "github.com/Azure/azure-sdk-for-go/profiles/latest/containerinstance/mgmt/containerinstance"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/compose-spec/compose-go/types" "github.com/compose-spec/compose-go/types"
"github.com/docker/api/containers"
"github.com/docker/api/context/store"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp" is "gotest.tools/v3/assert/cmp"
"github.com/docker/api/containers"
"github.com/docker/api/context/store"
) )
var convertCtx = store.AciContext{ var convertCtx = store.AciContext{

View File

@ -26,6 +26,8 @@ import (
"os/exec" "os/exec"
"strings" "strings"
"golang.org/x/oauth2"
"github.com/Azure/azure-sdk-for-go/profiles/latest/containerinstance/mgmt/containerinstance" "github.com/Azure/azure-sdk-for-go/profiles/latest/containerinstance/mgmt/containerinstance"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
compose "github.com/compose-spec/compose-go/types" compose "github.com/compose-spec/compose-go/types"
@ -167,10 +169,7 @@ func (c cliRegistryHelper) autoLoginAcr(registry string) error {
return err return err
} }
type acrToken struct { newToken := oauth2.Token{}
RefreshToken string `json:"refresh_token"`
}
newToken := acrToken{}
if err := json.Unmarshal(bits, &newToken); err != nil { if err := json.Unmarshal(bits, &newToken); err != nil {
return err return err
} }

View File

@ -28,10 +28,11 @@ import (
"github.com/docker/api/context/cloud" "github.com/docker/api/context/cloud"
"github.com/docker/api/errdefs" "github.com/docker/api/errdefs"
ecstypes "github.com/docker/ecs-plugin/pkg/compose"
"github.com/docker/api/backend" "github.com/docker/api/backend"
"github.com/docker/api/compose" "github.com/docker/api/compose"
"github.com/docker/api/containers" "github.com/docker/api/containers"
ecstypes "github.com/docker/ecs-plugin/pkg/compose"
) )
type apiService struct { type apiService struct {