Refactor UpdateDocumentsStatusService for new logging approach #27734
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preview Environment Deployment | |
on: | |
repository_dispatch: | |
types: [deploy_review_instance] | |
push: | |
branches: | |
- '**' | |
jobs: | |
deploy-preview-environment: | |
name: Deploy Preview Environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set default source branch | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
echo "SOURCE_REF=${{ github.ref_name }}" >> $GITHUB_ENV | |
echo "WEB_BRANCH=main" >> $GITHUB_ENV | |
- name: Set custom source branch | |
if: ${{ github.event_name == 'repository_dispatch' }} | |
run: | | |
echo "SOURCE_REF=${{ github.event.client_payload.source_ref }}" >> $GITHUB_ENV | |
echo "WEB_BRANCH=${{ github.event.client_payload.web_branch }}" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.SOURCE_REF }} | |
- name: Setup Environment | |
run: echo "VETS_API_USER_ID=$(id -u)" >> $GITHUB_ENV | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-gov-west-1 | |
- name: Get va-vsp-bot token | |
uses: marvinpinto/[email protected] | |
with: | |
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN | |
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Install dependencies | |
run: | | |
npm install @actions/core | |
- name: Start Deployment | |
if: ${{ github.event_name == 'push' }} | |
uses: bobheadxi/deployments@v1 | |
id: deployment | |
with: | |
step: start | |
token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
env: ${{ github.ref_name }}/main/main | |
ref: ${{ github.ref_name }} | |
- name: Get Source Repo and Source Ref | |
run: node ./script/github-actions/pe-deploy-source.js | |
env: | |
SOURCE_EVENT: ${{ github.event_name }} | |
SOURCE_REPO: ${{ github.event.client_payload.source_repo }} | |
SOURCE_DEPLOYMENT: ${{ github.event.client_payload.deployment_id }} | |
WORKFLOW_DEPLOYMENT: ${{ steps.deployment.outputs.deployment_id }} | |
PE_EXPIRATION_DAYS: ${{ github.event.client_payload.expiration_days }} | |
- name: Login to ECR # Update ECR credentials if necessary | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build Docker Image #use "file" input to designate alternate dockerfile path. Defaults to "Dockerfile": https://github.com/docker/build-push-action | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
BUNDLE_ENTERPRISE__CONTRIBSYS__COM=${{ env.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }} | |
USER_ID=${{ env.VETS_API_USER_ID }} | |
RAILS_ENV=production | |
context: . | |
# target: production | |
push: true | |
# Update tags and ECR Repository | |
tags: | | |
${{ steps.login-ecr.outputs.registry }}/dsva/preview-environment/vets-api:${{ env.SOURCE_REF_SANITIZED }} | |
# cache-from: type=registry,ref=$ECR_REGISTRY/$ECR_REPOSITORY | |
# cache-to: type=inline | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }} | |
event-type: deploy_review_instance | |
repository: department-of-veterans-affairs/devops | |
client-payload: '{"source_repo": "${{ env.SOURCE_REPO }}", "source_ref": "${{ env.SOURCE_REF }}", "source_ref_sanitized": "${{ env.SOURCE_REF_SANITIZED }}", "expiration_days": "${{ env.EXPIRATION_DAYS }}", "deployment_id": "${{ env.DEPLOYMENT_ID }}", "web_branch": "${{ env.WEB_BRANCH }}", "api_branch": "${{ env.SOURCE_REF }}"}' |