diff --git a/.aspect/workflows/BUILD.bazel b/.aspect/workflows/BUILD.bazel new file mode 100644 index 0000000..61fa702 --- /dev/null +++ b/.aspect/workflows/BUILD.bazel @@ -0,0 +1,13 @@ +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") + +exports_files(["config.yaml"]) + +bzl_library( + name = "deps", + srcs = ["deps.bzl"], + visibility = ["//visibility:public"], + deps = [ + "@bazel_tools//tools/build_defs/repo:http.bzl", + "@bazel_tools//tools/build_defs/repo:utils.bzl", + ], +) diff --git a/.aspect/workflows/deps.bzl b/.aspect/workflows/deps.bzl new file mode 100644 index 0000000..740555f --- /dev/null +++ b/.aspect/workflows/deps.bzl @@ -0,0 +1,48 @@ +"""Bazel dependencies for Aspect Workflows""" + +load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive", _http_file = "http_file") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +# TODO: move this to a rule set so repositories on Aspect Workflows can avoid this boilerplate +rosetta_version = "5.9.0-rc.15" +rosetta_integrity = { + "darwin_aarch64": "sha256-qBvrzIuFu1yc/fQRGX0xEESPB9F3CnNvcN3vbh7n36A=", + "darwin_x86_64": "sha256-WBKYuUhNgYJ5hKWK0jqkehTTKjkTA/4J1wHXs451zzY=", + "linux_aarch64": "sha256-hR4C3gLa668zQingdchz0uB5g4kaIYCYiklQVqHWbPE=", + "linux_x86_64": "sha256-xynht34OBsMCQT6/KsNCePxppCFZEYGrMkQ9fsapfdg=", +} + +# https://github.com/suzuki-shunsuke/circleci-config-merge/releases +# https://dev.to/suzukishunsuke/splitting-circleci-config-yml-10gk +circleci_config_merge_version = "1.1.6" +circleci_config_merge_integrity = { + "darwin_aarch64": "sha256-7cQeLrSVRZR+mQu/njn+x//EIb2bhTV2+J8fafRHpr4=", + "darwin_x86_64": "sha256-vHKDSdDaYK58MaudJ9yOPRKh+OT/LiTQV/9E07RL8qA=", + "linux_aarch64": "sha256-MaXVQmRK9q9LgsfM5ZzxCIIT8rUcOBbzJ8aVDgK6zWs=", + "linux_x86_64": "sha256-3eYJn7dShZD1oiS3cgXfqXwdDzclf/N97A2nh7ZfW+w=", +} + +def http_archive(name, **kwargs): + maybe(_http_archive, name = name, **kwargs) + +def http_file(name, **kwargs): + maybe(_http_file, name = name, **kwargs) + +# buildifier: disable=function-docstring +def fetch_workflows_deps(): + for platform_arch in rosetta_integrity.keys(): + http_file( + name = "rosetta_{}".format(platform_arch), + downloaded_file_path = "rosetta", + executable = True, + integrity = rosetta_integrity[platform_arch], + urls = ["https://static.aspect.build/aspect/{0}/rosetta_real_{1}".format(rosetta_version, platform_arch.replace("aarch64", "arm64"))], + ) + + for platform_arch in circleci_config_merge_integrity.keys(): + http_archive( + name = "circleci_config_merge_{}".format(platform_arch), + build_file_content = "exports_files([\"circleci-config-merge\"])", + integrity = circleci_config_merge_integrity[platform_arch], + urls = ["https://github.com/suzuki-shunsuke/circleci-config-merge/releases/download/v{0}/circleci-config-merge_{0}_{1}.tar.gz".format(circleci_config_merge_version, platform_arch.replace("aarch64", "arm64").replace("x86_64", "amd64"))], + ) diff --git a/.aspect/workflows/terraform/workflows.tf b/.aspect/workflows/terraform/workflows.tf index c29aa7f..cec87ce 100644 --- a/.aspect/workflows/terraform/workflows.tf +++ b/.aspect/workflows/terraform/workflows.tf @@ -16,7 +16,7 @@ module "aspect_workflows" { region = local.region # Aspect Workflows terraform module - source = "https://s3.us-east-2.amazonaws.com/static.aspect.build/aspect/5.9.0-rc.10/workflows-gcp/terraform-gcp-aspect-workflows.zip" + source = "https://s3.us-east-2.amazonaws.com/static.aspect.build/aspect/5.9.0-rc.15/workflows-gcp/terraform-gcp-aspect-workflows.zip" # Network properties network = google_compute_network.workflows_network.id diff --git a/.circleci/BUILD.bazel b/.circleci/BUILD.bazel new file mode 100644 index 0000000..ca7d1ed --- /dev/null +++ b/.circleci/BUILD.bazel @@ -0,0 +1,50 @@ +load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_file") + +CIRCLECI_ORG = "aspect-build" + +CIRCLECI_USER_CONFIG_FILE = "//.circleci:user-config.yml" + +alias( + name = "rosetta", + actual = select({ + "@bazel_tools//src/conditions:darwin_arm64": "@rosetta_darwin_aarch64//file:rosetta", + "@bazel_tools//src/conditions:darwin_x86_64": "@rosetta_darwin_x86_64//file:rosetta", + "@bazel_tools//src/conditions:linux_aarch64": "@rosetta_linux_aarch64//file:rosetta", + "@bazel_tools//src/conditions:linux_x86_64": "@rosetta_linux_x86_64//file:rosetta", + }), +) + +alias( + name = "circleci-config-merge", + actual = select({ + "@bazel_tools//src/conditions:darwin_arm64": "@circleci_config_merge_darwin_aarch64//:circleci-config-merge", + "@bazel_tools//src/conditions:darwin_x86_64": "@circleci_config_merge_darwin_x86_64//:circleci-config-merge", + "@bazel_tools//src/conditions:linux_aarch64": "@circleci_config_merge_linux_aarch64//:circleci-config-merge", + "@bazel_tools//src/conditions:linux_x86_64": "@circleci_config_merge_linux_x86_64//:circleci-config-merge", + }), +) + +genrule( + name = "aspect_workflows_config", + srcs = ["//.aspect/workflows:config.yaml"], + outs = [":aspect-workflows-config.yml"], + cmd = "CIRCLE_PROJECT_USERNAME={0} $(execpath :rosetta) steps --configuration .aspect/workflows/config.yaml --host circleci > $@".format(CIRCLECI_ORG), + tools = [":rosetta"], +) + +genrule( + name = "merge_config", + srcs = [ + ":aspect-workflows-config.yml", + CIRCLECI_USER_CONFIG_FILE, + ], + outs = [":_config.yml"], + cmd = "echo -e '# GENERATED FILE - DO NOT EDIT!\\n# Update with: bazel run //.circleci:write_merged_config' > $@ && $(execpath :circleci-config-merge) merge $(execpath :aspect-workflows-config.yml) $(execpath {0}) >> $@".format(CIRCLECI_USER_CONFIG_FILE), + tools = [":circleci-config-merge"], +) + +write_source_file( + name = "write_merged_config", + in_file = ":_config.yml", + out_file = "config.yml", +) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7a8dbae..f537599 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,46 +1,765 @@ +# GENERATED FILE - DO NOT EDIT! +# Update with: bazel run //.circleci:write_merged_config version: 2.1 - -parameters: - perform_delivery: - type: boolean - default: false - delivery_commit: - type: string - default: "" - description: The commit to checkout and run the delivery from - delivery_targets: - type: string - default: "" - description: Ignore the target(s) that are listed in the delivery manifest - and instead deliver these targets. Comma-separated list of labels. - -# enable CircleCI's dynamic configuration feature -setup: true - -orbs: - slack: circleci/slack@4.12.5 - aspect-workflows: aspect-build/workflows@dev:5.9.0-rc.10 - -jobs: - legacy: - docker: - - image: cimg/base:2023.03 - steps: - - run: echo "No-op step since CCI requires one step for the job to be valid" - - when: - condition: - and: - - not: - equal: [scheduled_pipeline, << pipeline.trigger_source >>] - steps: - - checkout - - run: echo "This is an example of legacy non-workflows job" - workflows: - default-workflow: + aspect-workflows: jobs: - - legacy - - aspect-workflows/setup: - resource_class: aspect-build/bazel-lib-nano - context: - - slack + - aw-auto-deliver: + context: [] + filters: + branches: + only: + - main + - aspect-build/test-delivery + requires: + - aw-root_workspace_test + - aw-buildifier: + context: [] + workspace: . + - aw-configure: + context: [] + workspace: . + - aw-format: + context: [] + workspace: . + - aw-gazelle: + context: [] + workspace: . + - aw-root_workspace_test: + context: [] + workspace: . + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - scheduled_pipeline + - << pipeline.trigger_source >> + aspect-workflows-e2e-copy_to_directory: + jobs: + - aw-test: + context: [] + delivery_manifest: false + workspace: e2e/copy_to_directory + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - scheduled_pipeline + - << pipeline.trigger_source >> + aspect-workflows-e2e-coreutils: + jobs: + - aw-test: + context: [] + delivery_manifest: false + workspace: e2e/coreutils + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - scheduled_pipeline + - << pipeline.trigger_source >> + aspect-workflows-e2e-external_copy_to_directory: + jobs: + - aw-test: + context: [] + delivery_manifest: false + workspace: e2e/external_copy_to_directory + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - scheduled_pipeline + - << pipeline.trigger_source >> + aspect-workflows-e2e-smoke: + jobs: + - aw-test: + context: [] + delivery_manifest: false + workspace: e2e/smoke + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - scheduled_pipeline + - << pipeline.trigger_source >> + aspect-workflows-manual-deliver: + jobs: + - aw-manual-deliver: + context: [] + when: + equal: + - true + - << pipeline.parameters.perform_delivery >> + aspect-workflows-warming: + jobs: + - aw-warming: {} + when: + and: + - equal: + - scheduled_pipeline + - << pipeline.trigger_source >> + - equal: + - aspect-workflows-warming + - << pipeline.schedule.name >> + user-workflow: + jobs: + - user-job + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - << pipeline.trigger_source >> + - scheduled_pipeline +jobs: + aw-auto-deliver: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + resource_class: aspect-build/bazel-lib + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: git fetch + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Git fetch + - when: + condition: << pipeline.parameters.delivery_commit >> + steps: + - run: + command: git checkout << pipeline.parameters.delivery_commit >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Checkout release commit + - run: + command: rosetta run delivery + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Delivery + no_output_timeout: 180m + working_directory: /mnt/ephemeral/workdir + aw-buildifier: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + parameters: + delivery_manifest: + default: true + type: boolean + workspace: + type: string + resource_class: aspect-build/bazel-lib-small + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: rm -rf /some/path/artifacts /some/path/testlogs + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Prepare archive directories + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run branch_freshness + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Branch Freshness + no_output_timeout: 180m + - run: + command: rosetta run buildifier --workspace << parameters.workspace >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Buildifier + no_output_timeout: 180m + - store_artifacts: + path: /some/path/artifacts + - run: + command: rosetta run finalization + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Finalization + no_output_timeout: 10m + when: always + working_directory: /mnt/ephemeral/workdir + aw-configure: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + parameters: + delivery_manifest: + default: true + type: boolean + workspace: + type: string + resource_class: aspect-build/bazel-lib-small + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: rm -rf /some/path/artifacts /some/path/testlogs + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Prepare archive directories + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run branch_freshness + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Branch Freshness + no_output_timeout: 180m + - run: + command: rosetta run configure --workspace << parameters.workspace >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure + no_output_timeout: 180m + - store_artifacts: + path: /some/path/artifacts + - run: + command: rosetta run finalization + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Finalization + no_output_timeout: 10m + when: always + working_directory: /mnt/ephemeral/workdir + aw-format: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + parameters: + delivery_manifest: + default: true + type: boolean + workspace: + type: string + resource_class: aspect-build/bazel-lib-small + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: rm -rf /some/path/artifacts /some/path/testlogs + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Prepare archive directories + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run branch_freshness + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Branch Freshness + no_output_timeout: 180m + - run: + command: rosetta run format --workspace << parameters.workspace >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Format + no_output_timeout: 180m + - store_artifacts: + path: /some/path/artifacts + - run: + command: rosetta run finalization + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Finalization + no_output_timeout: 10m + when: always + working_directory: /mnt/ephemeral/workdir + aw-gazelle: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + parameters: + delivery_manifest: + default: true + type: boolean + workspace: + type: string + resource_class: aspect-build/bazel-lib-small + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: rm -rf /some/path/artifacts /some/path/testlogs + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Prepare archive directories + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run branch_freshness + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Branch Freshness + no_output_timeout: 180m + - run: + command: rosetta run gazelle --workspace << parameters.workspace >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Gazelle + no_output_timeout: 180m + - store_artifacts: + path: /some/path/artifacts + - run: + command: rosetta run finalization + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Finalization + no_output_timeout: 10m + when: always + working_directory: /mnt/ephemeral/workdir + aw-manual-deliver: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + DELIVERY_TARGETS: << pipeline.parameters.delivery_targets >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + resource_class: aspect-build/bazel-lib + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: git fetch + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Git fetch + - when: + condition: << pipeline.parameters.delivery_commit >> + steps: + - run: + command: git checkout << pipeline.parameters.delivery_commit >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Checkout release commit + - run: + command: rosetta run delivery + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + DELIVERY_COMMIT: << pipeline.parameters.delivery_commit >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Delivery + no_output_timeout: 180m + working_directory: /mnt/ephemeral/workdir + aw-root_workspace_test: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + parameters: + delivery_manifest: + default: true + type: boolean + workspace: + type: string + resource_class: aspect-build/bazel-lib + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: rm -rf /some/path/artifacts /some/path/testlogs + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Prepare archive directories + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run branch_freshness + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Branch Freshness + no_output_timeout: 180m + - run: + command: rosetta run test --workspace << parameters.workspace >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Test + no_output_timeout: 180m + - store_test_results: + path: /some/path/testlogs + - when: + condition: + and: + - <> + - or: + - equal: + - main + - << pipeline.git.branch >> + - equal: + - aspect-build/test-delivery + - << pipeline.git.branch >> + steps: + - run: + command: rosetta run delivery_manifest --workspace << parameters.workspace + >> --data TARGETS_SOURCE=test + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Delivery Manifest + no_output_timeout: 180m + - store_artifacts: + path: /some/path/testlogs + - store_artifacts: + path: /some/path/artifacts + - run: + command: rosetta run finalization + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Finalization + no_output_timeout: 10m + when: always + working_directory: /mnt/ephemeral/workdir + aw-test: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + ASPECT_WORKFLOWS_WORKSPACE: << parameters.workspace >> + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + parameters: + delivery_manifest: + default: true + type: boolean + workspace: + type: string + resource_class: aspect-build/bazel-lib-small + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: rm -rf /some/path/artifacts /some/path/testlogs + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Prepare archive directories + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run branch_freshness + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Branch Freshness + no_output_timeout: 180m + - run: + command: rosetta run test --workspace << parameters.workspace >> + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Test + no_output_timeout: 180m + - store_test_results: + path: /some/path/testlogs + - when: + condition: + and: + - <> + - or: + - equal: + - main + - << pipeline.git.branch >> + - equal: + - aspect-build/test-delivery + - << pipeline.git.branch >> + steps: + - run: + command: rosetta run delivery_manifest --workspace << parameters.workspace + >> --data TARGETS_SOURCE=test + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Delivery Manifest + no_output_timeout: 180m + - store_artifacts: + path: /some/path/testlogs + - store_artifacts: + path: /some/path/artifacts + - run: + command: rosetta run finalization + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Finalization + no_output_timeout: 10m + when: always + working_directory: /mnt/ephemeral/workdir + aw-warming: + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + XDG_CACHE_HOME: /mnt/ephemeral/caches + machine: true + resource_class: aspect-build/bazel-lib-small-warming + steps: + - run: + command: /etc/aspect/workflows/bin/configure_workflows_env + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Configure Workflows + - checkout + - run: + command: /etc/aspect/workflows/bin/agent_health_check + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Agent health checks + no_output_timeout: 180m + - run: + command: rosetta run warming --workspace e2e/external_copy_to_directory + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Create warming archive for e2e/external_copy_to_directory + no_output_timeout: 180m + - run: + command: rosetta run warming --workspace e2e/copy_to_directory + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Create warming archive for e2e/copy_to_directory + no_output_timeout: 180m + - run: + command: rosetta run warming --workspace e2e/coreutils + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Create warming archive for e2e/coreutils + no_output_timeout: 180m + - run: + command: rosetta run warming --workspace e2e/smoke + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Create warming archive for e2e/smoke + no_output_timeout: 180m + - run: + command: rosetta run warming --workspace . + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Create warming archive for root + no_output_timeout: 180m + - run: + command: /etc/aspect/workflows/bin/warming_archive + environment: + ASPECT_WORKFLOWS_CONFIG: .aspect/workflows/config.yaml + CC: /bin/false + XDG_CACHE_HOME: /mnt/ephemeral/caches + name: Archive warming tars + working_directory: /mnt/ephemeral/workdir + user-job: + docker: + - image: cimg/base:2023.03 + steps: + - checkout + - run: echo "Example user CircleCI job that is not generated by Aspect Workflows." +parameters: + delivery_commit: + default: "" + description: The commit to checkout and run the delivery from. Targets listed + in the delivery manifest for this commit will be delivered unless specific targets + are listed in `delivery_targets`. + type: string + delivery_targets: + default: "" + description: List of Bazel targets to deliver, delimited by spaces. For example, + `//app/a:push_release //app/b:push_release`. If empty, targets listed in the + delivery manifest for the target commit will be delivered. + type: string + perform_delivery: + default: false + type: boolean diff --git a/.circleci/user-config.yml b/.circleci/user-config.yml new file mode 100644 index 0000000..f9cf524 --- /dev/null +++ b/.circleci/user-config.yml @@ -0,0 +1,54 @@ +# This is an example of a user CircleCI configuration that is not generated by +# Aspect Workflows. The naming of this file is arbitrary. This configuration is +# merged with the generated Aspect Workflows CircleCI configuration into the +# load bearing load `.circleci/config.yaml` configuration file that is used by +# CircleCI. +# +# To update `.circleci/config.yaml` after editing this file run: +# +# bazel run //.circleci:write_merged_config +# +# +# Aspect Workflows workflow names are all prefixed with "aspect-workflows-". +# These currently include: +# +# - aspect-workflows +# - aspect-workflows-warming +# - aspect-workflows-manual-deliver +# +# Aspect Workflows job names are all prefixed with "aw-". These currently +# include. +# +# - aw-auto-deliver +# - aw-buildifier +# - aw-configure +# - aw-format +# - aw-gazelle +# - aw-manual-deliver +# - aw-test +# - aw-warming +# +# In your user CircleCI configuration, avoid workflow names prefixed with +# `aspect-workflows-` and job names prefixed with `aw-`. Conflicting workflow or +# job names will result in a bad configuration merge. +version: 2.1 + +jobs: + user-job: + docker: + - image: cimg/base:2023.03 + steps: + - checkout + - run: echo "Example user CircleCI job that is not generated by Aspect Workflows." + +workflows: + user-workflow: + jobs: + - user-job + when: + and: + - not: << pipeline.parameters.perform_delivery >> + - not: + equal: + - << pipeline.trigger_source >> + - scheduled_pipeline diff --git a/.prettierignore b/.prettierignore index 2603494..968b258 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ +.circleci/config.yml docs/*.md e2e/*/docs.md lib/tests/jq/*.json diff --git a/WORKSPACE b/WORKSPACE index 399377e..7a51d40 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -81,3 +81,7 @@ load( fetch_shfmt() fetch_terraform() + +load("//.aspect/workflows:deps.bzl", "fetch_workflows_deps") + +fetch_workflows_deps()