Skip to content

Commit

Permalink
ci: add buck-task.sh to apps pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Oct 26, 2023
1 parent 916b4bd commit 11f4bc2
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 5 deletions.
83 changes: 83 additions & 0 deletions ci/apps/app-template.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@
#@ "task_image_config",
#@ "release_task_image_config")

#@ def galoy_dev_image():
#@ return data.values.docker_registry + "/galoy-dev"
#@ end

#@ def galoy_dev_image_config():
type: registry-image
source:
username: ((docker-creds.username))
password: ((docker-creds.password))
repository: #@ galoy_dev_image()
#@ end

#@ def buck_test_name(app):
#@ return "buck-test-" + app
#@ end

#@ def buck_test(app):
name: #@ buck_test_name(app)
serial: true
plan:
- in_parallel:
- get: #@ app_src_resource_name(app)
trigger: true
- { get: pipeline-tasks }
- task: prepare-docker-build
config:
platform: linux
image_resource: #@ galoy_dev_image_config()
inputs:
- name: pipeline-tasks
- name: #@ app_src_resource_name(app)
path: repo
params:
BUCK_TARGET: #@ "//apps/" + app
BUCK_CMD: test
run:
path: pipeline-tasks/ci/apps/tasks/buck-task.sh
#@ end

#@ def build_edge_image_name(app):
#@ return "build-" + app + "-edge-image"
#@ end
Expand Down Expand Up @@ -52,6 +91,50 @@ plan:
image: image/image.tar
#@ end

#@ def build_edge_image(app):
name: #@ build_edge_image_name(app)
serial: true
plan:
- in_parallel:
- get: #@ app_src_resource_name(app)
trigger: true
- { get: pipeline-tasks }
- task: prepare-docker-build
config:
platform: linux
image_resource: #@ task_image_config()
inputs:
- name: pipeline-tasks
- name: #@ app_src_resource_name(app)
path: repo
outputs:
- name: repo
run:
path: pipeline-tasks/ci/apps/tasks/prepare-docker-build.sh
- task: build
attempts: 2
privileged: true
config:
platform: linux
image_resource:
type: registry-image
source:
repository: vito/oci-build-task
inputs:
- name: repo
outputs:
- name: image
params:
CONTEXT: repo
DOCKERFILE: #@ "repo/apps/" + app + "/Dockerfile"
BUILD_ARGS_FILE: repo/.build-args
run:
path: build
- put: #@ edge_image_resource_name(app)
params:
image: image/image.tar
#@ end

#@ def bump_image_in_chart_name(app):
#@ return "bump-" + app + "-in-chart"
#@ end
Expand Down
12 changes: 7 additions & 5 deletions ci/apps/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
#@ load("@ytt:data", "data")

#@ load("app-template.lib.yml",
#@ "galoy_dev_image",
#@ "build_edge_image",
#@ "build_edge_image_name",
#@ "buck_test_name",
#@ "buck_test",
#@ "app_src_resource",
#@ "app_edge_image",
#@ "bump_image_in_chart_name",
#@ "bump_image_in_chart")

#@ def galoy_dev_image():
#@ return data.values.docker_registry + "/galoy-dev"
#@ end

#@ apps = ["consent", "dashboard"]

groups:
- name: all
jobs:
#@ for app in apps:
- #@ build_edge_image_name(app)
- #@ buck_test_name(app)
- #@ bump_image_in_chart_name(app)
#@ end
#@ for app in apps:
- name: #@ app
jobs:
- #@ build_edge_image_name(app)
- #@ buck_test_name(app)
- #@ bump_image_in_chart_name(app)
#@ end
- name: dev-image
Expand All @@ -34,6 +35,7 @@ groups:
jobs:
#@ for app in apps:
- #@ build_edge_image(app)
- #@ buck_test(app)
- #@ bump_image_in_chart(app)
#@ end
- name: build-galoy-dev-image
Expand Down Expand Up @@ -108,7 +110,7 @@ resources:
- name: galoy-dev-image
type: registry-image
source:
tag: edge
tag: latest
username: #@ data.values.docker_registry_user
password: #@ data.values.docker_registry_password
repository: #@ galoy_dev_image()
7 changes: 7 additions & 0 deletions ci/apps/tasks/buck-task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

cd repo

buck2 ${BUCK_CMD} ${BUCK_TARGET}

0 comments on commit 11f4bc2

Please sign in to comment.