Skip to content

Commit

Permalink
ci: complete component ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Jan 9, 2024
1 parent a3bb491 commit 7ed9544
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 7 deletions.
30 changes: 23 additions & 7 deletions ci/core/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
#@ "component_src_resource_name",
#@ "core_bundle_src_resource",
#@ "buck_test_name",
#@ "buck_test_name",
#@ "buck_test",
#@ "component_bats_tests_name",
#@ "component_bats_tests",
#@ "bump_image_in_chart_name",
#@ "bump_image_in_chart",
#@ "on_nix_host",
#@ "core_bundle_components",
#@ "edge_image_resource_name",
Expand Down Expand Up @@ -48,11 +51,17 @@ groups:
- name: #@ component
jobs:
- #@ buck_test_name(component)
- #@ component_bats_tests_name(component)
- #@ build_edge_image_name(component)
- #@ bump_image_in_chart_name(component)
#@ end

jobs:
#@ for component in components:
- #@ buck_test(component)
- #@ component_bats_tests(component)
- #@ build_edge_image(component)
- #@ bump_image_in_chart(component)
#@ end

- #@ buck_test("api")
Expand Down Expand Up @@ -194,10 +203,9 @@ jobs:
- get: #@ component_src_resource_name("api")
trigger: true
passed:
- #@ build_edge_image_name("api")
- #@ build_edge_image_name("api-migrate")
- #@ build_edge_image_name("api-ws-server")
- #@ build_edge_image_name("api-trigger")
#@ for component in ["api", "api-migrate", "api-ws-server", "api-trigger"]:
- #@ build_edge_image_name(component)
#@ end
- get: pipeline-tasks
#@ for component in ["api", "api-migrate", "api-ws-server", "api-trigger"]:
- get: #@ edge_image_resource_name(component)
Expand Down Expand Up @@ -257,12 +265,13 @@ jobs:
rebase: true

resources:
- #@ core_bundle_src_resource()

#@ for component in components:
- #@ component_src_resource(component)
- #@ component_edge_image(component)
#@ end

- #@ core_bundle_src_resource()

- name: repo-out
type: git
source:
Expand Down Expand Up @@ -315,6 +324,13 @@ resources:
branch: #@ data.values.git_charts_branch
private_key: #@ data.values.github_private_key

- name: charts-repo-out
type: git
source:
uri: #@ data.values.git_charts_uri
branch: "image-bump-bot-branch"
private_key: #@ data.values.github_private_key

- name: charts-repo-bot-branch
type: git
source:
Expand Down
88 changes: 88 additions & 0 deletions ci/core/template.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,91 @@ plan:
path: pipeline-tasks/ci/apps/tasks/buck-task.sh
#@ end

#@ def component_bats_tests_name(component):
#@ return component + "-bats-tests"
#@ end

#@ def component_bats_tests(component):
#@ return on_nix_host(component_bats_tests_name(component), component, "bats --setup-suite-file bats/ci_setup_suite.bash -t bats/core/" + component)
#@ end

#@ def bump_image_in_chart_name(component):
#@ return "bump-" + component + "-in-chart"
#@ end

#@ def bump_image_in_chart(component):
#@ component_lookup = {
#@ "api-keys": {
#@ "YAML_PATH": ".galoy.images.apiKeys.digest",
#@ "CHART": "galoy"
#@ }
#@ }
name: #@ bump_image_in_chart_name(component)
serial: true
plan:
- in_parallel:
- get: #@ component_src_resource_name(component)
trigger: true
passed:
- #@ build_edge_image_name(component)
- #@ buck_test_name(component)
- #@ component_bats_tests_name(component)
- get: #@ edge_image_resource_name(component)
passed:
- #@ build_edge_image_name(component)
params: { skip_download: true }
- get: charts-repo
params:
branch: #@ data.values.git_charts_branch
- get: pipeline-tasks
- task: bump-image-digest-in-values
config:
platform: linux
image_resource: #@ task_image_config()
inputs:
- name: #@ component_src_resource_name(component)
path: repo
- name: #@ edge_image_resource_name(component)
path: edge-image
- name: charts-repo
- name: pipeline-tasks
outputs:
- name: charts-repo
params:
BRANCH: #@ data.values.git_charts_branch
COMPONENT: #@ component
YAML_PATH: #@ component_lookup[component]["YAML_PATH"]
CHART: #@ component_lookup[component]["CHART"]
run:
path: pipeline-tasks/ci/core/tasks/bump-image-digest.sh
- put: charts-repo-out
params:
repository: charts-repo
force: true
branch: #@ "bump-" + component + "-component"
- task: open-charts-pr
config:
platform: linux
image_resource: #@ task_image_config()
inputs:
- name: #@ component_src_resource_name(component)
path: repo
- name: #@ edge_image_resource_name(component)
path: edge-image
- name: charts-repo
- name: pipeline-tasks
params:
GH_APP_ID: #@ data.values.github_app_id
GH_APP_PRIVATE_KEY: #@ data.values.github_app_private_key
COMPONENT: #@ component
BRANCH: #@ data.values.git_charts_branch
BOT_BRANCH: #@ "bump-" + component + "-component"
YAML_PATH: #@ component_lookup[component]["YAML_PATH"]
CHART: #@ component_lookup[component]["CHART"]
run:
path: pipeline-tasks/ci/core/tasks/open-charts-pr.sh
#@ end

#@ def on_nix_host(name, component, cmd, in_dir = ""):
#@ params = {}
#@ params["REPO_PATH"] = data.values.gh_repository + "-" + name
Expand Down Expand Up @@ -163,6 +248,9 @@ source:
- #@ "core/" + component
- #@ "core/" + component + "/*"
- #@ "core/" + component + "/**/*"
- #@ "bats/core/" + component
- #@ "bats/core/" + component + "/*"
- #@ "bats/core/" + component + "/**/*"
- flake.nix
- flake.lock
- toolchains/
Expand Down
5 changes: 5 additions & 0 deletions dev/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ TEST_RESOURCES = {
}

is_ci=("ci" in sys.argv) or cfg.get("bats", False)
run_apps=not cfg.get("bats", False)

# From the Tilt docs:
#
Expand Down Expand Up @@ -54,6 +55,7 @@ local_resource(
},
deps = _buck2_dep_inputs(dashboard_target),
allow_parallel = True,
auto_init = run_apps,
resource_deps = [
"hydra-dashboard",
"api-keys",
Expand Down Expand Up @@ -103,6 +105,7 @@ local_resource(
'http://localhost:3001/api/auth/callback/blink',
],
allow_parallel = True,
auto_init = run_apps,
resource_deps = [
"hydra",
"api",
Expand Down Expand Up @@ -169,6 +172,7 @@ local_resource(
serve_cmd = "buck2 run {}".format(consent_target),
deps = _buck2_dep_inputs(consent_target),
allow_parallel = True,
auto_init = run_apps,
resource_deps = [
"hydra-consent",
"apollo-router",
Expand All @@ -193,6 +197,7 @@ local_resource(
'http://localhost:3000',
],
allow_parallel = True,
auto_init = run_apps,
resource_deps = [
"hydra",
"api",
Expand Down

0 comments on commit 7ed9544

Please sign in to comment.