Skip to content

Commit

Permalink
Run UI e2e tests with given aerie/gateway docker tags when provided i…
Browse files Browse the repository at this point in the history
…n PR body (#1439)

GH workflows: update Test workflow to check PR body for REQUIRES_AERIE_PR and REQUIRES_GATEWAY_PR flags and use tagged docker images from specified PR if so
  • Loading branch information
dandelany authored Aug 29, 2024
1 parent f1507f9 commit 4e31f20
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- develop
- dev-[0-9]+.[0-9]+.[0-9]+
types:
# defaults + 'edited', to handle changes to flags like ___REQUIRES_AERIE_PR___ in the PR body
[opened, synchronize, reopened, edited]
push:
branches:
- develop
Expand Down Expand Up @@ -33,6 +36,7 @@ env:
SCHEDULER_PASSWORD: '${{secrets.SCHEDULER_PASSWORD}}'
SEQUENCING_USERNAME: '${{secrets.SEQUENCING_USERNAME}}'
SEQUENCING_PASSWORD: '${{secrets.SEQUENCING_PASSWORD}}'
PR_BODY: '${{github.event.pull_request.body}}'

jobs:
unit-test:
Expand Down Expand Up @@ -69,11 +73,25 @@ jobs:
with:
node-version: 'lts/*'
cache: npm
- name: Extract Aerie backend docker tag from PR body
# look in the PR body for eg. the string ___REQUIRES_AERIE_PR___=9999, extract the number & save to env var
# if backend PR is labeled correctly, it will publish a docker tag called 'pr-9999' to use in tests
if: ${{ contains(env.PR_BODY, '___REQUIRES_AERIE_PR___=') }}
run: |
echo "AERIE_IMAGE_TAG=pr-$(echo $PR_BODY | sed -n 's/.*___REQUIRES_AERIE_PR___=\"\([0-9]\+\)\".*/\1/p')" >> $GITHUB_ENV
- name: Extract Aerie gateway docker tag from PR body
# look in the PR body for eg. the string ___REQUIRES_AERIE_PR___=9999, extract the number & save to env var
# if backend PR is labeled correctly, it will publish a docker tag called 'pr-9999' to use in tests
if: ${{ contains(env.PR_BODY, '___REQUIRES_GATEWAY_PR___=') }}
run: |
echo "GATEWAY_IMAGE_TAG=pr-$(echo $PR_BODY | sed -n 's/.*___REQUIRES_GATEWAY_PR___=\"\([0-9]\+\)\".*/\1/p')" >> $GITHUB_ENV
- name: Start Services (Aerie)
run: |
docker compose -f docker-compose-test.yml up -d
echo "AERIE_IMAGE_TAG: $AERIE_IMAGE_TAG"
echo "GATEWAY_IMAGE_TAG: $GATEWAY_IMAGE_TAG"
docker compose -f docker-compose-test.yml up -d --quiet-pull
docker images
docker ps -a
docker ps -a --no-trunc
- name: Install Dependencies (UI)
run: npm ci
- name: Build (UI)
Expand Down
16 changes: 8 additions & 8 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
AERIE_DB_PORT: 5432
GATEWAY_DB_USER: '${GATEWAY_USERNAME}'
GATEWAY_DB_PASSWORD: '${GATEWAY_PASSWORD}'
image: 'ghcr.io/nasa-ammos/aerie-gateway:develop'
image: 'ghcr.io/nasa-ammos/aerie-gateway:${GATEWAY_IMAGE_TAG:-develop}'
ports: ['9000:9000']
restart: always
volumes:
Expand All @@ -42,7 +42,7 @@ services:
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
UNTRUE_PLAN_START: '2000-01-01T11:58:55.816Z'
image: 'ghcr.io/nasa-ammos/aerie-merlin:develop'
image: 'ghcr.io/nasa-ammos/aerie-merlin:${AERIE_IMAGE_TAG:-develop}'
ports: ['27183:27183']
restart: always
volumes:
Expand All @@ -62,7 +62,7 @@ services:
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
UNTRUE_PLAN_START: '2000-01-01T11:58:55.816Z'
image: 'ghcr.io/nasa-ammos/aerie-merlin-worker:develop'
image: 'ghcr.io/nasa-ammos/aerie-merlin-worker:${AERIE_IMAGE_TAG:-develop}'
ports: ['27187:8080']
restart: always
volumes:
Expand All @@ -82,7 +82,7 @@ services:
-Dorg.slf4j.simpleLogger.defaultLogLevel=INFO
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
image: 'ghcr.io/nasa-ammos/aerie-scheduler:develop'
image: 'ghcr.io/nasa-ammos/aerie-scheduler:${AERIE_IMAGE_TAG:-develop}'
ports: ['27185:27185']
restart: always
volumes:
Expand All @@ -105,7 +105,7 @@ services:
-Dorg.slf4j.simpleLogger.defaultLogLevel=INFO
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
image: 'ghcr.io/nasa-ammos/aerie-scheduler-worker:develop'
image: 'ghcr.io/nasa-ammos/aerie-scheduler-worker:${AERIE_IMAGE_TAG:-develop}'
ports: ['27189:8080']
restart: always
volumes:
Expand All @@ -124,7 +124,7 @@ services:
SEQUENCING_DB_PASSWORD: '${SEQUENCING_PASSWORD}'
SEQUENCING_LOCAL_STORE: /usr/src/app/sequencing_file_store
SEQUENCING_SERVER_PORT: 27184
image: 'ghcr.io/nasa-ammos/aerie-sequencing:develop'
image: 'ghcr.io/nasa-ammos/aerie-sequencing:${AERIE_IMAGE_TAG:-develop}'
ports: ['27184:27184']
restart: always
volumes:
Expand All @@ -146,7 +146,7 @@ services:
HASURA_GRAPHQL_LOG_LEVEL: info
HASURA_GRAPHQL_METADATA_DATABASE_URL: 'postgres://${AERIE_USERNAME}:${AERIE_PASSWORD}@postgres:5432/aerie_hasura'
HASURA_GRAPHQL_METADATA_DIR: /hasura-metadata
image: 'ghcr.io/nasa-ammos/aerie-hasura:develop'
image: 'ghcr.io/nasa-ammos/aerie-hasura:${AERIE_IMAGE_TAG:-develop}'
ports: ['8080:8080']
restart: always
postgres:
Expand All @@ -165,7 +165,7 @@ services:
SCHEDULER_DB_PASSWORD: '${SCHEDULER_PASSWORD}'
SEQUENCING_DB_USER: '${SEQUENCING_USERNAME}'
SEQUENCING_DB_PASSWORD: '${SEQUENCING_PASSWORD}'
image: 'ghcr.io/nasa-ammos/aerie-postgres:develop'
image: 'ghcr.io/nasa-ammos/aerie-postgres:${AERIE_IMAGE_TAG:-develop}'
ports: ['5432:5432']
restart: always
volumes:
Expand Down

0 comments on commit 4e31f20

Please sign in to comment.