Skip to content

Commit

Permalink
Do not attach service to ingress network
Browse files Browse the repository at this point in the history
This fixes the following API error:

    400 Client Error
    Service cannot be explicitly attached to the ingress network "ingress"

Forwarding the entire networks list from the master container to
`client.services.create` results in `docker.errors.APIError`, when the
list of networks includes the `ingress` network.
  • Loading branch information
cjolowicz committed Apr 3, 2019
1 parent e6e6693 commit 5d85132
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 0.1.3 - 2019-04-03
### Fixed
- Fix Docker API error due to explicitly attaching service to ingress network.

## 0.1.2 - 2019-03-31
### Fixed
- CI: Do not reject jobs for tagged commits.
Expand Down
6 changes: 5 additions & 1 deletion src/buildbot_docker_swarm_worker/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ def get_current_container():
def get_container_networks():
container = get_current_container()
if container:
return list(container.attrs["NetworkSettings"]["Networks"])
return [
network
for network in container.attrs["NetworkSettings"]["Networks"]
if network != "ingress"
]

def aslist(env):
return list("=".join(item) for item in env.items())
Expand Down

0 comments on commit 5d85132

Please sign in to comment.