drone / drone-runtime

[DEPRECATED] migrated to https://github.com/drone-runners
Other
62 stars 43 forks source link

emulate 0.8 networking and bridge network #81

Closed bradrydzewski closed 5 years ago

bradrydzewski commented 5 years ago

0.8 had an implementation flaw where it attached containers to both the user-defined network (created for each pipeline) and the bridge network. In 1.0 we fixed this and removed the bridge network. There are some pipelines that relied on the pipeline being attached to both networks, which caused issues when porting to 1.0

I believe there are few possible solutions to this issue:

  1. support network_mode: bridge for the pipeline step (and while we are at it, we can add host networking and container:<id> networking as well
  2. attach all containers to both bridge and the user-defined network
  3. attach all containers to both bridge and the user-defined network only when feature flag is enabled

I am partial to option number 1 because we should expose this flag in the yaml anyway, for more comprehensive docker support. I am not a huge fan of option 2 because in some cases, attaching to both network (especially on kubernetes) can cause issues.

cc @jimsheldon this should be a simple fix either way. I will proceed with number 1 since we should support it regardless. Lets touch based Monday to make sure this is an acceptable option.

bradrydzewski commented 5 years ago

@jimsheldon I pushed a new minor version of the CLI with the new network_mode field. I converted the yaml you provided to the 1.0 format using drone convert, added network_mode, and executed the pipeline and it was success 🎉

kind: pipeline
name: default

steps:
  - name: integration
    pull: if-not-exists
    image: duffqiu/dind
+   network_mode: bridge