Skip to content

Update Web IDE config to accept ports

What does this MR do?

In order to implement https://gitlab.com/gitlab-org/gitlab-ee/issues/5276 we need several modifications on the Web ide configuration. We need to accept a ports section in both the main image section and in each service one.

In this MR we update the configuration and also modify other parts to include it.

This is an example of the new ports options in .gitlab-webide.yml:

terminal:
  image: 
    name: alpine:3.9
    ports:
      - 80
  services:
    - name: tomcat
      alias: tomcat
      ports:
        - external_port: 8080      
          protocol: http
    - name: tomcat
      alias: tomcat2
      ports:
        - external_port: 8080
          internal_port: 80
          name: main_port
        - external_port: 8081
          name: secondary_port
    - name: tomcat
      alias: tomcat3
      ports:
        - [8080, 80]

The ports configuration can accept different options:

  • Only one port. In this option the internal_port is the same as the external_port.
  ports:
    - 80
  • An array of two values. In this option the first value is the external port and the second one the internal.
  ports:
    - [80, 81]
  • A hash. The accepts the keys: external_port, internal_port, protocol and name.

    • If no internal_port is set, the value of external_port will be used
  ports:
    - external_port: 8080
      internal_port: 8081
      protocol: http
      name: port_name
  • By default all services are protocol=http

  • Inside the same service, you can't have different ports pointing to the same external or internal port.

  • Each internal_port must be unique within the configuration

  • If there is more than one service you are forced to set a port name.

  • If only one port is set, default_port will be used as the port name

  • When the proxy endpoint is requested you can use either the number or the name version of the port

What are the relevant issue numbers?

Refs https://gitlab.com/gitlab-org/gitlab-ee/issues/5276 and closes https://gitlab.com/gitlab-org/gitlab-ee/issues/10179

Does this MR meet the acceptance criteria?

Merge request reports