Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move dev server image build into main CI workflow #141

Merged
merged 13 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/build_test_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed due to a weird detail of how load: true works. Some context here, it failed without this and then worked when I added it, so I didn't dig too much deeper 🤷

driver: docker

- name: Cache Docker layers
uses: actions/cache@v2
Expand All @@ -64,12 +66,13 @@ jobs:
${{ runner.os }}-graphhopper-buildx
# ---------------------

# Build image for unit tests
- name: Build test image
# Build base image for unit tests
- name: Build base image
uses: docker/build-push-action@v2
with:
context: .
push: true
push: false
load: true
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load: true is what tells docker to push/pull from the local docker repo. vs remote

file: Dockerfile.build
tags: "us.gcr.io/model-159019/gh:${{ github.sha }}-dev"
build-args: |
Expand All @@ -80,6 +83,22 @@ jobs:
MININORCAL_OSM_PATH=${{ secrets.MININORCAL_OSM_PATH}}
MININORCAL_GTFS_PATH=${{ secrets.MININORCAL_GTFS_PATH}}

# Build the dev server image used in functional tests
mark-idleman marked this conversation as resolved.
Show resolved Hide resolved
- name: Build the server
uses: docker/build-push-action@v2
with:
context: .
push: false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we specify push: true here and get rid of the following Push server-dev image step?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm great question, I vaguely recall hitting some issue with this but I can't find the relevant stack overflow post now lol, so let's try it 🤞

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, at least the error is explicit 😀

Error: buildx failed with: ERROR: push and load may not be set together at the moment

load: true
file: Dockerfile.server
tags: "us.gcr.io/model-159019/gh:${{ github.sha }}-server-dev"
build-args: |
BASE_IMAGE=us.gcr.io/model-159019/gh:${{ github.sha }}-dev

- name: Push server-dev image
run: |
docker push us.gcr.io/model-159019/gh:${{ github.sha }}-server-dev

- name: run unit tests
run: |
docker run -t -d --name testrunner us.gcr.io/model-159019/gh:${{ github.sha }}-dev /bin/bash
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/functional-test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Functional Test
# This test does the following:
# * Builds the "server" docker image that is used by the model repo
# * Builds the sandbox docker image used for the router sandbox
# * Runs functional tests queries against micro nor cal golden OD set
# * Analyzes results of functional test queries, comparing against golden result set
# * If tests pass, updates git and docker tags
Expand All @@ -23,7 +23,7 @@ jobs:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
functional-test-queries:
name: "Build server image and run functional test queries"
name: "Build sandbox image and run functional test queries"
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -85,25 +85,15 @@ jobs:
- name: Set temp directory env variable
run: echo "TMPDIR=$(mktemp -d)" >> $GITHUB_ENV

- name: build the server
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile.server
tags: "us.gcr.io/model-159019/gh:${{ github.sha }}-server-dev"
build-args: |
BASE_IMAGE=us.gcr.io/model-159019/gh:${{ github.sha }}-dev

- name: build the sandbox
- name: Build the sandbox
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile.sandbox
tags: "us.gcr.io/model-159019/gh:${{ github.sha }}-server-sandbox"
build-args: |
BASE_IMAGE=us.gcr.io/model-159019/gh:${{ github.sha }}-dev
BASE_IMAGE=us.gcr.io/model-159019/gh:${{ github.sha }}-server-dev

- name: Install golang
uses: actions/setup-go@v2
Expand Down