Skip to content

Commit

Permalink
Only build api_dev image when needed and do not make artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkb committed May 8, 2024
1 parent c98075f commit 47243d6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ jobs:
needs:
- get-changes
- build-images
- get-image-tag

steps:
- name: Checkout repository
Expand All @@ -417,7 +418,34 @@ jobs:
uses: ./.github/actions/load-img
with:
run_id: ${{ github.run_id }}
setup_images: upstream_db ingestion_server api=api_dev
setup_images: upstream_db ingestion_server

# Sets build args specifying versions needed to build Docker image.
- name: Prepare build args
id: prepare-build-args
run: |
just versions | tee "$GITHUB_OUTPUT"
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true

- name: Build API dev image
uses: docker/build-push-action@v5
with:
context: api
target: api
push: false
load: true
tags: openverse-api
cache-from: type=gha,scope=api_dev
cache-to: type=gha,scope=api_dev
build-contexts: packages=./packages/python
build-args: |
SEMANTIC_VERSION=${{ needs.get-image-tag.outputs.image_tag }}
API_PY_VERSION=${{ steps.prepare-build-args.outputs.api_py_version }}
PDM_INSTALL_ARGS="--dev"
- name: Start API, ingest and index test data
run: just api/init
Expand Down
17 changes: 2 additions & 15 deletions automations/python/workflows/set_matrix_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ def ser_set(x):
build_contexts="packages=./packages/python",
build_args="PDM_INSTALL_ARGS=--prod",
),
"api_dev": Include(
image="api_dev",
target="api",
context="api",
build_contexts="packages=./packages/python",
build_args="PDM_INSTALL_ARGS=--dev",
),
"api_nginx": Include(
image="api_nginx",
target="nginx",
Expand All @@ -99,16 +92,10 @@ def ser_set(x):
build_matrix["image"] |= {"upstream_db", "catalog"}
publish_matrix["image"].add("catalog")
if "ingestion_server" in changes:
build_matrix["image"] |= {"upstream_db", "ingestion_server", "api", "api_dev"}
build_matrix["image"] |= {"upstream_db", "ingestion_server", "api"}
publish_matrix["image"].add("ingestion_server")
if "api" in changes:
build_matrix["image"] |= {
"upstream_db",
"ingestion_server",
"api",
"api_dev",
"api_nginx",
}
build_matrix["image"] |= {"upstream_db", "ingestion_server", "api", "api_nginx"}
publish_matrix["image"] |= {"api", "api_nginx"}
if "frontend" in changes:
build_matrix["image"] |= {"frontend", "frontend_nginx"}
Expand Down

0 comments on commit 47243d6

Please sign in to comment.