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

Parameter add_host not work #318

Closed
quanbisen opened this issue Apr 4, 2021 · 3 comments
Closed

Parameter add_host not work #318

quanbisen opened this issue Apr 4, 2021 · 3 comments

Comments

@quanbisen
Copy link

quanbisen commented Apr 4, 2021

drone-server: v1.10.1
.drone.yml partial define:

...
- name: image
    image: plugins/docker
    settings:
      add_host:
        - harbor.edu.com:172.16.11.198
      repo: harbor.edu.com/library/fastdfs-test
      username: admin
      password: Harbor12345
      insecure: true
      registry: harbor.edu.com
      dockerfile: ./Dockerfile
      debug: true
      tags:
        - latest
        - master
...

build log out:

latest: Pulling from plugins/docker
--
2 | Digest: sha256:f4f27eae9b0bb6a0527cdea8176fdb78b1dcf4742b2f006e540e26234ff15af3
3 | Status: Image is up to date for plugins/docker:latest
4 | + /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry https://harbor.edu.com
5 | time="2021-04-04T12:54:54.266161570Z" level=info msg="Starting up"
6 | time="2021-04-04T12:54:54.276465408Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
7 | time="2021-04-04T12:54:54.279538978Z" level=info msg="libcontainerd: started new containerd process" pid=36
8 | time="2021-04-04T12:54:54.279713895Z" level=info msg="parsed scheme: \"unix\"" module=grpc
9 | time="2021-04-04T12:54:54.279731860Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
10 | time="2021-04-04T12:54:54.279764006Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
11 | time="2021-04-04T12:54:54.279786672Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
12 | time="2021-04-04T12:54:54.344457983Z" level=info msg="starting containerd" revision=7ad184331fa3e55e52b890ea95e65ba581ae3429 version=v1.2.13
13 | time="2021-04-04T12:54:54.346202802Z" level=info msg="loading plugin "io.containerd.content.v1.content"..." type=io.containerd.content.v1
14 | time="2021-04-04T12:54:54.346484414Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.btrfs"..." type=io.containerd.snapshotter.v1
15 | time="2021-04-04T12:54:54.346851314Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.btrfs" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
16 | time="2021-04-04T12:54:54.346873887Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.aufs"..." type=io.containerd.snapshotter.v1
17 | time="2021-04-04T12:54:54.368854582Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.aufs" error="modprobe aufs failed: "ip: can't find device 'aufs'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1"
18 | time="2021-04-04T12:54:54.368908806Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.native"..." type=io.containerd.snapshotter.v1
19 | time="2021-04-04T12:54:54.369218017Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.overlayfs"..." type=io.containerd.snapshotter.v1
20 | time="2021-04-04T12:54:54.370469602Z" level=info msg="loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1
21 | time="2021-04-04T12:54:54.371077206Z" level=info msg="skip loading plugin "io.containerd.snapshotter.v1.zfs"..." type=io.containerd.snapshotter.v1
22 | time="2021-04-04T12:54:54.371150346Z" level=info msg="loading plugin "io.containerd.metadata.v1.bolt"..." type=io.containerd.metadata.v1
23 | time="2021-04-04T12:54:54.371245959Z" level=warning msg="could not use snapshotter zfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin"
24 | time="2021-04-04T12:54:54.371269091Z" level=warning msg="could not use snapshotter btrfs in metadata plugin" error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs must be a btrfs filesystem to be used with the btrfs snapshotter"
25 | time="2021-04-04T12:54:54.371279041Z" level=warning msg="could not use snapshotter aufs in metadata plugin" error="modprobe aufs failed: "ip: can't find device 'aufs'\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n": exit status 1"
26 | time="2021-04-04T12:54:54.389027066Z" level=info msg="loading plugin "io.containerd.differ.v1.walking"..." type=io.containerd.differ.v1
27 | time="2021-04-04T12:54:54.389102011Z" level=info msg="loading plugin "io.containerd.gc.v1.scheduler"..." type=io.containerd.gc.v1
28 | time="2021-04-04T12:54:54.389249481Z" level=info msg="loading plugin "io.containerd.service.v1.containers-service"..." type=io.containerd.service.v1
29 | time="2021-04-04T12:54:54.389275352Z" level=info msg="loading plugin "io.containerd.service.v1.content-service"..." type=io.containerd.service.v1
30 | time="2021-04-04T12:54:54.389291629Z" level=info msg="loading plugin "io.containerd.service.v1.diff-service"..." type=io.containerd.service.v1
31 | time="2021-04-04T12:54:54.389308879Z" level=info msg="loading plugin "io.containerd.service.v1.images-service"..." type=io.containerd.service.v1
32 | time="2021-04-04T12:54:54.389382433Z" level=info msg="loading plugin "io.containerd.service.v1.leases-service"..." type=io.containerd.service.v1
33 | time="2021-04-04T12:54:54.389424682Z" level=info msg="loading plugin "io.containerd.service.v1.namespaces-service"..." type=io.containerd.service.v1
34 | time="2021-04-04T12:54:54.389440920Z" level=info msg="loading plugin "io.containerd.service.v1.snapshots-service"..." type=io.containerd.service.v1
35 | time="2021-04-04T12:54:54.389460655Z" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." type=io.containerd.runtime.v1
36 | time="2021-04-04T12:54:54.389975362Z" level=info msg="loading plugin "io.containerd.runtime.v2.task"..." type=io.containerd.runtime.v2
37 | time="2021-04-04T12:54:54.390341859Z" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." type=io.containerd.monitor.v1
38 | time="2021-04-04T12:54:54.391440729Z" level=info msg="loading plugin "io.containerd.service.v1.tasks-service"..." type=io.containerd.service.v1
39 | time="2021-04-04T12:54:54.391545290Z" level=info msg="loading plugin "io.containerd.internal.v1.restart"..." type=io.containerd.internal.v1
40 | time="2021-04-04T12:54:54.391715374Z" level=info msg="loading plugin "io.containerd.grpc.v1.containers"..." type=io.containerd.grpc.v1
41 | time="2021-04-04T12:54:54.391739504Z" level=info msg="loading plugin "io.containerd.grpc.v1.content"..." type=io.containerd.grpc.v1
42 | time="2021-04-04T12:54:54.391754443Z" level=info msg="loading plugin "io.containerd.grpc.v1.diff"..." type=io.containerd.grpc.v1
43 | time="2021-04-04T12:54:54.391768518Z" level=info msg="loading plugin "io.containerd.grpc.v1.events"..." type=io.containerd.grpc.v1
44 | time="2021-04-04T12:54:54.391781672Z" level=info msg="loading plugin "io.containerd.grpc.v1.healthcheck"..." type=io.containerd.grpc.v1
45 | time="2021-04-04T12:54:54.391796338Z" level=info msg="loading plugin "io.containerd.grpc.v1.images"..." type=io.containerd.grpc.v1
46 | time="2021-04-04T12:54:54.392132593Z" level=info msg="loading plugin "io.containerd.grpc.v1.leases"..." type=io.containerd.grpc.v1
47 | time="2021-04-04T12:54:54.392150388Z" level=info msg="loading plugin "io.containerd.grpc.v1.namespaces"..." type=io.containerd.grpc.v1
48 | time="2021-04-04T12:54:54.392164513Z" level=info msg="loading plugin "io.containerd.internal.v1.opt"..." type=io.containerd.internal.v1
49 | time="2021-04-04T12:54:54.392801100Z" level=info msg="loading plugin "io.containerd.grpc.v1.snapshots"..." type=io.containerd.grpc.v1
50 | time="2021-04-04T12:54:54.392837504Z" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." type=io.containerd.grpc.v1
51 | time="2021-04-04T12:54:54.392853253Z" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." type=io.containerd.grpc.v1
52 | time="2021-04-04T12:54:54.392878115Z" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." type=io.containerd.grpc.v1
53 | time="2021-04-04T12:54:54.393621518Z" level=info msg=serving... address="/var/run/docker/containerd/containerd-debug.sock"
54 | time="2021-04-04T12:54:54.393815532Z" level=info msg=serving... address="/var/run/docker/containerd/containerd.sock"
55 | time="2021-04-04T12:54:54.393846266Z" level=info msg="containerd successfully booted in 0.053599s"
56 | time="2021-04-04T12:54:54.407305387Z" level=warning msg="insecure registry https://harbor.edu.com should not contain 'https://' and 'https://' has been removed from the insecure registry config"
57 | time="2021-04-04T12:54:54.409565198Z" level=info msg="parsed scheme: \"unix\"" module=grpc
58 | time="2021-04-04T12:54:54.409596214Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
59 | time="2021-04-04T12:54:54.409629832Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
60 | time="2021-04-04T12:54:54.409645126Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
61 | time="2021-04-04T12:54:54.412373333Z" level=info msg="parsed scheme: \"unix\"" module=grpc
62 | time="2021-04-04T12:54:54.412427518Z" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
63 | time="2021-04-04T12:54:54.412462341Z" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0  <nil>}] <nil>}" module=grpc
64 | time="2021-04-04T12:54:54.412483465Z" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
65 | time="2021-04-04T12:54:54.554709257Z" level=info msg="Loading containers: start."
66 | time="2021-04-04T12:54:54.576621940Z" level=warning msg="Running modprobe bridge br_netfilter failed with message: ip: can't find device 'bridge'\nbridge                151336  1 br_netfilter\nstp                    12976  1 bridge\nllc                    14552  2 bridge,stp\nip: can't find device 'br_netfilter'\nbr_netfilter           22256  0 \nbridge                151336  1 br_netfilter\nmodprobe: can't change directory to '/lib/modules': No such file or directory\n, error: exit status 1"
67 | time="2021-04-04T12:54:54.742427611Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
68 | time="2021-04-04T12:54:54.827570915Z" level=info msg="Loading containers: done."
69 | time="2021-04-04T12:54:54.888040816Z" level=info msg="Docker daemon" commit=afacb8b7f0 graphdriver(s)=overlay2 version=19.03.8
70 | time="2021-04-04T12:54:54.888412299Z" level=info msg="Daemon has completed initialization"
71 | time="2021-04-04T12:54:54.968280939Z" level=info msg="API listen on /var/run/docker.sock"
72 | time="2021-04-04T12:54:55.589968561Z" level=info msg="Error logging in to v2 endpoint, trying next endpoint: Get https://harbor.edu.com/v2/: dial tcp: lookup harbor.edu.com on 127.0.0.11:53: no such host"
73 | time="2021-04-04T12:54:55.604956613Z" level=info msg="Error logging in to v2 endpoint, trying next endpoint: Get http://harbor.edu.com/v2/: dial tcp: lookup harbor.edu.com on 127.0.0.11:53: no such host"
74 | time="2021-04-04T12:54:55.605097486Z" level=error msg="Handler for POST /v1.40/auth returned error: Get http://harbor.edu.com/v2/: dial tcp: lookup harbor.edu.com on 127.0.0.11:53: no such host"
75 | time="2021-04-04T12:54:55Z" level=fatal msg="Error authenticating: exit status 1"

I can see error Error logging in to v2 endpoint, trying next endpoint: Get https://harbor.edu.com/v2/: dial tcp: lookup harbor.edu.com on 127.0.0.11:53: no such host, it seems add_host field not work. Is this a bug or just my yml file wrong?

@cookedsteak
Copy link

cookedsteak commented Apr 13, 2021

Here I got a similar issue.

.drone.yml

kind: pipeline
name: lala

steps:
  - name: docker
    debug: true
    image: plugins/docker
    add_host:
      - core.harbor.com:192.168.2.200
    settings:
      registry: core.harbor.com:30443
      repo: core.harbor.com:30443/test-ci/one
      use_cache: true
      insecure: true
    tags:
      - 0.1
    when:
      event: push
      branch: master

I set the host "core.harbor.com:192.168.2.200". My repository is public.
But when I check the log, the IP address is still the old one.

As the logs below

latest: Pulling from plugins/docker
--
2 | Digest: sha256:63866456570c8666b86d9f341ea35c71cc2f7e34117eb744f9d8a75f7b4793c8
3 | Status: Image is up to date for plugins/docker:latest
4 | + /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry core.harbor.com:30443
5 | Registry credentials or Docker config not provided. Guest mode enabled.
...

The push refers to repository [core.harbor.com:30443/test-ci/one]
--
193 | Get http://core.harbor.com:30443/v2/: dial tcp 58.33.37.25:30443: connect: connection refused
194 | time="2021-04-13T06:08:32Z" level=fatal msg="exit status 1"

@quanbisen
Copy link
Author

Here I got a similar issue.

.drone.yml

kind: pipeline
name: lala

steps:
  - name: docker
    debug: true
    image: plugins/docker
    add_host:
      - core.harbor.com:192.168.2.200
    settings:
      registry: core.harbor.com:30443
      repo: core.harbor.com:30443/test-ci/one
      use_cache: true
      insecure: true
    tags:
      - 0.1
    when:
      event: push
      branch: master

I set the host "core.harbor.com:192.168.2.200". My repository is public.
But when I check the log, the IP address is still the old one.

As the logs below

latest: Pulling from plugins/docker
--
2 | Digest: sha256:63866456570c8666b86d9f341ea35c71cc2f7e34117eb744f9d8a75f7b4793c8
3 | Status: Image is up to date for plugins/docker:latest
4 | + /usr/local/bin/dockerd --data-root /var/lib/docker --host=unix:///var/run/docker.sock --insecure-registry core.harbor.com:30443
5 | Registry credentials or Docker config not provided. Guest mode enabled.
...

The push refers to repository [core.harbor.com:30443/test-ci/one]
--
193 | Get http://core.harbor.com:30443/v2/: dial tcp 58.33.37.25:30443: connect: connection refused
194 | time="2021-04-13T06:08:32Z" level=fatal msg="exit status 1"

Oh, I think this maybe is a bug here.

@bradrydzewski
Copy link
Member

bradrydzewski commented Apr 24, 2021

@cookedsteak the yaml in the above example is invalid. The add_host should be a child of settings. If you continue experiencing issues, please open a thread at discourse.drone.io for end-user support.

  - name: docker
    debug: true
    image: plugins/docker
-   add_host:
-     - core.harbor.com:192.168.2.200
    settings:
      registry: core.harbor.com:30443
      repo: core.harbor.com:30443/test-ci/one
      use_cache: true
      insecure: true
+     add_host:
+       - core.harbor.com:192.168.2.200

@drone-plugins drone-plugins locked and limited conversation to collaborators Apr 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants