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

pkg/asset/targets: Render the metadata asset before cluster #1199

Merged
merged 1 commit into from
Feb 6, 2019

Conversation

wking
Copy link
Member

@wking wking commented Feb 6, 2019

Otherwise Terraform failures will lead to exits without metadata.json, which makes it harder for users to reap any resources from the possibly-partially-created cluster. Before this commit:

$ git diff -U1 | cat
diff --git a/pkg/terraform/terraform.go b/pkg/terraform/terraform.go
index f566d34..bad05e5 100644
--- a/pkg/terraform/terraform.go
+++ b/pkg/terraform/terraform.go
@@ -53,2 +53,3 @@ func Apply(dir string, platform string, extraArgs ...string) (path string, err e

+				return sf, errors.New("faking a Terraform failure")
 				if exitCode := texec.Apply(dir, args, lpDebug, lpError); exitCode != 0 {
$ hack/build.sh
$ openshift-install --dir=wking create cluster
INFO Consuming "Install Config" from target directory
INFO Creating cluster...
ERROR Failed to read tfstate: open /tmp/openshift-install-655768368/terraform.tfstate: no such file or directory
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: faking a Terraform failure
$ ls wking
auth  terraform.tfvars  tls

With this commit, we get metadata.json too. Fixes a bug introduced by the re-order in 75ab106 (#890, v0.12.0).

Otherwise Terraform failures will lead to exits without metadata.json,
which makes it harder for users to reap any resources from the
possibly-partially-created cluster.  Before this commit:

  $ git diff -U1 | cat
  diff --git a/pkg/terraform/terraform.go b/pkg/terraform/terraform.go
  index f566d34..bad05e5 100644
  --- a/pkg/terraform/terraform.go
  +++ b/pkg/terraform/terraform.go
  @@ -53,2 +53,3 @@ func Apply(dir string, platform string, extraArgs ...string) (path string, err e

  +				return sf, errors.New("faking a Terraform failure")
   				if exitCode := texec.Apply(dir, args, lpDebug, lpError); exitCode != 0 {
  $ hack/build.sh
  $ openshift-install --dir=wking create cluster
  INFO Consuming "Install Config" from target directory
  INFO Creating cluster...
  ERROR Failed to read tfstate: open /tmp/openshift-install-655768368/terraform.tfstate: no such file or directory
  FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: faking a Terraform failure
  $ ls wking
  auth  terraform.tfvars  tls

With this commit, we get metadata.json too.  Fixes a bug introduced by
the re-order in 75ab106 (assets: add tests for validating asset
fetching of targets, 2018-12-12, openshift#890, v0.12.0).
@openshift-ci-robot openshift-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 6, 2019
@wking wking added the kind/bug Categorizes issue or PR as related to a bug. label Feb 6, 2019
@crawford
Copy link
Contributor

crawford commented Feb 6, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crawford, wking

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

@wking: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-openstack e4dfd2d link /test e2e-openstack
ci/prow/e2e-aws e4dfd2d link /test e2e-aws
ci/prow/launch-aws e4dfd2d link /test launch-aws
ci/prow/e2e-libvirt e4dfd2d link /test e2e-libvirt

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@crawford
Copy link
Contributor

crawford commented Feb 6, 2019

This is currently killing us in CI. This is an extremely simple change and has already been tested (this was the order we previously used). I am going to force this through CI. Have mercy on my soul.

/override ci/prow/e2e-aws
/override ci/prow/launch-aws

@smarterclayton
Copy link
Contributor

I force merged

@wking wking deleted the terraform-error-metadata branch February 6, 2019 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants