[1.0.0-rc1] How to pull image from private registry and execute commands in it


#1

Hello!

In drone 0.8.X i was able to pull some image and run commands in it. Like this:

pipeline:
  build:
    image: gcr.io/my-project-001/sbt:latest
    commands:
      - env | sort
    when:
      event: [push, pull_request, tag]

It just needed to have registry credentials added per repo.

How can it be achieved with 1.0.0?
https://docs.drone.io/config/pipeline/steps/ states that:

If the image is private you will need to configure registry credentials.

But how?
Tried to add:

  settings:
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password

and different variations of it to no avail.

Thanks a bunch in advance!


#2

I’m running into the same problem, but as a service which relies on kubernetes-secrets. My env vars are populated, the settings stanza doesn’t affect my pull tho.

kind: pipeline
name: default
steps:
  - name: test
    image: clojure
    pull: always
    commands:
      - env
      - ./scripts/test.sh
    environment:
      LEIN_USERNAME:
        from_secret: aws_key_id
      LEIN_PASSPHRASE:
        from_secret: aws_secret

services:
  - name: redis
    image: quay.io/ORG/redis:3.0
    pull: always
    settings:
      username:
        from_secret: ORG_user
      password:
        from_secret: ORG_password
---
kind: secret

external_data:
  aws_key_id:
    path: drone-ORG
    name: aws_key_id_prod
  aws_secret:
    path: drone-ORG
    name: aws_secret_prod
  ORG_user:
    path: drone-ORG
    name: ORG_user
  ORG_password:
    path: drone-ORG
    name: ORG_password

#3

With 0.8 i was able to solve my issues by just viewing code. Like with autoscaler params. But it isn’t available yet, too ;(