EngFlow public examples
This repository contains examples in various languages that demonstrate how to build and test software with the EngFlow Remote Execution service.
Prerequisites
-
//python: Bazel needs to install the dependencies listed inpython/requirements.txt. To make this repository work across platforms, we do not check in a lock file. Execute the following commands to generate the lock file before building and testing:# https://stackoverflow.com/a/73720550 git update-index --skip-worktree python/requirements_lock.txt bazel run //python:requirements.update -
//swift: Requires theclangcompiler. Make sure the binary is in yourPATH.//swiftalso does not yet build remotely on platforms other than macOS, due to lack of support in rules_swift.The implementation of
swift_autoconfigurationas of v1.18.0 does not yet use the BazeltoolchainAPI. Instead, it selects the platform based on theos.nameJava system property, and on Linux, expectsswiftcto exist on the system already:Other language rule sets contain logic to download the appropriate language SDK on demand.
The following issues track the eventual addition of
toolchainsupport and automatic SDK downloads on Linux (both opened 2018-06-06):
Local execution
Make sure that you can build and run the tests in the language of your choice locally before attempting remote execution.
Building locally
-
cpp,csharp,docker,genrules,go,java,kotlin,perl,python,scala, andtypescript:bazel build //${DIRECTORY}/...Build them all with:
-
swift:# --config=clang isn't required on macOS bazel build --config=clang //swift:tests
Testing locally
-
java,python,scala, andtypescript:bazel test //${DIRECTORY}/...
Test them all with:
-
swift:# --config=clang isn't required on macOS bazel test --config=clang //swift:tests
Remote execution
Make sure to include --remote_executor and --bes_backend, in the engflow
configuration of your .bazelrc.user file, as well as access credentials if
needed. For instance:
# Incorporate configurations from .bazelrc, which imports this file. # # - Depending on your cluster configuration, replace remote_linux_64 with # remote_macos_x64 or remote_windows_x64. build:engflow --config=engflow_common build:engflow --config=remote_linux_x64 # Configuration for your trial cluster build:engflow --remote_executor=grpcs://${CLUSTER_ENDPOINT}/ build:engflow --bes_backend=grpcs://${CLUSTER_ENDPOINT}/ build:engflow --bes_results_url=https://${CLUSTER_ENDPOINT}/invocation/ build:engflow --nogoogle_default_credentials build:engflow --bes_lifecycle_events # Configuration for your mTLS certificates (if required); otherwise ignore # these lines and use the auth helper configuration below. build:engflow --tls_client_certificate=/path/to/credentials/cert.crt build:engflow --tls_client_key=/path/to/credentials/cert.key # Configuration for your EngFlow auth helper (if required); otherwise ignore # this line and use the mTLS configuration above. build:engflow --credential_helper=${CLUSTER_ENDPOINT}=/path/to/engflow_auth # This ensures _all_ build and test runs will be remote. Comment this out # when building locally. build --config=engflow
Building on remote
Add --config=engflow to the following commands if build --config=engflow
isn't enabled in your .bazelrc.user file.
-
cpp,csharp,docker,genrules,go,java,kotlin,perl,python,scala, ortypescript:bazel build //${DIRECTORY}/...Build them all with:
-
swift:bazel build //swift:tests
Testing on remote
-
java,python,scala, andtypescript:bazel test //${DIRECTORY}/...
Test them all with:
-
swift:
engflowapis execution
A detailed example of EngFlow APIs consumption is presented in
java/com/engflow/notificationqueue.