rancher / community-catalog

Catalog entries contributed by the community
385 stars 641 forks source link

Setup docker agent version to 1.24 #775

Closed clayrisser closed 4 years ago

clayrisser commented 6 years ago

This fixes issue #774

rawmind0 commented 6 years ago

Hi @codejamninja , thanks for this PR.

This issue is related to https://github.com/drone/drone/issues/2048 . This issue just happens if you are using docker server 1.12 or below, due to it don't let newer clients to connect. Using DOCKER_API_VERSION env variable at drone agent image, make docker client to downgrade to corresponding api version.

Hardcoding and forcing the api client downgrade is not a good solution:

I propose you to add an enum question at rancher-compose.yml file like,

+    - variable: docker_version
+      label: Docker Version
+      description: |
+        Docker version used. Downgrade docker client at drone agent if needed. 
+        Just needed if you are using Docker version 1.13.0 or below "
+      type: enum
+      default: ""
+      required: false
+      options:
+        - 1.13.0
+        - 1.12.x
+        - 1.11.x
+        - 1.10.x
+        - 1.9.x

Then at docker-compose.yml.tpl file set a question to add DOCKER_API_VERSION env var with proper value from api versioning, if needed.

  agent:
    image: drone/agent:${drone_version}
    environment:
      DRONE_SERVER: ${drone_server}
      DRONE_SECRET: ${drone_secret}
+  {{- if ne .Values.docker_version ""}}
+    {{- if eq ..Values.docker_version "1.13.0" }}
+      DOCKER_API_VERSION: 1.25
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.12.x" }}
+      DOCKER_API_VERSION: 1.24
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.11.x" }}
+      DOCKER_API_VERSION: 1.23
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.10.x" }}
+      DOCKER_API_VERSION: 1.22
+    {{- end}}
+    {{- if eq ..Values.docker_version "1.9.x" }}
+      DOCKER_API_VERSION: 1.21
+    {{- end}}
+  {{- end}}

What do you think??

cjellick commented 4 years ago

Closing this due to staleness. Feel free to reopen or open a new PR if there's still a relevant change to be made. Thanks!