diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d7eb00dea6..73c27af0562 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ on: debug_enabled: description: 'To run with tmate enter "debug_enabled"' required: false - default: "false" + default: "" permissions: contents: read # to fetch code (actions/checkout) @@ -34,7 +34,7 @@ jobs: name: Create matrix id: platforms run: | - echo matrix=$(docker buildx bake binary-cross --print | jq -cr '.target."binary-cross".platforms') >> $GITHUB_OUTPUT + echo ::set-output name=matrix::'["linux/amd64"]' - name: Show matrix run: | @@ -49,7 +49,6 @@ jobs: - lint - validate-go-mod - validate-headers - - validate-docs steps: - name: Checkout diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000000..2f796628513 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1 @@ +image: gitpod/workspace-full:2024-04-16-12-16-24 diff --git a/.golangci.yml b/.golangci.yml index 090e12151d8..152ef291b65 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -66,7 +66,7 @@ linters-settings: - unnamedResult - whyNoLint gocyclo: - min-complexity: 16 + min-complexity: 18 lll: line-length: 200 issues: diff --git a/go.mod b/go.mod index 3ef547e14d4..82de72d0a30 100644 --- a/go.mod +++ b/go.mod @@ -61,6 +61,8 @@ require ( tags.cncf.io/container-device-interface v1.0.0 ) +require github.com/vishvananda/netlink v1.3.1-0.20240922070040-084abd93d350 + require ( dario.cat/mergo v1.0.1 // indirect github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect @@ -168,6 +170,7 @@ require ( github.com/tonistiigi/go-csvvalue v0.0.0-20240710180619-ddb21b71c0b4 // indirect github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab // indirect + github.com/vishvananda/netns v0.0.5 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect @@ -205,3 +208,12 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) + +replace ( + // Override for e2e tests + github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7 + + // v1.2.1-beta.2 is the latest version, override to use v1.1.0 to avoid beta + // https://github.com/vishvananda/netlink/compare/v1.1.0...v1.2.1-beta.2 + github.com/vishvananda/netlink => github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 +) diff --git a/go.sum b/go.sum index 702a28a7262..3d45002d657 100644 --- a/go.sum +++ b/go.sum @@ -486,6 +486,11 @@ github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab h1:H6aJ0yKQ0gF49Q github.com/tonistiigi/vt100 v0.0.0-20240514184818-90bafcd6abab/go.mod h1:ulncasL3N9uLrVann0m+CDlJKWsIAP34MPcOJF6VRvc= github.com/vbatts/tar-split v0.11.6 h1:4SjTW5+PU11n6fZenf2IPoV8/tz3AaYHMWjf23envGs= github.com/vbatts/tar-split v0.11.6/go.mod h1:dqKNtesIOr2j2Qv3W/cHjnvk9I8+G7oAkFDFN6TCBEI= +github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5 h1:+UB2BJA852UkGH42H+Oee69djmxS3ANzl2b/JtT1YiA= +github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= +github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY= +github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -587,6 +592,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/pkg/compose/create.go b/pkg/compose/create.go index ddd4898cbd8..cacd2faf6de 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -48,6 +48,7 @@ import ( "github.com/docker/docker/errdefs" "github.com/docker/go-connections/nat" "github.com/sirupsen/logrus" + "github.com/vishvananda/netlink" cdi "tags.cncf.io/container-device-interface/pkg/parser" ) @@ -1349,6 +1350,24 @@ func (s *composeService) resolveOrCreateNetwork(ctx context.Context, project *ty createOpts.IPAM.Config = append(createOpts.IPAM.Config, config) } + // override MTU value and set custom MTU one. + // This is required for gitpod.io due to the veth change + // https://github.com/gitpod-io/gitpod/pull/8955 + if createOpts.Options == nil { + createOpts.Options = make(map[string]string) + } + // override MTU value and set custom MTU one. + // This is required for gitpod.io due to the veth change + // https://github.com/gitpod-io/gitpod/pull/8955 + if createOpts.Options == nil { + createOpts.Options = make(map[string]string) + } + + netIface, err := netlink.LinkByName("ceth0") + if err == nil { + createOpts.Options["com.docker.network.driver.mtu"] = fmt.Sprintf("%v", netIface.Attrs().MTU) + } + networkEventName := fmt.Sprintf("Network %s", n.Name) w := progress.ContextWriter(ctx) w.Event(progress.CreatingEvent(networkEventName))