Skip to content

Commit 8f8f22d

Browse files
author
Noah Meyerhans
committed
Fix goswagger network timeouts during client generation
The goswagger API client generator tries to access github.com repeatedly when running. We're running with no network at all, so these requests are currently timing out. (Why aren't they getting ENETUNREACH or similar?) This change adds an entry to /etc/hosts in the container where we run goswagger to point github.com at localhost, which results in a fast failure and significantly reduces the time needed to generate the API client code. Signed-off-by: Noah Meyerhans <[email protected]>
1 parent c49a624 commit 8f8f22d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

swagger.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
// --skip-validation is used in the command-lines below to remove the network dependency that the swagger generator has
1717
// in attempting to validate that the email address specified in the yaml file is valid.
1818

19-
//go:generate docker run --rm --net=none -v $PWD:/work -w /work quay.io/goswagger/swagger generate model -f ./client/swagger.yaml -T ./templates --model-package=client/models --client-package=client --copyright-file=COPYRIGHT_HEADER --skip-validation
20-
//go:generate docker run --rm --net=none -v $PWD:/work -w /work quay.io/goswagger/swagger generate client -f ./client/swagger.yaml -T ./templates --model-package=client/models --client-package=client --copyright-file=COPYRIGHT_HEADER --skip-validation
21-
//go:generate docker run --rm --net=none -v $PWD:/work -w /work quay.io/goswagger/swagger generate client -f ./client/swagger.yaml -C ./go_swagger_layout.yaml -T ./templates --model-package=client/models --client-package=fctesting --copyright-file=COPYRIGHT_HEADER --skip-validation
19+
//go:generate docker run --add-host github.com:127.1.1.1 --rm --net=none -v $PWD:/work -w /work quay.io/goswagger/swagger generate model -f ./client/swagger.yaml -T ./templates --model-package=client/models --client-package=client --copyright-file=COPYRIGHT_HEADER --skip-validation
20+
//go:generate docker run --add-host github.com:127.1.1.1 --rm --net=none -v $PWD:/work -w /work quay.io/goswagger/swagger generate client -f ./client/swagger.yaml -T ./templates --model-package=client/models --client-package=client --copyright-file=COPYRIGHT_HEADER --skip-validation
21+
//go:generate docker run --add-host github.com:127.1.1.1 --rm --net=none -v $PWD:/work -w /work quay.io/goswagger/swagger generate client -f ./client/swagger.yaml -C ./go_swagger_layout.yaml -T ./templates --model-package=client/models --client-package=fctesting --copyright-file=COPYRIGHT_HEADER --skip-validation
2222

2323
package firecracker

0 commit comments

Comments
 (0)