-
Notifications
You must be signed in to change notification settings - Fork 300
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
Adding an initial bazel configuration #3141
base: main
Are you sure you want to change the base?
Changes from all commits
4986260
aa910d2
1e30ed4
69c6179
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
USE_BAZEL_VERSION=7.4.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
load("@gazelle//:def.bzl", "gazelle") | ||
load("@rules_go//go:def.bzl", "go_binary", "go_library") | ||
|
||
# gazelle:prefix github.com/buildkite/agent/v3 | ||
gazelle(name = "gazelle") | ||
|
||
gazelle( | ||
name = "gazelle-update-repos", | ||
args = [ | ||
"-from_file=go.mod", | ||
"-to_macro=deps.bzl%go_dependencies", | ||
"-prune", | ||
], | ||
command = "update-repos", | ||
) | ||
|
||
go_binary( | ||
name = "agent", | ||
embed = [":agent_lib"], | ||
pure = "on", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_library( | ||
name = "agent_lib", | ||
srcs = ["main.go"], | ||
importpath = "github.com/buildkite/agent/v3", | ||
visibility = ["//visibility:private"], | ||
deps = [ | ||
"//clicommand", | ||
"//version", | ||
"@com_github_urfave_cli//:cli", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bazel_dep(name = "gazelle", version = "0.40.0") | ||
bazel_dep(name = "rules_go", version = "0.50.1") | ||
|
||
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") | ||
go_sdk.download(version = "1.22.7") | ||
|
||
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") | ||
go_deps.from_file(go_mod = "//:go.mod") | ||
|
||
# All *direct* dependencies are required to be listed explicitly | ||
use_repo(go_deps, "com_github_aws_aws_sdk_go", "com_github_aws_aws_sdk_go_v2", "com_github_aws_aws_sdk_go_v2_config", "com_github_aws_aws_sdk_go_v2_feature_ec2_imds", "com_github_aws_aws_sdk_go_v2_service_kms", "com_github_azure_azure_sdk_for_go_sdk_azidentity", "com_github_azure_azure_sdk_for_go_sdk_storage_azblob", "com_github_brunoscheufler_aws_ecs_metadata_go", "com_github_buildkite_bintest_v3", "com_github_buildkite_go_pipeline", "com_github_buildkite_interpolate", "com_github_buildkite_roko", "com_github_buildkite_shellwords", "com_github_creack_pty", "com_github_datadog_datadog_go_v5", "com_github_denisbrodbeck_machineid", "com_github_dustin_go_humanize", "com_github_dustinkirkland_golang_petname", "com_github_gliderlabs_ssh", "com_github_go_chi_chi_v5", "com_github_gofrs_flock", "com_github_google_go_cmp", "com_github_google_go_querystring", "com_github_gowebpki_jcs", "com_github_khan_genqlient", "com_github_lestrrat_go_jwx_v2", "com_github_mattn_go_zglob", "com_github_oleiade_reflections", "com_github_opentracing_opentracing_go", "com_github_pborman_uuid", "com_github_puzpuzpuz_xsync_v2", "com_github_qri_io_jsonschema", "com_github_stretchr_testify", "com_github_urfave_cli", "com_google_cloud_go_compute_metadata", "dev_drjosh_zzglob", "in_gopkg_datadog_dd_trace_go_v1", "in_gopkg_yaml_v3", "io_opentelemetry_go_contrib_propagators_aws", "io_opentelemetry_go_contrib_propagators_b3", "io_opentelemetry_go_contrib_propagators_jaeger", "io_opentelemetry_go_contrib_propagators_ot", "io_opentelemetry_go_otel", "io_opentelemetry_go_otel_exporters_otlp_otlptrace", "io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracegrpc", "io_opentelemetry_go_otel_sdk", "io_opentelemetry_go_otel_trace", "org_golang_google_api", "org_golang_x_crypto", "org_golang_x_exp", "org_golang_x_net", "org_golang_x_oauth2", "org_golang_x_sys", "org_golang_x_term", "tools_gotest_v3") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this generated? Seems like a thing that ought to be one per line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, very much generated! This was all via |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load("//:deps.bzl", "go_dependencies") | ||
|
||
# gazelle:repository_macro deps.bzl%go_dependencies | ||
go_dependencies() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
load("@rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "agent", | ||
srcs = [ | ||
"agent_configuration.go", | ||
"agent_pool.go", | ||
"agent_worker.go", | ||
"api.go", | ||
"doc.go", | ||
"ec2_meta_data.go", | ||
"ec2_tags.go", | ||
"ecs_meta_data.go", | ||
"gcp_labels.go", | ||
"gcp_meta_data.go", | ||
"header_times_streamer.go", | ||
"job_runner.go", | ||
"k8s_tags.go", | ||
"log_streamer.go", | ||
"pipeline_uploader.go", | ||
"run_job.go", | ||
"tags.go", | ||
"verify_job.go", | ||
], | ||
importpath = "github.com/buildkite/agent/v3/agent", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//api", | ||
"//core", | ||
"//env", | ||
"//internal/agenthttp", | ||
"//internal/awslib", | ||
"//internal/experiments", | ||
"//internal/job/hook", | ||
"//internal/shell", | ||
"//kubernetes", | ||
"//logger", | ||
"//metrics", | ||
"//process", | ||
"//status", | ||
"@com_github_aws_aws_sdk_go//aws", | ||
"@com_github_aws_aws_sdk_go//aws/ec2metadata", | ||
"@com_github_aws_aws_sdk_go//service/ec2", | ||
"@com_github_brunoscheufler_aws_ecs_metadata_go//:aws-ecs-metadata-go", | ||
"@com_github_buildkite_go_pipeline//:go-pipeline", | ||
"@com_github_buildkite_go_pipeline//signature", | ||
"@com_github_buildkite_roko//:roko", | ||
"@com_github_buildkite_shellwords//:shellwords", | ||
"@com_github_denisbrodbeck_machineid//:machineid", | ||
"@com_github_dustin_go_humanize//:go-humanize", | ||
"@com_github_gowebpki_jcs//:jcs", | ||
"@com_google_cloud_go_compute_metadata//:metadata", | ||
"@org_golang_google_api//compute/v1:compute", | ||
"@org_golang_x_oauth2//google", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "agent_test", | ||
srcs = [ | ||
"agent_worker_test.go", | ||
"ec2_meta_data_test.go", | ||
"gcp_meta_data_test.go", | ||
"job_runner_test.go", | ||
"k8s_tags_test.go", | ||
"log_streamer_test.go", | ||
"pipeline_uploader_test.go", | ||
"tags_test.go", | ||
], | ||
embed = [":agent"], | ||
deps = [ | ||
"//api", | ||
"//core", | ||
"//logger", | ||
"@com_github_buildkite_go_pipeline//:go-pipeline", | ||
"@com_github_google_go_cmp//cmp", | ||
"@com_github_stretchr_testify//assert", | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
load("@rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "integration", | ||
srcs = ["test_helpers.go"], | ||
importpath = "github.com/buildkite/agent/v3/agent/integration", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//agent", | ||
"//api", | ||
"//logger", | ||
"//metrics", | ||
"@com_github_buildkite_bintest_v3//:bintest", | ||
"@com_github_lestrrat_go_jwx_v2//jwk", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "integration_test", | ||
srcs = [ | ||
"config_allowlisting_integration_test.go", | ||
"job_environment_integration_test.go", | ||
"job_runner_integration_test.go", | ||
"job_verification_integration_test.go", | ||
"main_test.go", | ||
], | ||
embed = [":integration"], | ||
deps = [ | ||
"//agent", | ||
"//api", | ||
"//clicommand", | ||
"//version", | ||
"@com_github_buildkite_bintest_v3//:bintest", | ||
"@com_github_buildkite_go_pipeline//:go-pipeline", | ||
"@com_github_buildkite_go_pipeline//signature", | ||
"@com_github_lestrrat_go_jwx_v2//jwk", | ||
"@com_github_urfave_cli//:cli", | ||
"@tools_gotest_v3//assert", | ||
], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to name the resulting binary
buildkite-agent
with this!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, that's an easy update