Skip to content

Bump log from 0.4.21 to 0.4.22 #2470

Bump log from 0.4.21 to 0.4.22

Bump log from 0.4.21 to 0.4.22 #2470

Workflow file for this run

name: Docker
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build_docker:
strategy:
matrix:
rust-features: [["default"], ["integration-testing", "admin"]]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: resolve_variables
run: |
echo "GIT_REVISION=$(git describe --always --dirty=-modified)" >> $GITHUB_OUTPUT
# Join features with , for RUST_FEATURES, but - for cache keys, where commas are illegal
echo "CACHE_KEY=${{ join(matrix.rust-features, '-') }}" >> $GITHUB_OUTPUT
echo "RUST_FEATURES=${{ join(matrix.rust-features, ',') }}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
use: true
- name: Build
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
cache-from: |
type=gha,scope=main-${{ steps.resolve_variables.outputs.CACHE_KEY }}
type=gha,scope=${{ github.ref_name }}-${{ steps.resolve_variables.outputs.CACHE_KEY }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ steps.resolve_variables.outputs.CACHE_KEY }},mode=max
build-args: |
GIT_REVISION=${{ steps.resolve_variables.outputs.GIT_REVISION }}
RUST_FEATURES=${{ steps.resolve_variables.outputs.RUST_FEATURES }}
# Test the dev compose, which should use the images built earlier. Technically this is only
# interesting when feature integration-testing is on, but we may as well exercise both.
#
# Bring the environment up, down and up again to ensure all services can restart
- name: Compose (dev)
id: compose-dev
run: |
docker compose -f compose.dev.yaml up --wait --wait-timeout 120
docker compose down
docker compose -f compose.dev.yaml up --wait --wait-timeout 120
- name: Inspect dev containers
if: ${{ failure() && steps.compose-dev.outcome != 'success' }}
run: |
docker compose ps --all
for NAME in `docker compose ps --all --format json | jq -r '.Name'`; do
echo $NAME
docker inspect $NAME
docker logs $NAME
done
# Test the non-dev compose, which we use for demo purposes. This pulls images from remote repos,
# so no need to build anything.
# Ideally we'd test on macOS and Windows, too, but those runners don't have Docker:
# https://github.com/actions/runner-images/issues/2150
# https://github.com/actions/runner/issues/904
compose:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: checkout
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --package divviup-cli --profile release
working-directory: checkout
- run: |
mkdir compose
cp checkout/target/release/divviup compose/
cp checkout/compose.yaml compose/
- name: Compose
id: compose
run: docker compose up --wait --wait-timeout 120
working-directory: compose
- name: Demo script
id: demo-script
working-directory: compose
run: |
export DIVVIUP_API_URL=http://localhost:8080
export DIVVIUP_TOKEN=""
export DIVVIUP_ACCOUNT_ID=`./divviup account list | jq -r '.[0].id'`
printf 'account ID %s\n' $DIVVIUP_ACCOUNT_ID
AGGREGATOR_LIST=`./divviup aggregator list`
echo "aggregator list:"
echo $AGGREGATOR_LIST
LEADER_ID=`echo $AGGREGATOR_LIST | jq -r '.[] |= select(.name == "leader") |.[0].id'`
printf 'leader ID %s\n' $LEADER_ID
HELPER_ID=`echo $AGGREGATOR_LIST | jq -r '.[] |= select(.name == "helper") |.[0].id'`
printf 'helper ID %s\n' $HELPER_ID
CRED_OUTPUT=`./divviup collector-credential generate --save`
echo "collector credential:"
echo $CRED_OUTPUT
COLLECTOR_CREDENTIAL_PATH=${PWD}/`echo $CRED_OUTPUT | jq -r '.name' 2>/dev/null || echo ''`.json
printf 'collector credential path %s\n' $COLLECTOR_CREDENTIAL_PATH
COLLECTOR_CREDENTIAL_ID=`echo $CRED_OUTPUT | jq -r '.id' 2>/dev/null || echo ''`
printf 'collector credential ID %s\n' $COLLECTOR_CREDENTIAL_ID
TASK=`./divviup task create --name net-promoter-score \
--leader-aggregator-id $LEADER_ID --helper-aggregator-id $HELPER_ID \
--collector-credential-id $COLLECTOR_CREDENTIAL_ID \
--vdaf histogram --categorical-buckets 0,1,2,3,4,5,6,7,8,9,10 \
--min-batch-size 100 --max-batch-size 200 --time-precision 60sec`
echo "task:"
echo $TASK
TASK_ID=`echo $TASK | jq -r '.id'`
for i in {1..150}; do
measurement=$(( $RANDOM % 10 ))
./divviup dap-client upload --task-id $TASK_ID --measurement $measurement;
done
echo "finished uploading measurements"
sleep 120
./divviup dap-client collect \
--task-id $TASK_ID \
--collector-credential-file $COLLECTOR_CREDENTIAL_PATH \
--current-batch
- name: Inspect containers
if: ${{ failure() && (steps.compose.outcome != 'success' || steps.demo-script.outcome != 'success') }}
working-directory: compose
run: |
docker compose ps --all
for NAME in `docker compose ps --all --format json | jq -r '.Name'`; do
echo $NAME
docker inspect $NAME
docker logs $NAME
done