Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider make target not exiting immediately or exiting 0 on fatal build error #20317

Open
wyardley opened this issue Nov 13, 2024 · 0 comments · May be fixed by GoogleCloudPlatform/magic-modules#12314

Comments

@wyardley
Copy link

What kind of contribution is this issue about?

Other (specify in details)

Details

Given a missing template, or a fatal code error in the go template (should be pretty simple to induce / reproduce this just by updating a file path to an invalid path, or making the code within it fail):

% make provider VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=artifactregistry
F1112 21:55:58.344058   52355 examples.go:300] open templates/terraform/custom_import/artifact_registry_remote_repository.go.tmpl: no such file or directory

or

F1112 21:56:23.593920   52532 examples.go:300] template: artifact_registry_repository.go.tmpl:12: function "project" not defined

the exit status 1 is reported to the terminal, however, the process continues (seemingly trying to generate the beta provider after the failure?), and amidst all the output, it's very easy to miss it.

2024/11/12 21:56:23 Generating MM output to '/Users/xxxx/go/src/github.com/hashicorp/terraform-provider-google'
2024/11/12 21:56:23 Using ga version
2024/11/12 21:56:23 Using  provider
[...]
exit status 1
2024/11/12 21:56:24 Generating MM output to '/Users/wby/go/src/github.com/hashicorp/terraform-provider-google'
2024/11/12 21:56:24 Using beta version
2024/11/12 21:56:24 Using  provider
[...]
2024/11/12 21:56:24 Copying common files for Terraform
2024/11/12 21:56:24 Fixing go import paths
make tpgtools
make serialize
[...]
E1112 21:56:27.849494   52613 resource.go:864] skipping "beta_basic.tf.tmpl" due to no version match
E1112 21:56:27.890417   52613 resource.go:864] skipping "storage_release.tf.tmpl" due to no version match
% echo $?
0

Assuming it's Ok to force SHELL to bash, this can be relatively easily fixed (I think) by setting SHELL=/bin/bash -eo pipefail in the GNUMakefile, however, I don't know if there are specific make targets or CI jobs this might break.

References

No response

@wyardley wyardley changed the title Fatal error not failing provider generation Provider make target not exiting immediately or exiting non-0 on fatal build error Nov 13, 2024
wyardley added a commit to wyardley/magic-modules that referenced this issue Nov 13, 2024
@wyardley wyardley changed the title Provider make target not exiting immediately or exiting non-0 on fatal build error Provider make target not exiting immediately or exiting 0 on fatal build error Nov 13, 2024
wyardley added a commit to wyardley/magic-modules that referenced this issue Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant