Skip to content
This repository was archived by the owner on Feb 5, 2020. It is now read-only.

Simplified Bazel build#3142

Merged
alexsomesan merged 2 commits intocoreos:masterfrom
alexsomesan:bazel-streamline
Apr 23, 2018
Merged

Simplified Bazel build#3142
alexsomesan merged 2 commits intocoreos:masterfrom
alexsomesan:bazel-streamline

Conversation

@alexsomesan
Copy link
Contributor

@alexsomesan alexsomesan commented Mar 28, 2018

This change proposed a simplified build flow based on the current Bazel logic.
Notable changes introduced:

  • Build only one platform a time. This implies releasing distinct tarballs for distinct architectures.
  • Use Bazel datafiles syntax instead of genrule with shell-script to copy static resources.
  • Remove the generated examples and replace with static cluster yaml examples.
  • Remove some unnecessary rules and dependencies
  • The release version is sourced from the version.bzl file which can be manipulated by RA.

Outstanding issues to be resolved:

  • drop the terraform binary next to the installer in the local dev build (the tarball already has it).
  • adapt documentation to explain the recommended developer workflow.

@coreosbot
Copy link

Can one of the admins verify this patch?

BUILD.bazel Outdated
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
template_files = glob([
"modules/**/*",
"platforms/**/*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platforms folder does not exist anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I'm going to remove it here too. Thanks!

commit = "361556b0d27318d1b8fa42c91a4baa4ab5ea1c58"
)

# http_archive(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's mentioned in the comment above. It's because we need a change from bazel-contrib/rules_go#1393 which is not yet released. Once a release is cut, we can revert back to http_archive retrieval. That's why I kept it commented.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once a release is cut, we can revert back to http_archive retrieval.

I've filed openshift/installer#28 with a stab at this.

"//:linux": ["@terraform_runtime_linux//:terraform"],
"//:darwin": ["@terraform_runtime_darwin//:terraform"],
}),
outs = ["bin/terraform"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

terraform_fmt currently relies on this output so would need to be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'll put it back then 👍

BUILD.bazel Outdated
)
template_files = glob([
"modules/**/*",
"platforms/**/*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove platforms

visibility = ["//visibility:public"],
)

exports_files(example_cli_configs) No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it.

enxebre
enxebre previously approved these changes Apr 10, 2018
@enxebre
Copy link
Contributor

enxebre commented Apr 10, 2018

ok to test

enxebre
enxebre previously approved these changes Apr 10, 2018
@alexsomesan
Copy link
Contributor Author

retest this please

@enxebre
Copy link
Contributor

enxebre commented Apr 10, 2018

When running in mac ./tectonic-dev/installer/tectonic is dropped with no execution perms 644, shouldn't it be 555?
Also could we update the tarball name and the export binary path here https://github.com/coreos/tectonic-installer/blob/master/README.md#hacking?

Copy link
Contributor

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this PR change the tar ball layout? Can you update the Bazel README to reflect this? Also, one of @enxebre’s comments regarding globbing “platforms” should still be addressed I think

@alexsomesan alexsomesan force-pushed the bazel-streamline branch 2 times, most recently from f264b94 to 0f7b2c4 Compare April 17, 2018 18:04
@alexsomesan
Copy link
Contributor Author

@squat Got around to amending the README. PTAL.
Also, smokes should be green now. I'll squash before merging.

@alexsomesan
Copy link
Contributor Author

Good to review. PTAL

enxebre
enxebre previously approved these changes Apr 18, 2018
@enxebre
Copy link
Contributor

enxebre commented Apr 18, 2018

lgtm, we probably want to squash the commits

spangenberg
spangenberg previously approved these changes Apr 18, 2018
* only build one platform at a time
* copy templates + resources as runtime files on the cli target
* remove unused rules and dependencies
* source version for tarball from versions.bzl
* version the tarball
@alexsomesan alexsomesan dismissed stale reviews from spangenberg and enxebre via 282a3fb April 18, 2018 19:04
Copy link
Contributor

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One more piece of clean up we need to do is to remove the hand-tailored gazelle generated Bazel files in vendor. These had to be modified by hand to support declarative cross-compilation in Bazel but since we are no longer doing this and instead the tarballs only have binaries for a single platform, we can remove those changes. As it stands they will NOT be regenerated by gazelle because of the special directive in the files. We simple need to find ./installer/vendor/ -name *.BAZEL | xargs rm or the like and then re-run gazelle to regenerate. We can do this in a follow up

@squat
Copy link
Contributor

squat commented Apr 23, 2018

We need to ensure we coordinate with RA team so they are aware of the new release process requiring one tarball per platform per release

@alexsomesan
Copy link
Contributor Author

@squat I agree with both points!
Would you say INST-922 would be good opportunity to handle the vendor build files? I'm still hoping we can schedule that one soon, now that the installer backend code is gone too.

On the topic of integration with RA, I'd say the release process as we know it no longer applies at this time. We definitely have to convey these changes to RA nonetheless. Sudha wants to meet this week to discuss the path forward, so we'll touch on these changes and others within the installer.

@alexsomesan alexsomesan merged commit e22e31f into coreos:master Apr 23, 2018
@alexsomesan alexsomesan deleted the bazel-streamline branch April 23, 2018 12:50
wking added a commit to wking/openshift-installer that referenced this pull request Jul 20, 2018
Catching up with e22e31f (Simplified Bazel build, 2018-04-23,
coreos/tectonic-installer#3142).  Running 'bazel build tarball' on
master actually gets you a tectonic-dev.tar.gz with a root
tectonic-dev directory, but I've left that alone for now (maybe it
depends on environment variables like cutting releases?).  The tarball
I built also lacks the darwin/linux subdirectories:

  $ tree tectonic-dev/installer/
  tectonic-dev/installer/
  ├── tectonic
  └── terraform

But by stopping at the 'installer' directory I don't have to worry
about figuring out how cross-platform builds work now ;).
yifan-gu pushed a commit to yifan-gu/installer that referenced this pull request Jul 25, 2018
Catching up with e22e31f (Simplified Bazel build, 2018-04-23,
coreos/tectonic-installer#3142).  Running 'bazel build tarball' on
master actually gets you a tectonic-dev.tar.gz with a root
tectonic-dev directory, but I've left that alone for now (maybe it
depends on environment variables like cutting releases?).  The tarball
I built also lacks the darwin/linux subdirectories:

  $ tree tectonic-dev/installer/
  tectonic-dev/installer/
  ├── tectonic
  └── terraform

But by stopping at the 'installer' directory I don't have to worry
about figuring out how cross-platform builds work now ;).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants