Skip to content

Commit

Permalink
Fix goswagger network timeouts during client generation
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Noah Meyerhans committed Jun 20, 2019
1 parent c49a624 commit 8f8f22d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// --skip-validation is used in the command-lines below to remove the network dependency that the swagger generator has
// in attempting to validate that the email address specified in the yaml file is valid.

//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
//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
//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
//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
//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
//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

package firecracker

0 comments on commit 8f8f22d

Please sign in to comment.