Skip to content

chore: update docs location and link for seurat notice #6310

chore: update docs location and link for seurat notice

chore: update docs location and link for seurat notice #6310

name: Create/Update rdev for PR
on:
pull_request:
branches-ignore:
- "prod"
types:
- opened
- synchronize
- reopened
env:
# Force using BuildKit instead of normal Docker, required so that metadata
# is written/read to allow us to use layers of previous builds as cache.
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_REPO: ${{ secrets.ECR_REPO }}/
STACK_NAME: pr-${{ github.event.number }}
permissions:
id-token: write
issues: write
pull-requests: write
contents: write
jobs:
get_previous_image_digests:
if: ${{ ! startsWith(github.head_ref, 'renovate/') }}
runs-on: ubuntu-22.04
outputs:
ecr_repos: ${{ steps.get_digests.outputs.ecr_repos }}
image_digests: ${{ steps.get_digests.outputs.image_digests }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 1800
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ secrets.ECR_REPO }}
- name: Get previous image digests for each repo
id: get_digests
run: |
ECR_REPOS=(corpora-frontend corpora-backend corpora-backend-de corpora-backend-wmg \
corpora-upload-failures corpora-upload-success \
dataset-submissions corpora-upload wmg-processing cellguide-pipeline)
IMAGE_DIGESTS=()
for ecr_repo in "${ECR_REPOS[@]}"; do
IMAGE_DIGESTS+=(`aws ecr list-images --repository-name $ecr_repo --filter tagStatus=TAGGED \
| jq -r --arg STACK_NAME ${STACK_NAME} '[.imageIds[] \
| select(.imageTag==$STACK_NAME)][0].imageDigest'`)
done
echo "ECR_REPOS=${ECR_REPOS[@]}" >> $GITHUB_OUTPUT
echo "IMAGE_DIGESTS=${IMAGE_DIGESTS[@]}" >> $GITHUB_OUTPUT
build_images:
if: ${{ ! startsWith(github.head_ref, 'renovate/') }}
uses: ./.github/workflows/build-images.yml
secrets: inherit
seed-wmg-cellguide-rdev:
if: ${{ ! startsWith(github.head_ref, 'renovate/') }}
runs-on: ubuntu-22.04
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 1800
- name: Checkout Repository
uses: actions/checkout@v2
- name: Grant Execute Permission to Bash Script
run: |
chmod +x ./scripts/populate_rdev_with_cellguide_data.sh ./scripts/populate_rdev_with_wmg_data.sh
- name: Seed cell guide data
run: |
./scripts/populate_rdev_with_cellguide_data.sh ${{ env.STACK_NAME }}
- name: Seed WMG data
run: |
./scripts/populate_rdev_with_wmg_data.sh ${{ env.STACK_NAME }}
deploy-rdev:
if: ${{ ! startsWith(github.head_ref, 'renovate/') }}
runs-on: ubuntu-22.04
concurrency:
group: pr-${{ github.event.number }}-happy
cancel-in-progress: false
needs:
- build_images
- get_previous_image_digests
- seed-wmg-cellguide-rdev
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 2700
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ secrets.ECR_REPO }}
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Update deployment
uses: chanzuckerberg/github-actions/.github/actions/[email protected]
with:
tfe-token: ${{ secrets.TFE_TOKEN }}
stack-name: ${{ env.STACK_NAME }}
tag: ${{ needs.build_images.outputs.image_tag }}
happy_version: "0.110.1"
delete-previous-images:
if: ${{ ! startsWith(github.head_ref, 'renovate/') }}
runs-on: ubuntu-22.04
needs:
- get_previous_image_digests
- deploy-rdev
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 2700
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ secrets.ECR_REPO }}
- name: Delete previous images
run: |
ECR_REPOS=(${{ needs.get_previous_image_digests.outputs.ecr_repos }})
IMAGE_DIGESTS=(${{ needs.get_previous_image_digests.outputs.image_digests }})
for ((i = 0; i < ${#ECR_REPOS[@]}; ++i)); do
if [ ${IMAGE_DIGESTS[$i]} == "null" ]; then
continue
fi
aws ecr batch-delete-image --repository-name ${ECR_REPOS[$i]} --image-ids imageDigest=${IMAGE_DIGESTS[$i]}
done
summarize:
if: ${{ ! startsWith(github.head_ref, 'renovate/') && github.event.action == 'opened' }}
runs-on: ubuntu-22.04
steps:
- name: Summerize deployment
id: summary
run: |
summary="## Deployment Summary"
summary+="\n- backend_url: https://${{ env.STACK_NAME }}-backend.rdev.single-cell.czi.technology"
summary+="\n- backend_de_url: https://${{ env.STACK_NAME }}-backend-de.rdev.single-cell.czi.technology"
summary+="\n- backend_wmg_url: https://${{ env.STACK_NAME }}-backend-wmg.rdev.single-cell.czi.technology"
summary+="\n- frontend_url: https://${{ env.STACK_NAME }}-frontend.rdev.single-cell.czi.technology"
summary+="\n- delete_db_task_definition_arn: arn:aws:ecs:us-west-2:***:task-definition/dp-rdev-${{ env.STACK_NAME}}-deletion:1"
summary+="\n- migrate_db_task_definition_arn: arn:aws:ecs:us-west-2:***:task-definition/dp-rdev-${{ env.STACK_NAME}}-migration:1"
echo "SUMMARY=$summary" >> $GITHUB_OUTPUT
- name: Post Comment
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ steps.summary.outputs.summary}}"
})
rdev-tests:
if: ${{ ! startsWith(github.head_ref, 'renovate/') }}
uses: ./.github/workflows/rdev-tests.yml
secrets: inherit
needs:
- deploy-rdev