Skip to content

Update self_runner_test.yml #50

Update self_runner_test.yml

Update self_runner_test.yml #50

name: Loader PR Test
on:
workflow_dispatch: {}
push:
branches:
- 'fb_ansible_test'
jobs:
setup:
runs-on: flysql26-dispatch
outputs:
uuid: ${{ steps.generate_uuid.outputs.uuid }}
steps:
- name: Generate UUID
id: generate_uuid
run: |
UUID=$(openssl rand -hex 16)
echo "UUID=$UUID"
echo "UUID=$UUID" >> $GITHUB_ENV
echo "::set-output name=uuid::$UUID"
start-runner:
runs-on: flysql26-dispatch
needs: setup
outputs:
uuid: ${{ steps.set_output_uuid.outputs.uuid }}
steps:
- name: Start Dockerized Runner
id: start_dockerized_runner
uses: alliance-genome/agr_github_runner/.github/actions/start_runner@main
with:
UUID: ${{ needs.setup.outputs.uuid }}
ACCESS_TOKEN: ${{ secrets.CREATE_RUNNER_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Set Output UUID
id: set_output_uuid
run: echo "::set-output name=uuid::${{ needs.setup.outputs.uuid }}"
use-runner:
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.uuid }}
steps:
- name: Log in to ECR
uses: alliance-genome/agr_github_runner/.github/actions/login_to_ecr@main
with:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Construct NEO_ENV_IMAGE
id: construct-image
env:
REGISTRY: 100225593120.dkr.ecr.us-east-1.amazonaws.com
DOCKER_PULL_TAG: "stage" # Adjust as needed
run: echo "NEO_ENV_IMAGE=${{ env.REGISTRY }}/agr_neo4j_env:${{ env.DOCKER_PULL_TAG }}" >> $GITHUB_ENV
- name: Start Neo4j Environment
uses: alliance-genome/agr_github_runner/.github/actions/start_neo4j_env@main
- name: Checkout PR code
uses: actions/checkout@v2
with:
repository: alliance-genome/agr_loader
ref: ${{ github.event.pull_request.head.sha }}
- name: Set environment variables
run: |
echo "NET=testing" >> $GITHUB_ENV
echo "REG=100225593120.dkr.ecr.us-east-1.amazonaws.com" >> $GITHUB_ENV
echo "LOGOPT='--log-driver=gelf --log-opt gelf-address=udp://logs.alliancegenome.org:12201'" >> $GITHUB_ENV
echo "DOCKER_PULL_TAG=stage" >> $GITHUB_ENV
echo "ALLIANCE_RELEASE=7.3.0" >> $GITHUB_ENV
- name: Build Docker container
env:
DOCKER_BUILDKIT: 1
run: |
docker build --pull --no-cache --force-rm --build-arg DOCKER_PULL_TAG=${{ env.DOCKER_PULL_TAG }} --build-arg REG=${{ env.REG }} -t ${{ env.REG }}/agr_loader_run:${{ env.NET }}_loader .
- name: Create Docker network
run: docker network create testing
- name: Run Loader in Test Mode
env:
LOADER_TEST_NAME: "agr.testing.loader.test"
LOADER_TEST_RUN_IMAGE: "${{ env.REG }}/agr_loader_run:${{ env.NET }}_loader"
LOG_SERVER_ADDRESS: "udp://logs.alliancegenome.org:12201"
NEO_VOLUME_NAME: "/data"
NET: "testing"
API_ACCESS_TOKEN: ${{ secrets.API_ACCESS_TOKEN }}
DOWNLOAD_HOST: "download.alliancegenome.org"
TEST_SET: "true"
ALLIANCE_RELEASE: "7.3.0"
FMS_API_URL: "https://fms.alliancegenome.org"
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GENERATE_REPORTS: "true"
NEO_SERVER_NAME: "stage-neo4j.alliancegenome.org" # Use the name from the constructed NEO_ENV_IMAGE
run: |
docker run --rm \
--name $LOADER_TEST_NAME \
--env API_KEY=$API_ACCESS_TOKEN \
--env DEBUG=False \
--env DOWNLOAD_HOST=$DOWNLOAD_HOST \
--env TEST_SET=$TEST_SET \
--env ALLIANCE_RELEASE=$ALLIANCE_RELEASE \
--env FMS_API_URL=$FMS_API_URL \
--env AWS_ACCESS_KEY=$AWS_ACCESS_KEY \
--env AWS_SECRET_KEY=$AWS_SECRET_KEY \
--env GENERATE_REPORTS=$GENERATE_REPORTS \
--env NEO4J_HOST=$NEO_SERVER_NAME \
--network $NET \
--volume $NEO_VOLUME_NAME:/usr/src/app/tmp \
--log-driver=gelf --log-opt gelf-address=$LOG_SERVER_ADDRESS \
$LOADER_TEST_RUN_IMAGE
- name: Remove Docker network
run: docker network rm testing
stop-runner:
runs-on: flysql26-dispatch
needs: use-runner
steps:
- name: Stop Dockerized Runner
uses: alliance-genome/agr_github_runner/.github/actions/stop_runner@main
with:
UUID: ${{ needs.start-runner.outputs.uuid }}
ACCESS_TOKEN: ${{ secrets.CREATE_RUNNER_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}