Code Monkey home page Code Monkey logo

Comments (3)

ILMTitan avatar ILMTitan commented on August 18, 2024

I haven't tried to do this, so I'm not actually sure.

The extension contains a Gcloud Command Line task. Using that, you can try running gcloud auth config-docker.

That may not work with the way the extension injects the credentials into every command. If it does not work, I would try running gcloud auth activate-service-account --key-file=tempKeyFile.json first.

from google-cloud-tfs.

Formator avatar Formator commented on August 18, 2024

@ILMTitan Thank you very much for your input. I have already try both commands before but without success. I have now retry both from the beginning and here is report with same result as last time:

  1. Tasks:
  • auth configure-docker
  • Docker Compose Images build
  • Docker Compose push

Log:

==============================================================================
Task         : Gcloud Command Line
Description  : Execute an arbitrary gcloud command.
Version      : 0.0.2
Author       : Google Cloud Tools
Help         : [List of gcloud commands](https://cloud.google.com/sdk/gcloud/reference/).
==============================================================================
9929f287-** exists true
C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd" auth configure-docker --credential-file-override="C:\agent\_work\3\s\tempKeyFile.json""
WARNING: `docker-credential-gcloud` not in system PATH.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
WARNING: `docker` not in system PATH.
`docker` and `docker-credential-gcloud` need to be in the same PATH in order to work correctly together.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
gcloud credential helpers already registered correctly.
******************************************************************************
Finishing: Gcloud Command Line
******************************************************************************
....
==============================================================================
Task         : Docker Compose
Description  : Build, push or run multi-container Docker applications. Task can be used with Docker or Azure Container registry.
Version      : 0.4.15
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=848006)
==============================================================================
"C:\Program Files\Docker\Docker\Resources\bin\docker.exe" push eu.gcr.io/**dev/**.api:latest
ERROR: (gcloud.auth.docker-helper) You do not currently have an active account selected.
Please run:
  $ gcloud auth login
to obtain new credentials, or if you have already logged in with a
different account:
  $ gcloud config set account ACCOUNT
to select an already authenticated account to use.
The push refers to repository [eu.gcr.io/**/**.api]
a8ab8bff4d74: Preparing
0d0fb6754078: Preparing
55f6c628a3d5: Preparing
fca06706d90a: Preparing
cd7100a72410: Preparing
unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
ERROR: (gcloud.auth.docker-helper) You do not currently have an active account selected.
Please run:
$ gcloud auth login
to obtain new credentials, or if you have already logged in with a
different account:
$ gcloud config set account ACCOUNT
to select an already authenticated account to use.
C:\Program Files\Docker\Docker\Resources\bin\docker.exe failed with return code: 1
  1. Tasks:
  • iam service-accounts keys create --iam-account *-compute@*.gserviceaccount.com keytmp.json
  • auth activate-service-account --key-file=keytmp.json
  • Docker Compose Images build
  • Docker Compose push

Log:

C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd" iam service-accounts keys create --iam-account **-compute@**.gserviceaccount.com keytmp.json --credential-file-override="C:\agent\_work\3\s\tempKeyFile.json""
created key [*] of type [json] as [keytmp.json] for [*-compute@*.gserviceaccount.com]

C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd" auth activate-service-account --key-file=keytmp.json --credential-file-override="C:\agent\_work\3\s\tempKeyFile.json""
Activated service account credentials for: [*-compute@*.gserviceaccount.com]
--
"C:\Program Files\Docker\Docker\Resources\bin\docker.exe" push eu.gcr.io/*/*.api:latest
ERROR: (gcloud.auth.docker-helper) You do not currently have an active account selected.
Please run:
  $ gcloud auth login
to obtain new credentials, or if you have already logged in with a
different account:
  $ gcloud config set account ACCOUNT
to select an already authenticated account to use.
The push refers to repository [eu.gcr.io/**/**.api]
a8ab8bff4d74: Preparing
0d0fb6754078: Preparing
55f6c628a3d5: Preparing
fca06706d90a: Preparing
cd7100a72410: Preparing
unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
ERROR: (gcloud.auth.docker-helper) You do not currently have an active account selected.
Please run:
$ gcloud auth login
to obtain new credentials, or if you have already logged in with a
different account:
$ gcloud config set account ACCOUNT
to select an already authenticated account to use.
C:\Program Files\Docker\Docker\Resources\bin\docker.exe failed with return code: 1

What I'm missing?

from google-cloud-tfs.

Formator avatar Formator commented on August 18, 2024

Hi

I have finally solved the issue. I have just used JSON key file as docker login options.

Here is complete solution for TFS side:

1. Add new Service Endpoint: Docker Registry

  • Registry type: Other
  • Docker Registry: https://[gcr.io, us.gcr.io, eu.gcr.io, or asia.gcr.io]
  • Docker ID: _json_key
  • Password: [Copy-Paste content from exported service account JSON key file]

2. Edit your Build Definitions

3. Edit your Docker Compose tasks

  • Container Registry Type: Container Registry
  • Docker Registry Connection: [Select Docker Registry endpoint that you have add earlier]

I hope that this will help someone with the same problem that I had!

from google-cloud-tfs.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.