Format Pipelines

Ensures consistent formatting across YAML files by standardizing quotes.
This improves readability and maintainability of the configuration files.
This commit is contained in:
maguire-arman 2025-05-12 10:51:55 -04:00
parent 7e5de7da3f
commit 70b41a4f17
2 changed files with 191 additions and 191 deletions

View file

@ -1,187 +1,187 @@
trigger: none trigger: none
schedules: schedules:
- cron: 0 9 * * MON-FRI - cron: 0 9 * * MON-FRI
always: true always: true
displayName: Daily Test Automation Run for FMG-NextGen displayName: Daily Test Automation Run for FMG-NextGen
branches: branches:
include: include:
- develop - develop
pool: 'Default' pool: "Default"
variables: variables:
# - group: Digital-Infrastructure # - group: Digital-Infrastructure
# - group: FMG-BuildBranches # - group: FMG-BuildBranches
- name: dockerImageName - name: dockerImageName
value: 'playwright-tests' value: "playwright-tests"
- name: imageTag - name: imageTag
value: '$(Build.BuildId)' value: "$(Build.BuildId)"
- name: totalShards - name: totalShards
value: 4 value: 4
- name: IS_REGRESSION - name: IS_REGRESSION
value: 'true' value: "true"
- name: JIRA_BOARD_ID - name: JIRA_BOARD_ID
value: '845' value: "845"
- name: JIRA_EPIC_KEY - name: JIRA_EPIC_KEY
value: 'CASH-208' value: "CASH-208"
- name: JIRA_PROJECT_KEY - name: JIRA_PROJECT_KEY
value: 'CASH' value: "CASH"
stages: stages:
- stage: TestPr - stage: TestPr
displayName: Run Playwright Test displayName: Run Playwright Test
jobs: jobs:
- job: playwright_tests - job: playwright_tests
continueOnError: true continueOnError: true
strategy: strategy:
matrix: matrix:
shard1: shard1:
shardNumber: 1 shardNumber: 1
shard2: shard2:
shardNumber: 2 shardNumber: 2
shard3: shard3:
shardNumber: 3 shardNumber: 3
shard4: shard4:
shardNumber: 4 shardNumber: 4
steps: steps:
- task: Docker@2 - task: Docker@2
displayName: 'Build Docker Image' displayName: "Build Docker Image"
inputs: inputs:
command: build command: build
dockerfile: Dockerfile.playwright dockerfile: Dockerfile.playwright
repository: $(dockerImageName) repository: $(dockerImageName)
tags: $(imageTag) tags: $(imageTag)
arguments: '--no-cache --pull' arguments: "--no-cache --pull"
- script: | - script: |
# Create container and run tests # Create container and run tests
container_id=$(docker create \ container_id=$(docker create \
--ipc=host \ --ipc=host \
-e "CCIS_API_AUTH=$(CCIS_API_AUTH)" \ -e "CCIS_API_AUTH=$(CCIS_API_AUTH)" \
-e "BASE_URL=$(BASE_URL)" \ -e "BASE_URL=$(BASE_URL)" \
-e "CCIS_API_URL=$(CCIS_API_URL)" \ -e "CCIS_API_URL=$(CCIS_API_URL)" \
-e "ADMIN_SERVICE_API_URL=$(ADMIN_SERVICE_API_URL)" \ -e "ADMIN_SERVICE_API_URL=$(ADMIN_SERVICE_API_URL)" \
-e "SHARD=$(shardNumber)" \ -e "SHARD=$(shardNumber)" \
-e CI=true \ -e CI=true \
-e "NODE_ENV=$(NODE_ENV)" \ -e "NODE_ENV=$(NODE_ENV)" \
$(dockerImageName):$(imageTag) \ $(dockerImageName):$(imageTag) \
npx concurrently -k -n "server,playwright"\ npx concurrently -k -n "server,playwright"\
"sed -i \"s|^process\.env\.VUE_APP_CONSUMER_CF_DISTRO = .*|process\.env\.VUE_APP_CONSUMER_CF_DISTRO='https://digitalapi.test.safelite.io'|\" \"./vue.config.js\" && echo \"Updated config file to use TEST APIs\" && npm run serve -- --port=8080"\ "sed -i \"s|^process\.env\.VUE_APP_CONSUMER_CF_DISTRO = .*|process\.env\.VUE_APP_CONSUMER_CF_DISTRO='https://digitalapi.test.safelite.io'|\" \"./vue.config.js\" && echo \"Updated config file to use TEST APIs\" && npm run serve -- --port=8080"\
"npx wait-on http://localhost:8080/fmg/ && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@CASH|@Alert\"") "npx wait-on http://localhost:8080/fmg/ && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@CASH|@Alert\"")
# Start container and stream logs # Start container and stream logs
echo "Starting tests for shard $(shardNumber)..." echo "Starting tests for shard $(shardNumber)..."
docker start -a $container_id docker start -a $container_id
# Create directory for test results # Create directory for test results
echo "Creating test results directory..." echo "Creating test results directory..."
mkdir -p $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber) mkdir -p $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)
# Copy test results from container # Copy test results from container
echo "Copying test results..." echo "Copying test results..."
docker cp $container_id:/app/blob-report/. $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)/ docker cp $container_id:/app/blob-report/. $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)/
# Remove container # Remove container
echo "Cleaning up container..." echo "Cleaning up container..."
docker rm $container_id docker rm $container_id
# Check if tests failed # Check if tests failed
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Tests failed in shard $(shardNumber) or tests don't exist for this shard number!" echo "Tests failed in shard $(shardNumber) or tests don't exist for this shard number!"
exit 0 # Suppress error. It will be visible in report. exit 0 # Suppress error. It will be visible in report.
fi fi
displayName: 'Run Playwright Tests - Shard $(shardNumber)' displayName: "Run Playwright Tests - Shard $(shardNumber)"
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: 'Publish Test Reports - Shard $(shardNumber)' displayName: "Publish Test Reports - Shard $(shardNumber)"
condition: always() condition: always()
inputs: inputs:
targetPath: '$(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)' targetPath: "$(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)"
artifact: 'playwright-report-shard-$(shardNumber)' artifact: "playwright-report-shard-$(shardNumber)"
publishLocation: 'pipeline' publishLocation: "pipeline"
- script: | - script: |
docker rmi $(dockerImageName):$(imageTag) -f docker rmi $(dockerImageName):$(imageTag) -f
displayName: 'Cleanup Docker Image' displayName: "Cleanup Docker Image"
condition: always() condition: always()
- job: download_and_merge_reports - job: download_and_merge_reports
dependsOn: playwright_tests dependsOn: playwright_tests
timeoutInMinutes: 8 timeoutInMinutes: 8
cancelTimeoutInMinutes: 10 cancelTimeoutInMinutes: 10
steps: steps:
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' targetPath: "$(System.DefaultWorkingDirectory)/playwright-reports"
- task: Docker@2 - task: Docker@2
displayName: 'Build Docker Image' displayName: "Build Docker Image"
inputs: inputs:
command: build command: build
dockerfile: Dockerfile.playwright dockerfile: Dockerfile.playwright
repository: $(dockerImageName) repository: $(dockerImageName)
tags: $(imageTag) tags: $(imageTag)
arguments: '--no-cache --pull' arguments: "--no-cache --pull"
- bash: | - bash: |
# Create container for jira writeback # Create container for jira writeback
container_id=$(docker create \ container_id=$(docker create \
--ipc=host \ --ipc=host \
-e "JIRA_SERVER=$(JIRA_SERVER)" \ -e "JIRA_SERVER=$(JIRA_SERVER)" \
-e "JIRA_USERNAME=$(JIRA_USERNAME)" \ -e "JIRA_USERNAME=$(JIRA_USERNAME)" \
-e "JIRA_API_KEY=$(JIRA_API_KEY)" \ -e "JIRA_API_KEY=$(JIRA_API_KEY)" \
-e "IS_REGRESSION=$(IS_REGRESSION)" \ -e "IS_REGRESSION=$(IS_REGRESSION)" \
-e "JIRA_BOARD_ID=$(JIRA_BOARD_ID)" \ -e "JIRA_BOARD_ID=$(JIRA_BOARD_ID)" \
-e "JIRA_EPIC_KEY=$(JIRA_EPIC_KEY)" \ -e "JIRA_EPIC_KEY=$(JIRA_EPIC_KEY)" \
-e "JIRA_PROJECT_KEY=$(JIRA_PROJECT_KEY)" \ -e "JIRA_PROJECT_KEY=$(JIRA_PROJECT_KEY)" \
$(dockerImageName):$(imageTag) \ $(dockerImageName):$(imageTag) \
bash -c "echo \"Moving Playwright reports out of subfolders...\" && bash -c "echo \"Moving Playwright reports out of subfolders...\" &&
find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; &&
echo \"Merging reports...\" && echo \"Merging reports...\" &&
PLAYWRIGHT_JUNIT_OUTPUT_DIR='/app/test-results' PLAYWRIGHT_JUNIT_OUTPUT_NAME='junit_results.xml' npx playwright merge-reports --reporter='playwright-tests/impl/reporter/JiraWritebackReporter.ts',junit ./playwright-reports PLAYWRIGHT_JUNIT_OUTPUT_DIR='/app/test-results' PLAYWRIGHT_JUNIT_OUTPUT_NAME='junit_results.xml' npx playwright merge-reports --reporter='playwright-tests/impl/reporter/JiraWritebackReporter.ts',junit ./playwright-reports
echo \"Contents of ortoni-report:\" && ls ./ortoni-report && echo \"Contents of ortoni-report:\" && ls ./ortoni-report &&
echo 'Current dir: ' && pwd echo 'Current dir: ' && pwd
echo 'Contents of current dir: ' && ls echo 'Contents of current dir: ' && ls
echo 'Contents of /app/test-results' && ls /app/test-results ") echo 'Contents of /app/test-results' && ls /app/test-results ")
# Start container and stream logs # Start container and stream logs
echo "Starting merge" echo "Starting merge"
docker start -a $container_id docker start -a $container_id
# Create directory for test results # Create directory for test results
echo "Creating test results directory..." echo "Creating test results directory..."
mkdir -p $(System.DefaultWorkingDirectory)/ortoni-report mkdir -p $(System.DefaultWorkingDirectory)/ortoni-report
mkdir -p $(System.DefaultWorkingDirectory)/test-results mkdir -p $(System.DefaultWorkingDirectory)/test-results
# Copy test results from container # Copy test results from container
echo "Copying test results..." echo "Copying test results..."
docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report
docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory)/test-results docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory)/test-results
# Remove container # Remove container
echo "Cleaning up container..." echo "Cleaning up container..."
docker rm $container_id docker rm $container_id
env: env:
JIRA_API_KEY: $(JIRA_API_KEY) JIRA_API_KEY: $(JIRA_API_KEY)
displayName: merge_and_publish_results_to_jira displayName: merge_and_publish_results_to_jira
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: 'Publish test results' displayName: "Publish test results"
inputs: inputs:
searchFolder: 'test-results' searchFolder: "test-results"
testResultsFormat: 'JUnit' testResultsFormat: "JUnit"
testResultsFiles: 'junit_results.xml' testResultsFiles: "junit_results.xml"
mergeTestResults: true mergeTestResults: true
failTaskOnFailedTests: false failTaskOnFailedTests: false
testRunTitle: 'Playwright Tests' testRunTitle: "Playwright Tests"
condition: succeededOrFailed() condition: succeededOrFailed()
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: 'Publish Merged Report' displayName: "Publish Merged Report"
condition: always() condition: always()
inputs: inputs:
targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' targetPath: "$(System.DefaultWorkingDirectory)/ortoni-report"
artifact: 'playwright-merged-report' artifact: "playwright-merged-report"
publishLocation: 'pipeline' publishLocation: "pipeline"
- script: | - script: |
docker rmi $(dockerImageName):$(imageTag) -f docker rmi $(dockerImageName):$(imageTag) -f
displayName: 'Cleanup Docker Image' displayName: "Cleanup Docker Image"
condition: always() condition: always()

View file

@ -37,13 +37,13 @@ variables:
- group: Digital-Infrastructure - group: Digital-Infrastructure
- group: FixMyGlass-BuildBranches - group: FixMyGlass-BuildBranches
- name: dockerImageName - name: dockerImageName
value: 'playwright-tests' value: "playwright-tests"
- name: imageTag - name: imageTag
value: '$(Build.BuildId)' value: "$(Build.BuildId)"
- name: totalShards - name: totalShards
value: 2 value: 2
- name: IS_REGRESSION - name: IS_REGRESSION
value: 'false' value: "false"
stages: stages:
# PR's # PR's
@ -78,13 +78,13 @@ stages:
steps: steps:
- task: Docker@2 - task: Docker@2
displayName: 'Build Docker Image' displayName: "Build Docker Image"
inputs: inputs:
command: build command: build
dockerfile: Dockerfile.playwright dockerfile: Dockerfile.playwright
repository: $(dockerImageName) repository: $(dockerImageName)
tags: $(imageTag) tags: $(imageTag)
arguments: '--no-cache --pull' arguments: "--no-cache --pull"
- script: | - script: |
branch_name=$(System.PullRequest.SourceBranch) branch_name=$(System.PullRequest.SourceBranch)
@ -125,19 +125,19 @@ stages:
echo "Tests failed in shard $(shardNumber) or tests don't exist for this shard number!" echo "Tests failed in shard $(shardNumber) or tests don't exist for this shard number!"
exit 0 # Suppress error. It will be visible in report. exit 0 # Suppress error. It will be visible in report.
fi fi
displayName: 'Run Playwright Tests - Shard $(shardNumber)' displayName: "Run Playwright Tests - Shard $(shardNumber)"
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: 'Publish Test Reports - Shard $(shardNumber)' displayName: "Publish Test Reports - Shard $(shardNumber)"
condition: always() condition: always()
inputs: inputs:
targetPath: '$(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)' targetPath: "$(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)"
artifact: 'playwright-report-shard-$(shardNumber)' artifact: "playwright-report-shard-$(shardNumber)"
publishLocation: 'pipeline' publishLocation: "pipeline"
- script: | - script: |
docker rmi $(dockerImageName):$(imageTag) -f docker rmi $(dockerImageName):$(imageTag) -f
displayName: 'Cleanup Docker Image' displayName: "Cleanup Docker Image"
condition: always() condition: always()
# Add job to merge test reports and update Jira # Add job to merge test reports and update Jira
@ -148,15 +148,15 @@ stages:
steps: steps:
- task: DownloadPipelineArtifact@2 - task: DownloadPipelineArtifact@2
inputs: inputs:
targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' targetPath: "$(System.DefaultWorkingDirectory)/playwright-reports"
- task: Docker@2 - task: Docker@2
displayName: 'Build Docker Image' displayName: "Build Docker Image"
inputs: inputs:
command: build command: build
dockerfile: Dockerfile.playwright dockerfile: Dockerfile.playwright
repository: $(dockerImageName) repository: $(dockerImageName)
tags: $(imageTag) tags: $(imageTag)
arguments: '--no-cache --pull' arguments: "--no-cache --pull"
- bash: | - bash: |
branch_name=$(System.PullRequest.SourceBranch) branch_name=$(System.PullRequest.SourceBranch)
echo "Retrieved branch name: '$branch_name'" echo "Retrieved branch name: '$branch_name'"
@ -200,30 +200,30 @@ stages:
echo "Cleaning up container..." echo "Cleaning up container..."
docker rm $container_id docker rm $container_id
env: env:
JIRA_API_KEY: $(JIRA_API_KEY) JIRA_API_KEY: $(JIRA_API_KEY)
displayName: merge_and_publish_results_to_jira displayName: merge_and_publish_results_to_jira
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: 'Publish test results' displayName: "Publish test results"
inputs: inputs:
searchFolder: 'test-results' searchFolder: "test-results"
testResultsFormat: 'JUnit' testResultsFormat: "JUnit"
testResultsFiles: 'junit_results.xml' testResultsFiles: "junit_results.xml"
mergeTestResults: true mergeTestResults: true
failTaskOnFailedTests: false failTaskOnFailedTests: false
testRunTitle: 'Playwright Tests' testRunTitle: "Playwright Tests"
condition: succeededOrFailed() condition: succeededOrFailed()
- task: PublishPipelineArtifact@1 - task: PublishPipelineArtifact@1
displayName: 'Publish Merged Report' displayName: "Publish Merged Report"
condition: always() condition: always()
inputs: inputs:
targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' targetPath: "$(System.DefaultWorkingDirectory)/ortoni-report"
artifact: 'playwright-merged-report' artifact: "playwright-merged-report"
publishLocation: 'pipeline' publishLocation: "pipeline"
- script: | - script: |
docker rmi $(dockerImageName):$(imageTag) -f docker rmi $(dockerImageName):$(imageTag) -f
displayName: 'Cleanup Docker Image' displayName: "Cleanup Docker Image"
condition: always() condition: always()
- ${{ else }}: - ${{ else }}:
# Dev Build/Deploy # Dev Build/Deploy
@ -473,4 +473,4 @@ stages:
parameters: parameters:
dependsOn: prodBuildDeployment dependsOn: prodBuildDeployment
userName: SafeliteAzureDevops userName: SafeliteAzureDevops
userEmail: githubazuredevops@safelite.com userEmail: githubazuredevops@safelite.com