rayitopy
rayitopy

Reputation: 111

How to pull private images from GCR in drone?

I have been looking in how to pull private images and I found this.

I'm trying to use the drone cli to it but when i use this command

drone registry add \
  --repository octocat/hello-world \
  --hostname gcr.io \
  --username _json_key \
  --password @/absolute/path/to/keyfile.json

It returns me a error: Client error: 404

Any help?

Upvotes: 0

Views: 588

Answers (2)

sandino
sandino

Reputation: 3842

I little late here, but for me, this worked (and my help others coming in the future):

drone exec --trusted --secret-file=secrets.txt --event=push .drone.yaml

With the --trusted I was able to download private images, that required authentication, that is passed (in my case was Google Images) using the secrets.txt file.

In drone.yaml:

    pull: if-not-exists
    image: eu.gcr.io/private-org/private-repo/latest
    environment:
        GITHUB_TOKEN:
            from_secret: GITHUB_TOKEN

The secrets.txt file contains just (a valid) GitHub token:

GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Upvotes: 0

Oliver
Oliver

Reputation: 13011

When you add a custom registry, the repo needs to exist at the time of running drone registry add.

You can run drone repo ls (show all repos) or drone repo info octocat/hello-world to confirm your repo exists.

Upvotes: 2

Related Questions