Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] DRONE_COMMIT_SHA IS NULL, docker build error? #238

Closed
lework opened this issue Jul 2, 2019 · 2 comments
Closed

[BUG] DRONE_COMMIT_SHA IS NULL, docker build error? #238

lework opened this issue Jul 2, 2019 · 2 comments

Comments

@lework
Copy link

lework commented Jul 2, 2019

When the build image is executed when the tag event occurs, the following error will occur.

pipeline

- name: build-prod-image
  image: plugins/docker
  settings:
    dockerfile: ./Dockerfile
    storage_path: /drone/src/docker
    repo: 192.168.77.134:5000/root/demo
    registry: 192.168.77.134:5000
    insecure: true
    tags: ${DRONE_TAG}
  when:
    event:
    - tag

Error that occurred

+ /usr/local/bin/docker build --rm=true -f ./Dockerfile -t . --pull=true --label org.label-schema.schema-version=1.0 --label org.label-schema.build-date=2019-07-02T08:40:14Z --label org.label-schema.vcs-ref= --label org.label-schema.vcs-url=http://192.168.77.134:3000/root/demo.git
--
70 | WARNING: bridge-nf-call-iptables is disabled
71 | WARNING: bridge-nf-call-ip6tables is disabled
72 | invalid argument "" for "-t, --tag" flag: invalid reference format
73 | See 'docker build --help'.
74 | time="2019-07-02T08:40:14Z" level=fatal msg="exit status 125"

The default value of docker build tag is commit.sha, However, but when the tag event, commit.sha is none

Name: c.String("commit.sha"),

@lework
Copy link
Author

lework commented Jul 2, 2019

- name: build-prod-image
  image: plugins/docker
  commands: 
  - "--commit.sha 123"
  settings:
    dockerfile: ./Dockerfile
    storage_path: /drone/src/docker
    repo: 192.168.77.134:5000/root/demo
    registry: 192.168.77.134:5000
    insecure: true
    tags: ${DRONE_TAG}
  environment:
    DRONE_COMMIT_SHA: tag0000
  when:
    event:
    - tag

it's not work.

@bradrydzewski
Copy link
Member

This is a problem with gogs/gitea not providing the commit sha in the tag webhook. It needs to be resolved upstream in gogs/gitea and is not explicitly a Drone bug. See existing issue #229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants