0

I'm trying to build and push image with drone.io's plugins/docker, but it seems cannot find my repo name.

Here is the last log about the build step.

---> Running in afca20280587
Removing intermediate container afca20280587
---> cb05c781a4c4
Successfully built cb05c781a4c4
Successfully tagged caa418f0605dc7a6b2bc84faebabac55a09a373b:latest
+ /usr/local/bin/docker tag caa418f0605dc7a6b2bc84faebabac55a09a373b :latest
Error parsing reference: ":latest" is not a valid   repository/tag: invalid reference format
time="2019-01-02T02:05:18Z" level=fatal msg="exit status 1"

The sixth line should be

+ /usr/local/bin/docker tag caa418f0605dc7a6b2bc84faebabac55a09a373b registry.cn-beijing.aliyuncs.com/xxx/xxx_xxx:latest

But now it didn't find my repo name.

It's drone/drone:1.0.0-rc.3, and here is my .drone.yml

kind: pipeline
name: default

steps:
- name: build
  image: python:3.6
  commands:
  - pip install -r requirements.txt
  - python -m pytest app.py
  when:
    branch: master
    event:
    - push
    - pull_request

- name: publish
  image: plugins/docker
  registry: registry.cn-beijing.aliyuncs.com
  repo: xxx/xxx_xxx
  tags: [ latest ]
  username: 
  - from_secret: ali_username
  password:
  - from_secret: ali_password

Is there something wrong? Thanks for any tip!

Woko
  • 1,521
  • 12
  • 16

1 Answers1

0

When you define the repository you need to use the fully qualified image name:

- repo: xxx/xxx_xxx
+ repo: registry.cn-beijing.aliyuncs.com/xxx/xxx_xxx

In addition, all of the plugin settings need to be declared inside the settings block [1] like this:

- name: publish
  image: plugins/docker
  settings:
    registry: registry.cn-beijing.aliyuncs.com
    repo: registry.cn-beijing.aliyuncs.com/xxx/xxx_xxx
    username: 
    - from_secret: ali_username
    password:
    - from_secret: ali_password

[1] http://plugins.drone.io/drone-plugins/drone-docker/

Brad Rydzewski
  • 2,523
  • 14
  • 18