Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Prevent repeated builds of the upstream DB

Dhruv Bhanushalid19b32b9d289
diff --git a/.github/actions/load-img/action.yml b/.github/actions/load-img/action.yml
index c73bd9458..400bef3e8 100644
--- a/.github/actions/load-img/action.yml
+++ b/.github/actions/load-img/action.yml
@@ -14,9 +14,27 @@ inputs:
default: "true"
description: Whether to set up catalog image
+ setup_upstream_db:
+ default: "true"
+ description: Whether to set up upstream DB image
+
runs:
using: "composite"
steps:
+ # Upstream DB
+ - name: Download image `upstream_db`
+ uses: actions/download-artifact@v3
+ if: inputs.setup_upstream_db == 'true'
+ with:
+ name: upstream_db
+ path: /tmp
+
+ - name: Load image `upstream_db`
+ if: inputs.setup_upstream_db == 'true'
+ shell: bash
+ run: |
+ docker load --input /tmp/upstream_db.tar
+
# Catalog
- name: Download image `catalog`
uses: actions/download-artifact@v3
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index f28b8e60b..f536ede8b 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -91,6 +91,9 @@ jobs:
build_matrix["image"].append("frontend")
build_matrix["include"].append({"image": "frontend", "context": "frontend", "target": "app"})
publish_matrix["image"].append("frontend")
+ if any(item in changes for item in ["api", "ingestion_server", "catalog"]):
+ build_matrix["image"].append("upstream_db")
+ build_matrix["include"].append({"image": "upstream_db", "context": "docker/upstream_db", "target": "db"})
if "catalog" in changes:
build_matrix["image"].append("catalog")
build_matrix["include"].append({"image": "catalog", "context": "catalog", "target": "cat"})
@@ -449,6 +452,8 @@ jobs:
- name: Load Docker images
uses: ./.github/actions/load-img
+ with:
+ setup_catalog: false
- name: Run check recipe
run: just ${{ matrix.recipe }}
diff --git a/docker/upstream_db/Dockerfile b/docker/upstream_db/Dockerfile
index 4dd89f91b..8dc1b349b 100644
--- a/docker/upstream_db/Dockerfile
+++ b/docker/upstream_db/Dockerfile
@@ -1,4 +1,4 @@
-FROM postgres:13.6
+FROM postgres:13.6 as db
ARG PGCLI_VERSION=3.2.0