diff --git a/ci/apps/app-template.lib.yml b/ci/apps/app-template.lib.yml index b41b483838..c31efeedb2 100644 --- a/ci/apps/app-template.lib.yml +++ b/ci/apps/app-template.lib.yml @@ -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 @@ -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 diff --git a/ci/apps/pipeline.yml b/ci/apps/pipeline.yml index e787b2d831..1cd8ffab68 100644 --- a/ci/apps/pipeline.yml +++ b/ci/apps/pipeline.yml @@ -1,17 +1,16 @@ #@ 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: @@ -19,12 +18,14 @@ groups: 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 @@ -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 @@ -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() diff --git a/ci/apps/tasks/buck-task.sh b/ci/apps/tasks/buck-task.sh new file mode 100755 index 0000000000..3be6eb70f2 --- /dev/null +++ b/ci/apps/tasks/buck-task.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +cd repo + +buck2 ${BUCK_CMD} ${BUCK_TARGET}