fix: commit generated go-bindata files with "--no-compress" option (#1088)

* fix: go mod would not copy the non-go files by default
so do go-bindata here will help projects which vendored aks-engine.
and add no-compress option to go-bindata, so we will not need to rebase it everytime.

* chore: add make ensure-generated to CI, and docs

* chore: \t removal

* fix: regenerate the go file so make it up-to-date.

* fix: the *_generated.go is checked in as source code now.

* fix: re-regerate it so the files up-to-date.
This commit is contained in:
Liming Liu 2019-05-14 02:25:41 +08:00 коммит произвёл Azure Kubernetes Service Bot
Родитель fa37a95bf4
Коммит 39c2a4fd89
8 изменённых файлов: 27481 добавлений и 5 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -19,8 +19,6 @@ test/junit/
test/aks-engine-test/aks-engine-test.exe
pkg/operations/junit.xml
pkg/operations/kubernetesupgrade/junit.xml
pkg/engine/templates_generated.go
pkg/i18n/translations_generated.go
pkg/engine/templates.go
pkg/i18n/translations.go

Просмотреть файл

@ -55,6 +55,9 @@ jobs:
- script: make generate test-style
displayName: Run linting rules
workingDirectory: $(modulePath)
- script: make ensure-generated
displayName: Check if generated code is up to date
workingDirectory: $(modulePath)
- script: make build-cross
displayName: Build cross-architectural binaries
workingDirectory: $(modulePath)

Просмотреть файл

@ -127,7 +127,7 @@ build-container:
.PHONY: clean
clean:
@rm -rf $(BINDIR) ./_dist ./pkg/helpers/unit_tests ./pkg/**/*_generated.go
@rm -rf $(BINDIR) ./_dist ./pkg/helpers/unit_tests
GIT_BASEDIR = $(shell git rev-parse --show-toplevel 2>/dev/null)
ifneq ($(GIT_BASEDIR),)

Просмотреть файл

@ -323,3 +323,18 @@ The following steps constitute the AKS Engine CI pipeline:
1. The PR is code reviewed by the members of AKS Engine team
1. Once the PR is approved and the end-to-end job has passed, the PR can now be merged into the master branch
1. Once merged, another job is triggered to verify integrity of the master branch. This job is similar to the PR job.
## Pull Requests and Generated Code
To make it easier use AKS Engine as a library and to `go get github.com/Azure/aks-engine`, some
generated Go code is committed to the repository. Your pull request may need to regenerate those
files before it will pass the required `make ensure-generated` step.
Always run `make build` before you submit a pull request to validate compilation and
generated code hygiene. Run `make ensure-generated` yourself to validate that things check out. If there are
discrepencies, `make ensure-generated` will output a brief error report.
### What is generated?
- Changes under the `parts/` folder require the `pkg/engine/templates_generated.go` file to be updated.
- Changes under `pkg/i8n/translations` require the `pkg/engine/translations_generated.go` file to be updated.

Просмотреть файл

@ -3,7 +3,7 @@
package engine
//go:generate go-bindata -nometadata -pkg $GOPACKAGE -prefix ../../parts/ -o templates_generated.go ../../parts/...
//go:generate go-bindata -nometadata -nocompress -pkg $GOPACKAGE -prefix ../../parts/ -o templates_generated.go ../../parts/...
//go:generate gofmt -s -l -w templates_generated.go
// fileloader use go-bindata (https://github.com/go-bindata/go-bindata)
// go-bindata is the way we handle embedded files, like binary, template, etc.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -3,7 +3,7 @@
package i18n
//go:generate go-bindata -nometadata -pkg $GOPACKAGE -prefix ../../ -o translations_generated.go ../../translations/...
//go:generate go-bindata -nometadata -nocompress -pkg $GOPACKAGE -prefix ../../ -o translations_generated.go ../../translations/...
//go:generate gofmt -s -l -w translations_generated.go
// resourceloader use go-bindata (https://github.com/go-bindata/go-bindata)
// go-bindata is the way we handle embedded files, like binary, template, etc.

Различия файлов скрыты, потому что одна или несколько строк слишком длинны